01:26:48 | * | XAMPP_ quit (Quit: Leaving) |
01:27:35 | * | XAMPP joined #nimrod |
01:45:55 | * | q66 quit (Quit: Quit) |
02:05:08 | * | reactormonk joined #nimrod |
04:36:27 | * | XAMPP quit (Ping timeout: 276 seconds) |
04:36:54 | * | XAMPP joined #nimrod |
05:24:33 | * | XAMPP quit (Ping timeout: 276 seconds) |
05:25:46 | * | XAMPP joined #nimrod |
05:25:46 | * | XAMPP quit (Changing host) |
05:25:46 | * | XAMPP joined #nimrod |
06:14:59 | * | Trix[a]r_za is now known as Trixar_za |
07:59:04 | Araq | fowl: it's expected behaviour ;-) |
07:59:28 | Araq | you're on your own if you overwrite the terminating zero |
08:05:36 | * | Trixar_za is now known as Trix[a]r_za |
08:51:54 | dom96 | hello |
08:54:11 | Araq | hi dom96 |
09:58:44 | dom96 | fowl: Looks like I will be using your sfml bindings for Ludum Dare ;) |
10:03:42 | fowl | dom96: cool, you might like my input helpers https://github.com/fowlmouth/gotterdammerungarschloch/blob/master/input.nim they handle most meaningful events |
10:05:25 | fowl | csfml is missing a renderwindow_getmousepos() so you have to track the position from the mousemove event |
10:06:01 | dom96 | What license is that code? :P |
10:07:02 | fowl | smfl has an open license as long as you dont impersonate laurent gomila |
10:07:16 | dom96 | Yeah, but I mean your code. |
10:07:27 | dom96 | In particular that input.nim file. |
10:08:47 | fowl | hmm i dunno |
10:09:28 | fowl | i declare it, public domain |
10:09:43 | dom96 | cool |
10:09:49 | dom96 | thanks :D |
10:10:14 | dom96 | The theme for this LD is Evolution btw |
10:13:36 | * | dom96 doesn't have a concrete idea yet |
10:13:38 | * | q66 joined #nimrod |
10:15:35 | fowl | i would never be able to decide on something in time to start coding it |
10:21:57 | dom96 | hrm, I think i'll be fine without input.nim to be honest. |
10:34:31 | fowl | word |
10:34:39 | fowl | g'night |
11:00:11 | dom96 | good night fowl |
12:36:31 | * | Trix[a]r_za is now known as Trixar_za |
12:37:15 | Trixar_za | dom96: When's the Ludum Dare? |
12:37:25 | dom96 | It started already |
12:37:35 | Trixar_za | Er, crap? |
12:37:46 | dom96 | Are you competing heh? |
12:37:57 | Trixar_za | http://eris.oppresses.us/tmp/idontremember.jpg |
12:37:59 | dom96 | As of right now all I have is a window which displays the FPS :P |
12:38:00 | Trixar_za | I wanted to |
12:39:25 | dom96 | you still should |
12:39:27 | dom96 | Theme is evolution |
12:41:09 | Trixar_za | I've been looking for the one game for years. Could never remember it's name |
12:42:09 | Trixar_za | But it was very simple. You gave each shape 3 actions to deal with situations - as in turn left to avoid preditors, turn right towards possible mates, stuff like that |
12:42:50 | Trixar_za | That was my first experience of a teachable AI |
12:42:54 | Trixar_za | even if it was simplistic |
12:43:03 | Trixar_za | I wonder how hard it would be to write a cheap ass version of that |
13:00:11 | dom96 | I have an idea, but it seems overfly complex as always |
13:00:44 | dom96 | *ovely |
13:00:47 | dom96 | *overly |
13:13:36 | Trixar_za | It's evolution right? So it can be anything |
13:13:41 | Trixar_za | Like Conway's Life |
13:13:46 | dom96 | It can't be anything. |
13:14:02 | dom96 | best that it has some sort of connection to 'evolution' |
13:14:16 | dom96 | of course that could just be evolving your character by buying upgrades or whatever |
13:14:16 | Trixar_za | I meant in the form of one thing evolving to another |
13:14:32 | dom96 | It seems most people are thinking of cells |
13:14:46 | dom96 | And are making some sort of bacteria fighter game |
13:15:06 | Trixar_za | http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life |
13:15:11 | Trixar_za | :P |
13:15:29 | Trixar_za | I'm always fascinated by them |
13:15:55 | Trixar_za | The only real 'good' use for math imho |
13:16:19 | dom96 | Trixar_za: Are you competing then? |
13:16:31 | Trixar_za | I'll try |
13:16:42 | Trixar_za | I always wanted to write my own copy of Conway's Game of Life |
13:17:16 | dom96 | What language will you use? :P |
13:17:53 | Trixar_za | I'll try Nimrod, but I'll probably fall back to Python :P |
13:18:50 | dom96 | Don't you dare fall back :P |
13:25:38 | dom96 | Araq: Did you fix Ctrl + /? |
13:25:47 | dom96 | or is it still broken in Aporia? |
13:26:10 | Araq | still broken, but I don't mind |
13:26:21 | Araq | I always use 'when false' + indentation anyway |
13:27:29 | dom96 | Araq: With Ctrl + / you can select the code you want to comment and it will comment out multiple lines for you. |
13:27:36 | dom96 | (Using discard """ however) |
13:27:48 | Araq | I know, there is also a button for it |
13:27:52 | Araq | so I tried that :P |
13:29:03 | dom96 | I see |
13:31:01 | Trixar_za | Damn you dom96 |
13:31:08 | Trixar_za | Now you got me reading about Alife sims |
13:31:21 | dom96 | hrm? |
13:32:39 | Trixar_za | Most of them are based off Core Wars or a mix of Conway's Game of Life and Core wars |
13:37:33 | Araq | ugh |
13:38:26 | Araq | I hate it when I make some feature cleaner only to discover that the old solution was easier and worked better |
13:48:48 | ccssnet | Araq: true, rarely happens to me though |
13:49:02 | ccssnet | probably because i do functional programming |
14:07:39 | * | Trixar_za is now known as Trix[a]r_za |
15:12:34 | dom96 | argh |
15:12:41 | dom96 | I think I'm going to give up. |
15:13:21 | fowl | http://www.youtube.com/watch?v=PW3RqGgEkHs |
15:13:27 | fowl | whys that |
15:13:58 | dom96 | Every idea I have feels like too much work :P |
15:25:37 | fowl | hrm so i was going to write my events out in json like ["spawn-obj", ["Solar Mold", ["random-pos"]]], ["if-chance", [10, ["spawn-obj", ["Mold Sprite"]]]] then parse them and look up all the objects needed and store them for later but i have no idea how to store this type of thing :/ |
15:27:59 | dom96 | fowl: I'm curious how your game looks like, can you provide a screenshot? |
15:28:18 | dom96 | fowl: Nimrod has a marshal module |
15:28:25 | dom96 | I'm not sure if that's what you're looking for. |
15:28:34 | dom96 | It actually uses JSON as the serialization format |
15:29:35 | fowl | dom96: http://minus.com/lytlUi08DbGft still have debug texts drawing and not much going on yet :p |
15:29:54 | dom96 | lol |
15:29:54 | fowl | the lobby: http://minus.com/lPfr1Dd5YTdv5 |
15:29:56 | dom96 | 'poo' |
15:30:17 | dom96 | looks pretty cool |
16:13:44 | Araq | so, dom96, how's progress? |
16:13:55 | dom96 | I gave up |
16:14:05 | Araq | :'-( |
16:15:21 | dom96 | The more I think about what I want the game to be the more difficult it seems. |
16:15:52 | * | shevy quit (Ping timeout: 245 seconds) |
16:20:01 | dom96 | Araq: So why doesn't Ctrl + / work for you? |
16:20:19 | Araq | because keys never work in gtk |
16:20:31 | Araq | they always work for you and not for me |
16:22:22 | fowl | works for me :) |
16:22:58 | dom96 | Araq: I bet your WM messes with it. |
16:23:09 | Araq | don't worry about it |
16:23:19 | Araq | as I said, I don't care about that feature anyway |
16:23:31 | dom96 | Yes, but it might not work for others. |
16:28:57 | * | shevy2 joined #nimrod |
16:30:01 | fowl | Hey I thought there was a clear(seq[T]) function |
16:30:03 | fowl | was i high |
16:31:38 | dom96 | Just assign @[] to it? |
16:39:11 | * | q66 quit (Quit: Quit) |
16:40:19 | fowl | dom96: http://www.youtube.com/watch?v=wXzg0D-cKds :) |
16:42:00 | dom96 | lol wtf |
16:43:53 | * | q66 joined #nimrod |
16:49:58 | Araq | fowl: use setlen(x, 0) |
17:03:51 | fowl | what do you think about this https://gist.github.com/3467925 |
17:09:19 | Araq | fowl: well? |
17:09:39 | Araq | I fail to see your point; still a bug in stringstream? |
17:10:23 | fowl | yea |
17:11:49 | Araq | do you use the fixed system.clamp? |
17:12:39 | fowl | i didnt see a difference in it? |
17:12:46 | Araq | I fixed it :P |
17:13:03 | Araq | the < and > were the other way round |
17:13:10 | fowl | ah |
17:13:19 | fowl | i think it should be <= and >= |
17:13:29 | Araq | why? |
17:14:07 | fowl | <= and >= handle more edge cases |
17:14:37 | Araq | if x < a: return a |
17:14:41 | Araq | seems reasonable |
17:14:50 | fowl | in this case clamp(0, 0, -1) is being called and even though the max is -1 i assumed it would hit on the min 0 |
17:15:32 | fowl | but i assume its like min(a, max(b, x)) its a bit different |
17:15:43 | Araq | hrm I dunno |
17:15:53 | Araq | maybe you're right |
17:16:20 | Araq | if b < a then the range is empty and 'a' should be returned ... perhaps |
17:17:15 | Araq | clamp(x, low(s), high(s)) should return -1 aka high(s) if 's' is empty |
17:17:25 | fowl | might as well use min(max()) it does everything that logic does |
17:17:49 | Araq | no, min(max()) is a cludge |
17:18:06 | Araq | you want to enforce it's in the interval [a,b] |
17:18:25 | Araq | btw I always get min and max wrong :P |
17:19:15 | Araq | 'clamp' fits much more what I have in mind |
17:21:01 | fowl | then this: s.pos = clamp(pos, 0, s.data.high) should be clamp(pos, 0, s.data.len) ? you dont want to start writing on high(str) you want the next char (am i right in thinking this?) |
17:22:06 | Araq | you can either write to a stringstream or read from it |
17:23:04 | Araq | if you set the position it'd better be a valid position in the written string |
17:24:10 | Araq | ss.data.setlen 0 # plays with the internals |
17:24:31 | Araq | maybe 'pos' should be exported too so that you can do whatever you like with it? |
17:24:42 | fowl | i do that in my flush implementation |
17:26:09 | Araq | just fix it and make a pull request |
17:26:21 | Araq | extra points if the docs are improved too :P |
17:27:27 | * | shevy2 is now known as shevy |
17:28:41 | Araq | argh, I wish Zahary was here |
17:29:05 | fowl | Araq: here's a better example of it being weird; https://gist.github.com/3467925#file_test2.nim |
17:29:18 | Araq | my problem is easy to fix if only I would knew what the spec should look like ... :-/ |
17:30:08 | Araq | fowl: as I said, you read and write from the stream that's why it doesn't make sense |
17:30:21 | Araq | it works if you only read or only write |
17:30:49 | Araq | as I said, improve it and make a pull request, I've better things to work out :P |
17:31:02 | fowl | Araq: o_O streams are ok to read and write from im showing the setposition weirdness |
17:31:06 | fowl | lol |
17:31:08 | fowl | ok |
17:45:00 | Araq | fowl: I thought setPosition only makes sense for reading :P |
17:56:29 | fowl | well yes it doesnt make sense to do that.. but i use setposition() in my flush function |
20:52:52 | Araq | ping Boscop |
20:53:25 | Boscop | pong Araq |
20:53:43 | Araq | I'm thinking about symbol binding rules again |
20:53:47 | Boscop | ah |
20:54:21 | Araq | and I figured that the compiler could easily do a partial type checking |
20:54:44 | Araq | so if we have a generic type T and an == that is concerned with T |
20:55:22 | Araq | it's an "open" symbol which means it will be bound at instantiation |
20:55:43 | Araq | and other occurances of == can be bound early |
20:56:56 | Araq | in fact, the compiler performs that partial type checking already for IDE support ... |
20:58:53 | Araq | I wonder why no programming language does it this way? |
20:59:23 | Araq | what am I missing? |
21:10:31 | Araq | Boscop: well? understood my idea? |
21:11:04 | Boscop | you mean == is a generic operator with type variable T? |
21:12:47 | Araq | no, == is overloaded for lots of types |
21:13:16 | Araq | but if we have current.key == key in a generic |
21:13:43 | Araq | this == should be "open", so that later definitions of == are considered in the instantiation process |
21:14:14 | Boscop | template overloading? |
21:14:56 | Araq | well in C++ terminology I'm talking about symbol binding rules in a template, yes |
21:15:23 | Boscop | D has template overloading |
21:16:25 | Araq | so D does it the way I'm proposing? |
21:17:34 | Boscop | which symbols would be bound early in your idea, and what do you mean by "and other occurances of == can be bound early"? |
21:18:02 | Araq | https://github.com/Araq/Nimrod/blob/master/lib/pure/collections/sets.nim |
21:18:16 | Araq | take a look at line 67 |
21:18:26 | Araq | proc RawGet[A](s: TSet[A], key: A): int = |
21:18:27 | Araq | rawGetImpl() |
21:18:48 | Araq | which refers to line 52, unfortunately |
21:18:54 | Araq | so don't get distracted |
21:19:08 | Araq | line 55: if s.data[h].key == key and s.data[h].slot == seFilled: |
21:19:46 | Araq | the key comparison is an "open" occurance of == |
21:20:00 | Boscop | so the == should be instantiated with A from RawGet? |
21:20:12 | Araq | yes |
21:20:15 | Boscop | ah |
21:21:17 | Araq | but 's.data[h].slot == seFilled' can be bound at definition time of the generic |
21:21:21 | Boscop | yeah, you can have mixin templates which are typechecked at instantiation time and place |
21:21:46 | Araq | yes well nimrod currently does it only at instantiation time |
21:21:48 | Boscop | that code would have to be treated symbolically |
21:22:07 | Araq | and I want it to be partially done at definition time |
21:22:12 | Boscop | ah |
21:22:22 | Boscop | so you could propagate the type variable A |
21:22:30 | Araq | exactly |
21:22:34 | Boscop | make rawGetImpl dependent on A |
21:22:56 | Araq | true, but just assume rawGetImpl() doesn't exist |
21:23:04 | Boscop | and then have the constraint (e.g. with type classes or similar) that == is defined for A |
21:23:05 | Araq | and RawGet has the body |
21:23:33 | Araq | that's true but I don't want that constraint to be explicitly written down |
21:23:43 | Araq | because it's redundant |
21:23:56 | Araq | and can get annoying |
21:24:18 | Araq | in this example, it would make the code clearer, I agree |
21:24:44 | Boscop | if you want typechecking to be done partially at def time, you'd need to know that == is defined for A, whatever A will be, otherwise you end up the same as C++ and have to typecheck the whole template body at each instantiation |
21:25:01 | Boscop | not to mention hard to read error messages |
21:25:23 | Boscop | of course you don't have to write the constraint down if the compiler can infer it |
21:25:49 | Boscop | but then the template has to know which types are variables |
21:26:02 | Araq | well yes, but I wonder why C++ doesn't do that partial type checking I'm talking about |
21:26:03 | Boscop | so it has to have a type variable where A will be plugged in |
21:26:26 | Boscop | because of template specialization |
21:26:34 | Boscop | it has to instantiate before it knows the body |
21:26:45 | Boscop | and it can`t infer constraints |
21:27:36 | Boscop | so it has to typecheck the body on each instantiation |
21:27:48 | Boscop | which is one reason for its slow compile-times |
21:28:18 | Araq | yeah, yeah, well I'm repeating C++'s mistakes and am aware of it ;-) |
21:29:06 | Boscop | yeah, I wouldn't do it the c++ way |
21:29:33 | Boscop | I would infer constraints, but for that the variable types in a template need to be known |
21:29:55 | Araq | the variable types in a template are known in nimrod |
21:30:09 | Boscop | because that's what the binding of the operators etc depends on |
21:30:09 | Araq | unless I'm missing something :-) |
21:30:26 | Araq | true |
21:30:40 | Boscop | hm, but in rawGetImpl the A is not known, but you want == to be chosen for the A in the caller scope |
21:31:05 | Araq | you got distracted by the rawGetImpl ;-) |
21:31:23 | Boscop | isn`t that what you want to be able to partially typecheck? |
21:31:38 | Araq | ignore that, just think its body is directly in RawGet[A] ... |
21:32:08 | Araq | (templates are resolved at definition time in generics already) |
21:32:10 | Boscop | ok, and what do you want to partially typecheck? |
21:32:34 | Araq | s.data[h].key == key # infer == for A |
21:32:54 | Araq | but I don't call it inferring because that's not what the compiler does ;-) |
21:33:14 | Araq | instead it would fail type checking and so the '==' would be marked as an "unbound" symbol |
21:33:33 | Araq | and bound at instantiation time |
21:34:11 | Araq | so yeah the generic would be checked at instantiation time like in C++ |
21:34:22 | Boscop | so when RawGet is instantiated, all overloads of == in the instantiation scope are considered to choose the one for the A? |
21:34:36 | Araq | yes exactly |
21:34:59 | Boscop | and what is the problem? |
21:35:14 | Araq | well no problem for now |
21:35:22 | Araq | but I wonder why C++ doesn't do it this way |
21:35:31 | Araq | and if there is any PL that works this way |
21:37:09 | Araq | I'm not really trying to solve the implicit constraints problem |
21:37:09 | Boscop | c++'s lookup rules are pretty complicated |
21:37:30 | Araq | I'm trying to come up with symbol binding rules that are "natural" |
21:38:28 | Boscop | often there is no one true way |
21:38:55 | Boscop | language design is also experimentation to some degree |
21:39:03 | Araq | I know :-) |
21:39:12 | Araq | it helps to have production code around :D |
21:39:30 | Araq | and see how the rules would do for that |
21:39:35 | Boscop | one way to try would be: the union of the set of overloads from definition scope and instantiation scope should be considered for lookup |
21:39:53 | Araq | well that's another point |
21:39:59 | Boscop | so that custom definitions can override the ones at definition scope |
21:40:00 | Araq | and in fact Nimrod does that |
21:40:06 | Boscop | ah |
21:40:31 | Araq | the problem is when you have helpers which are private |
21:40:48 | Araq | you don't want client code to accidently override them |
21:41:11 | Araq | you can do that currently in nimrod with a "bind" statement, but that's the wrong default |
21:41:32 | Araq | default should be "bind", and 'open' symbols should be marked explicitely |
21:41:48 | Araq | which however is too ugly in practice |
21:42:03 | Araq | so I implemented the wrong solution :-) |
21:43:09 | Araq | and now I think I found a set rules to get the best of both worlds and wonder why nobody else does it this way ;-) |
21:43:16 | Araq | *a set of rules |
21:43:16 | Boscop | or you do it with implicit args, or explicit args, e.g. the == would be passed as arg to the template |
21:43:34 | Boscop | and it has a default value, the == at definition scope |
21:43:45 | Araq | yeah but that gets verbose too |
21:43:50 | Boscop | yeah |
21:44:37 | Boscop | another solution to preventing overrides would be local definitions |
21:44:48 | Boscop | so that they shadow outer ones |
21:44:58 | Araq | that's my "bind" statement |
21:45:06 | Araq | proc p[T] ... |
21:45:12 | Boscop | and you can use an import statement or 'using' to pull in something into the local scope |
21:45:14 | Araq | bind myHelper, myHelper2 |
21:45:19 | Boscop | ah |
21:45:37 | Araq | but as I said, it's the wrong default ;-) |
21:46:32 | Araq | but thinking about it, my new idea doesn't work |
21:46:39 | Boscop | why? |
21:46:42 | Araq | proc p[T](x: T) = |
21:46:56 | Araq | helper(x) # I want this to be bound early |
21:47:19 | Araq | but 'x' is of type T, so will remain "open" |
21:47:30 | Araq | the compiler cannot tell the difference between: |
21:47:32 | Araq | x == y |
21:47:34 | Araq | and |
21:47:36 | Araq | helper(x) |
21:49:22 | Araq | ok, it can with an even more complicated set of rules |
21:49:37 | Araq | but ugh |
21:49:44 | Boscop | the set of overloads to be considered can be different for each symbol occurring in the template body |
21:50:13 | Boscop | so you do 'bind helper;" but don't bind == |
21:51:00 | Araq | well sure and 'bind' works this way today already in Nimrod :-) |
21:51:33 | Boscop | so why doesn't your idea work then? |
21:51:52 | Araq | my idea was to come up with more complex rules and get rid of the 'bind' |
21:52:15 | Araq | but now I got it that the rules are not as simple as I imagined |
21:52:47 | Araq | it doesn't suffice to re-use my IDE features to solve that problem :D |
21:53:39 | Araq | now back to C++: |
21:53:59 | Araq | I'm not sure that checking only at instantiation time is really that much of a problem |
21:54:19 | Araq | it's a natural solution if you want compile time "duck typing" |
21:55:17 | Araq | and if you're gonna monomorphize generics |
21:55:20 | Boscop | but you get slow compile-times and unreadable errors |
21:55:46 | Araq | slow compile-times are also related to its non existing module concept |
21:56:10 | Araq | and the unreadable errors are due to the complex implementations |
21:56:28 | Araq | the STL for instance seems to be much more complex than it needs to be |
21:56:44 | Araq | but it has to 'struct' everything for better type checking |
21:57:06 | Araq | and C++ has a very weak type system |
21:57:15 | Boscop | yeah |
21:57:19 | Araq | with conversions between int and bool, etc. |
21:57:50 | Araq | so I hope these problems won't be as severe for Nimrod as they are for C++ |
21:59:02 | Boscop | yeah, the problem is you can only instantiate the right specialization of a template if you know its arguments, which might be template arguments themselves |
21:59:32 | Araq | and a bad compiler error message is still better than any runtime error message IMHO |
22:00:15 | Boscop | yeah |
22:01:20 | Araq | btw you can have this in Nimrod: |
22:01:41 | Araq | proc `==` (a, b: myType, someFlag: bool = false) |
22:02:10 | Araq | and then the `==` should match a constraint that doesn't consider default parameters |
22:02:54 | Araq | this constraint stuff needs to be permissive IMO |
22:03:03 | Boscop | how do you call binary operators with more than two operands in nimrod? |
22:03:17 | Araq | prefix style then: |
22:03:24 | Araq | `==`(2,3, true) |
22:03:54 | Araq | you can still use the infix style if the default fits |
22:04:07 | Boscop | ok |
22:06:47 | Araq | when you monorphize (correct term?) generics, they are really macros, so you may as well want to get the expressitivity of macros in return ;-) |
22:12:56 | Boscop | but do you have some constraints for the template arguments, like concepts or type classes? |
22:14:20 | Araq | there is: |
22:14:34 | Araq | proc p[T: array|seq|object](x: T) |
22:14:47 | Araq | for now and a 'compiles' magic that you can use |
22:15:03 | Araq | which is like D's is(typeof(X)) crap |
22:15:22 | Araq | but readable ;-) |
22:15:38 | Araq | when not compiles(x + y): |
22:15:52 | Araq | {.error: "generic needs to support the + operator.} |
22:20:33 | Boscop | D also has __traits(compiles,expr) |