<<25-08-2012>>

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:04Araqfowl: it's expected behaviour ;-)
07:59:28Araqyou'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:54dom96hello
08:54:11Araqhi dom96
09:58:44dom96fowl: Looks like I will be using your sfml bindings for Ludum Dare ;)
10:03:42fowldom96: cool, you might like my input helpers https://github.com/fowlmouth/gotterdammerungarschloch/blob/master/input.nim they handle most meaningful events
10:05:25fowlcsfml is missing a renderwindow_getmousepos() so you have to track the position from the mousemove event
10:06:01dom96What license is that code? :P
10:07:02fowlsmfl has an open license as long as you dont impersonate laurent gomila
10:07:16dom96Yeah, but I mean your code.
10:07:27dom96In particular that input.nim file.
10:08:47fowlhmm i dunno
10:09:28fowli declare it, public domain
10:09:43dom96cool
10:09:49dom96thanks :D
10:10:14dom96The 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:35fowli would never be able to decide on something in time to start coding it
10:21:57dom96hrm, I think i'll be fine without input.nim to be honest.
10:34:31fowlword
10:34:39fowlg'night
11:00:11dom96good night fowl
12:36:31*Trix[a]r_za is now known as Trixar_za
12:37:15Trixar_zadom96: When's the Ludum Dare?
12:37:25dom96It started already
12:37:35Trixar_zaEr, crap?
12:37:46dom96Are you competing heh?
12:37:57Trixar_zahttp://eris.oppresses.us/tmp/idontremember.jpg
12:37:59dom96As of right now all I have is a window which displays the FPS :P
12:38:00Trixar_zaI wanted to
12:39:25dom96you still should
12:39:27dom96Theme is evolution
12:41:09Trixar_zaI've been looking for the one game for years. Could never remember it's name
12:42:09Trixar_zaBut 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:50Trixar_zaThat was my first experience of a teachable AI
12:42:54Trixar_zaeven if it was simplistic
12:43:03Trixar_zaI wonder how hard it would be to write a cheap ass version of that
13:00:11dom96I have an idea, but it seems overfly complex as always
13:00:44dom96*ovely
13:00:47dom96*overly
13:13:36Trixar_zaIt's evolution right? So it can be anything
13:13:41Trixar_zaLike Conway's Life
13:13:46dom96It can't be anything.
13:14:02dom96best that it has some sort of connection to 'evolution'
13:14:16dom96of course that could just be evolving your character by buying upgrades or whatever
13:14:16Trixar_zaI meant in the form of one thing evolving to another
13:14:32dom96It seems most people are thinking of cells
13:14:46dom96And are making some sort of bacteria fighter game
13:15:06Trixar_zahttp://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
13:15:11Trixar_za:P
13:15:29Trixar_zaI'm always fascinated by them
13:15:55Trixar_zaThe only real 'good' use for math imho
13:16:19dom96Trixar_za: Are you competing then?
13:16:31Trixar_zaI'll try
13:16:42Trixar_zaI always wanted to write my own copy of Conway's Game of Life
13:17:16dom96What language will you use? :P
13:17:53Trixar_zaI'll try Nimrod, but I'll probably fall back to Python :P
13:18:50dom96Don't you dare fall back :P
13:25:38dom96Araq: Did you fix Ctrl + /?
13:25:47dom96or is it still broken in Aporia?
13:26:10Araqstill broken, but I don't mind
13:26:21AraqI always use 'when false' + indentation anyway
13:27:29dom96Araq: With Ctrl + / you can select the code you want to comment and it will comment out multiple lines for you.
13:27:36dom96(Using discard """ however)
13:27:48AraqI know, there is also a button for it
13:27:52Araqso I tried that :P
13:29:03dom96I see
13:31:01Trixar_zaDamn you dom96
13:31:08Trixar_zaNow you got me reading about Alife sims
13:31:21dom96hrm?
13:32:39Trixar_zaMost of them are based off Core Wars or a mix of Conway's Game of Life and Core wars
13:37:33Araqugh
13:38:26AraqI hate it when I make some feature cleaner only to discover that the old solution was easier and worked better
13:48:48ccssnetAraq: true, rarely happens to me though
13:49:02ccssnetprobably because i do functional programming
14:07:39*Trixar_za is now known as Trix[a]r_za
15:12:34dom96argh
15:12:41dom96I think I'm going to give up.
15:13:21fowlhttp://www.youtube.com/watch?v=PW3RqGgEkHs
15:13:27fowlwhys that
15:13:58dom96Every idea I have feels like too much work :P
15:25:37fowlhrm 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:59dom96fowl: I'm curious how your game looks like, can you provide a screenshot?
15:28:18dom96fowl: Nimrod has a marshal module
15:28:25dom96I'm not sure if that's what you're looking for.
15:28:34dom96It actually uses JSON as the serialization format
15:29:35fowldom96: http://minus.com/lytlUi08DbGft still have debug texts drawing and not much going on yet :p
15:29:54dom96lol
15:29:54fowlthe lobby: http://minus.com/lPfr1Dd5YTdv5
15:29:56dom96'poo'
15:30:17dom96looks pretty cool
16:13:44Araqso, dom96, how's progress?
16:13:55dom96I gave up
16:14:05Araq:'-(
16:15:21dom96The 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:01dom96Araq: So why doesn't Ctrl + / work for you?
16:20:19Araqbecause keys never work in gtk
16:20:31Araqthey always work for you and not for me
16:22:22fowlworks for me :)
16:22:58dom96Araq: I bet your WM messes with it.
16:23:09Araqdon't worry about it
16:23:19Araqas I said, I don't care about that feature anyway
16:23:31dom96Yes, but it might not work for others.
16:28:57*shevy2 joined #nimrod
16:30:01fowlHey I thought there was a clear(seq[T]) function
16:30:03fowlwas i high
16:31:38dom96Just assign @[] to it?
16:39:11*q66 quit (Quit: Quit)
16:40:19fowldom96: http://www.youtube.com/watch?v=wXzg0D-cKds :)
16:42:00dom96lol wtf
16:43:53*q66 joined #nimrod
16:49:58Araqfowl: use setlen(x, 0)
17:03:51fowlwhat do you think about this https://gist.github.com/3467925
17:09:19Araqfowl: well?
17:09:39AraqI fail to see your point; still a bug in stringstream?
17:10:23fowlyea
17:11:49Araqdo you use the fixed system.clamp?
17:12:39fowli didnt see a difference in it?
17:12:46AraqI fixed it :P
17:13:03Araqthe < and > were the other way round
17:13:10fowlah
17:13:19fowli think it should be <= and >=
17:13:29Araqwhy?
17:14:07fowl<= and >= handle more edge cases
17:14:37Araqif x < a: return a
17:14:41Araqseems reasonable
17:14:50fowlin 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:32fowlbut i assume its like min(a, max(b, x)) its a bit different
17:15:43Araqhrm I dunno
17:15:53Araqmaybe you're right
17:16:20Araqif b < a then the range is empty and 'a' should be returned ... perhaps
17:17:15Araqclamp(x, low(s), high(s)) should return -1 aka high(s) if 's' is empty
17:17:25fowlmight as well use min(max()) it does everything that logic does
17:17:49Araqno, min(max()) is a cludge
17:18:06Araqyou want to enforce it's in the interval [a,b]
17:18:25Araqbtw I always get min and max wrong :P
17:19:15Araq'clamp' fits much more what I have in mind
17:21:01fowlthen 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:06Araqyou can either write to a stringstream or read from it
17:23:04Araqif you set the position it'd better be a valid position in the written string
17:24:10Araqss.data.setlen 0 # plays with the internals
17:24:31Araqmaybe 'pos' should be exported too so that you can do whatever you like with it?
17:24:42fowli do that in my flush implementation
17:26:09Araqjust fix it and make a pull request
17:26:21Araqextra points if the docs are improved too :P
17:27:27*shevy2 is now known as shevy
17:28:41Araqargh, I wish Zahary was here
17:29:05fowlAraq: here's a better example of it being weird; https://gist.github.com/3467925#file_test2.nim
17:29:18Araqmy problem is easy to fix if only I would knew what the spec should look like ... :-/
17:30:08Araqfowl: as I said, you read and write from the stream that's why it doesn't make sense
17:30:21Araqit works if you only read or only write
17:30:49Araqas I said, improve it and make a pull request, I've better things to work out :P
17:31:02fowlAraq: o_O streams are ok to read and write from im showing the setposition weirdness
17:31:06fowllol
17:31:08fowlok
17:45:00Araqfowl: I thought setPosition only makes sense for reading :P
17:56:29fowlwell yes it doesnt make sense to do that.. but i use setposition() in my flush function
20:52:52Araqping Boscop
20:53:25Boscoppong Araq
20:53:43AraqI'm thinking about symbol binding rules again
20:53:47Boscopah
20:54:21Araqand I figured that the compiler could easily do a partial type checking
20:54:44Araqso if we have a generic type T and an == that is concerned with T
20:55:22Araqit's an "open" symbol which means it will be bound at instantiation
20:55:43Araqand other occurances of == can be bound early
20:56:56Araqin fact, the compiler performs that partial type checking already for IDE support ...
20:58:53AraqI wonder why no programming language does it this way?
20:59:23Araqwhat am I missing?
21:10:31AraqBoscop: well? understood my idea?
21:11:04Boscopyou mean == is a generic operator with type variable T?
21:12:47Araqno, == is overloaded for lots of types
21:13:16Araqbut if we have current.key == key in a generic
21:13:43Araqthis == should be "open", so that later definitions of == are considered in the instantiation process
21:14:14Boscoptemplate overloading?
21:14:56Araqwell in C++ terminology I'm talking about symbol binding rules in a template, yes
21:15:23BoscopD has template overloading
21:16:25Araqso D does it the way I'm proposing?
21:17:34Boscopwhich symbols would be bound early in your idea, and what do you mean by "and other occurances of == can be bound early"?
21:18:02Araqhttps://github.com/Araq/Nimrod/blob/master/lib/pure/collections/sets.nim
21:18:16Araqtake a look at line 67
21:18:26Araqproc RawGet[A](s: TSet[A], key: A): int =
21:18:27Araq rawGetImpl()
21:18:48Araqwhich refers to line 52, unfortunately
21:18:54Araqso don't get distracted
21:19:08Araqline 55: if s.data[h].key == key and s.data[h].slot == seFilled:
21:19:46Araqthe key comparison is an "open" occurance of ==
21:20:00Boscopso the == should be instantiated with A from RawGet?
21:20:12Araqyes
21:20:15Boscopah
21:21:17Araqbut 's.data[h].slot == seFilled' can be bound at definition time of the generic
21:21:21Boscopyeah, you can have mixin templates which are typechecked at instantiation time and place
21:21:46Araqyes well nimrod currently does it only at instantiation time
21:21:48Boscopthat code would have to be treated symbolically
21:22:07Araqand I want it to be partially done at definition time
21:22:12Boscopah
21:22:22Boscopso you could propagate the type variable A
21:22:30Araqexactly
21:22:34Boscopmake rawGetImpl dependent on A
21:22:56Araqtrue, but just assume rawGetImpl() doesn't exist
21:23:04Boscopand then have the constraint (e.g. with type classes or similar) that == is defined for A
21:23:05Araqand RawGet has the body
21:23:33Araqthat's true but I don't want that constraint to be explicitly written down
21:23:43Araqbecause it's redundant
21:23:56Araqand can get annoying
21:24:18Araqin this example, it would make the code clearer, I agree
21:24:44Boscopif 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:01Boscopnot to mention hard to read error messages
21:25:23Boscopof course you don't have to write the constraint down if the compiler can infer it
21:25:49Boscopbut then the template has to know which types are variables
21:26:02Araqwell yes, but I wonder why C++ doesn't do that partial type checking I'm talking about
21:26:03Boscopso it has to have a type variable where A will be plugged in
21:26:26Boscopbecause of template specialization
21:26:34Boscopit has to instantiate before it knows the body
21:26:45Boscopand it can`t infer constraints
21:27:36Boscopso it has to typecheck the body on each instantiation
21:27:48Boscopwhich is one reason for its slow compile-times
21:28:18Araqyeah, yeah, well I'm repeating C++'s mistakes and am aware of it ;-)
21:29:06Boscopyeah, I wouldn't do it the c++ way
21:29:33BoscopI would infer constraints, but for that the variable types in a template need to be known
21:29:55Araqthe variable types in a template are known in nimrod
21:30:09Boscopbecause that's what the binding of the operators etc depends on
21:30:09Araqunless I'm missing something :-)
21:30:26Araqtrue
21:30:40Boscophm, but in rawGetImpl the A is not known, but you want == to be chosen for the A in the caller scope
21:31:05Araqyou got distracted by the rawGetImpl ;-)
21:31:23Boscopisn`t that what you want to be able to partially typecheck?
21:31:38Araqignore that, just think its body is directly in RawGet[A] ...
21:32:08Araq(templates are resolved at definition time in generics already)
21:32:10Boscopok, and what do you want to partially typecheck?
21:32:34Araqs.data[h].key == key # infer == for A
21:32:54Araqbut I don't call it inferring because that's not what the compiler does ;-)
21:33:14Araqinstead it would fail type checking and so the '==' would be marked as an "unbound" symbol
21:33:33Araqand bound at instantiation time
21:34:11Araqso yeah the generic would be checked at instantiation time like in C++
21:34:22Boscopso when RawGet is instantiated, all overloads of == in the instantiation scope are considered to choose the one for the A?
21:34:36Araqyes exactly
21:34:59Boscopand what is the problem?
21:35:14Araqwell no problem for now
21:35:22Araqbut I wonder why C++ doesn't do it this way
21:35:31Araqand if there is any PL that works this way
21:37:09AraqI'm not really trying to solve the implicit constraints problem
21:37:09Boscopc++'s lookup rules are pretty complicated
21:37:30AraqI'm trying to come up with symbol binding rules that are "natural"
21:38:28Boscopoften there is no one true way
21:38:55Boscoplanguage design is also experimentation to some degree
21:39:03AraqI know :-)
21:39:12Araqit helps to have production code around :D
21:39:30Araqand see how the rules would do for that
21:39:35Boscopone 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:53Araqwell that's another point
21:39:59Boscopso that custom definitions can override the ones at definition scope
21:40:00Araqand in fact Nimrod does that
21:40:06Boscopah
21:40:31Araqthe problem is when you have helpers which are private
21:40:48Araqyou don't want client code to accidently override them
21:41:11Araqyou can do that currently in nimrod with a "bind" statement, but that's the wrong default
21:41:32Araqdefault should be "bind", and 'open' symbols should be marked explicitely
21:41:48Araqwhich however is too ugly in practice
21:42:03Araqso I implemented the wrong solution :-)
21:43:09Araqand 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:16Araq*a set of rules
21:43:16Boscopor you do it with implicit args, or explicit args, e.g. the == would be passed as arg to the template
21:43:34Boscopand it has a default value, the == at definition scope
21:43:45Araqyeah but that gets verbose too
21:43:50Boscopyeah
21:44:37Boscopanother solution to preventing overrides would be local definitions
21:44:48Boscopso that they shadow outer ones
21:44:58Araqthat's my "bind" statement
21:45:06Araqproc p[T] ...
21:45:12Boscopand you can use an import statement or 'using' to pull in something into the local scope
21:45:14Araq bind myHelper, myHelper2
21:45:19Boscopah
21:45:37Araqbut as I said, it's the wrong default ;-)
21:46:32Araqbut thinking about it, my new idea doesn't work
21:46:39Boscopwhy?
21:46:42Araqproc p[T](x: T) =
21:46:56Araq helper(x) # I want this to be bound early
21:47:19Araqbut 'x' is of type T, so will remain "open"
21:47:30Araqthe compiler cannot tell the difference between:
21:47:32Araqx == y
21:47:34Araqand
21:47:36Araqhelper(x)
21:49:22Araqok, it can with an even more complicated set of rules
21:49:37Araqbut ugh
21:49:44Boscopthe set of overloads to be considered can be different for each symbol occurring in the template body
21:50:13Boscopso you do 'bind helper;" but don't bind ==
21:51:00Araqwell sure and 'bind' works this way today already in Nimrod :-)
21:51:33Boscopso why doesn't your idea work then?
21:51:52Araqmy idea was to come up with more complex rules and get rid of the 'bind'
21:52:15Araqbut now I got it that the rules are not as simple as I imagined
21:52:47Araqit doesn't suffice to re-use my IDE features to solve that problem :D
21:53:39Araqnow back to C++:
21:53:59AraqI'm not sure that checking only at instantiation time is really that much of a problem
21:54:19Araqit's a natural solution if you want compile time "duck typing"
21:55:17Araqand if you're gonna monomorphize generics
21:55:20Boscopbut you get slow compile-times and unreadable errors
21:55:46Araqslow compile-times are also related to its non existing module concept
21:56:10Araqand the unreadable errors are due to the complex implementations
21:56:28Araqthe STL for instance seems to be much more complex than it needs to be
21:56:44Araqbut it has to 'struct' everything for better type checking
21:57:06Araqand C++ has a very weak type system
21:57:15Boscopyeah
21:57:19Araqwith conversions between int and bool, etc.
21:57:50Araqso I hope these problems won't be as severe for Nimrod as they are for C++
21:59:02Boscopyeah, 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:32Araqand a bad compiler error message is still better than any runtime error message IMHO
22:00:15Boscopyeah
22:01:20Araqbtw you can have this in Nimrod:
22:01:41Araqproc `==` (a, b: myType, someFlag: bool = false)
22:02:10Araqand then the `==` should match a constraint that doesn't consider default parameters
22:02:54Araqthis constraint stuff needs to be permissive IMO
22:03:03Boscophow do you call binary operators with more than two operands in nimrod?
22:03:17Araqprefix style then:
22:03:24Araq`==`(2,3, true)
22:03:54Araqyou can still use the infix style if the default fits
22:04:07Boscopok
22:06:47Araqwhen 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:56Boscopbut do you have some constraints for the template arguments, like concepts or type classes?
22:14:20Araqthere is:
22:14:34Araqproc p[T: array|seq|object](x: T)
22:14:47Araqfor now and a 'compiles' magic that you can use
22:15:03Araqwhich is like D's is(typeof(X)) crap
22:15:22Araqbut readable ;-)
22:15:38Araq when not compiles(x + y):
22:15:52Araq {.error: "generic needs to support the + operator.}
22:20:33BoscopD also has __traits(compiles,expr)