<<06-06-2012>>

08:14:20*Araq_ joined #nimrod
08:16:53*Araq_ quit (Client Quit)
10:19:34*apriori_ joined #nimrod
11:58:03*Araq_ joined #nimrod
13:47:13*Araq_ quit (Read error: Connection reset by peer)
13:47:40*Araq_ joined #nimrod
14:14:10*Boscop quit (Quit: OutOfTimeException: Allocation of TimeFrame failed due to lack of time. Free up time by cancelling unimportant events.)
14:21:14*Boscop joined #nimrod
16:14:09Araqer what? why do we need "default destructors"?
16:26:08Araqping zahary
16:26:15Araqhttps://github.com/nimrod-code/nimforum/blob/master/captchas.nim
16:33:40Araqthe compiler now calls the 'destroy' procs implicitely ... causing a bug
16:46:09zaharya default constructor is destructor for a type that has fields with destructors
16:46:34zahary.. and the user didn't provide his own destructor
16:48:01zaharywell, about the capchas bug - either don't call the destructors manually (producing shorted code) or if these are not supposed to be destructors their names should be changed
16:48:53zaharythe first message should read: * a default destructor *
16:49:14Araqwell sure but if it breaks our own code ...
16:49:28AraqI think we should require a 'destructor' pragma
16:49:46Araqand not be done implicitely just because it's named 'destroy' ...
16:50:44Araqand apart from that you broke nimbuild ;-)
16:50:55Araqsemstmts.nim(982) insertDestructors
16:50:56Araqsemstmts.nim(931) instantiateDestructor
16:50:58Araqsemstmts.nim(898) generateDestructor
16:50:59AraqSIGSEGV: Illegal storage access. (Attempt to read from nil?)
16:53:43zaharywell, we've discussed this - pragma vs destroy - and we decided to use destroy, remember?
16:53:50TasserAraq, and now? he's gotta wear the buildbreaker cap? ^^
16:54:46zaharyI think we should fix the few places where destroy is used now and optimize for long-term convenience for all users in the future
16:55:02zaharyI'll look into nimbuild
16:55:57Araqzahary: I do remember
16:57:27Araqbut I changed my mind
16:58:11Araqbecause these are exactly the changes that not only break code
16:58:16Araqbut do so *quietly*
16:58:32dom96wow. That is so weird. Windows only managed to bootstrap successfully.
16:58:38Araqin fact, we wondered for a few minutes what's wrong with the code now ...
16:58:56Araqand I first blamed an update of the cairo library
16:59:32Araqwe need a transition state for the 'destroy' feature
17:00:50Araqthe compiler quietly inserts *calls* now into old working code; that's not good
17:01:32Araqat least it should produce a 'warning: implicit destructor call inserted' message
17:02:19Araqand this warning can be turned on and off and later versions will turn it off per default
17:03:15dom96Tasser: heh. Maybe NimBot should publicly embarrass people that break builds :D
17:03:47dom96Araq: Warnings are so easy to ignore though...
17:04:10dom96If this was a warning I know I would definitely not notice it.
17:04:39zaharyI'll se what I can do. make up your mind whether it should be a pragma, warning or something else
17:05:15Araqwell the warning message is useful in any case (where are calls silently inserted?)
17:05:30Araqbut dom96 has a good point, so I'd prefer a pragma
17:14:37Araqand thinking about it, these things are always done with pragmas in nimrod; it feels inconsistent not to use one here
17:16:39zaharyto me, it sounds like just another thing people will complain about
17:19:29Araqpeople always complain about everything anyway
17:21:38dom96Maybe it would be better to come up with something more unique?
17:22:02Araqpragma for now, keyword 'destructor' perhaps later
17:22:06dom96But meh, I'm fine with a pragma.
17:22:33Araqthe spec says pragmas are also used for experimental features, so ...
17:23:26dom96How do destructors work in other languages?
17:23:42Araq~Classname
17:24:04Araqin fact, we could do the same:
17:24:16Araqproc `~destroy` ...
17:25:37dom96That's nicer than a pragma I think
17:26:44Araqperhaps but it conflicts with the planned "term rewriting" features
17:27:25Araqwell that would be proc {~destroy} ... instead but the difference could become confusing
17:49:51zaharydoh, another error
17:54:53Araqwe have an "internalAssert" now? :-)
17:59:28Araqsee you later
17:59:29zaharyhaven't you seen it before? I use it instead of your InternalError("fooBar 12")
17:59:43zaharyit prints the line in the code where the error happened instead
17:59:45AraqI think I did
18:02:32*apriori_ quit (Quit: Konversation terminated!)
18:03:18Araqfyi lambda lifting is hard and will take until next week at least :-/
18:03:53Araqat least I got all the details of the algorithm in place now
18:04:01Araqhave to go, see you later
18:04:56zaharywell, I was about to ask you once what will happen if some variable is captured by 2 closures?
22:09:04*ponce quit (Remote host closed the connection)
22:09:16*_ponce joined #nimrod
23:02:03*Araq__ joined #nimrod
23:03:18*Araq_ quit (Ping timeout: 244 seconds)
23:08:31Araqzahary: closure will respect lexical scoping so there are 'up' pointers involved in this case
23:08:59Araqso access will look something like closure.up.capturedVar
23:09:19Araqand from some other scope closure.capturedVar
23:11:30zaharywhere is capturedVar stored?
23:12:14Araqer, in the closure?
23:12:44zaharyin which one? my question is what happens when 2 closures in the same scope capture the same var
23:14:36Araqthat's what I meant: in the outer closure it is stored and the inner closure has an 'up' pointer to alias it
23:16:18zaharyhmm, I'm still not sure we are giving the same meaning for "outer"
23:16:18zaharyhere is my example
23:16:18zaharyvar x = 10
23:16:18zaharybtn1.click do:
23:16:19zahary x = 20
23:16:19zaharybtn2.click do:
23:16:20zahary x = 30
23:16:20zaharybtn3.click do:
23:16:21zahary echo x
23:17:06Araqprints 30
23:17:13Araq(if executed in order)
23:17:41Araq'x' is captured by reference
23:18:19zaharythe first closure keeps x
23:18:19zaharythe second closure keeps a pointer to the first closure in a field called "up"?
23:18:19zaharythere can be multiple such fields if variables from other closure were captured too?
23:20:14Araqin your example there is no nesting, so each callback gets the same closure
23:20:29Araqno "up" involved here
23:21:40zaharyok, it's easy to see what I mean - make the sets of captured vars overlapping, but not subsets of each other
23:22:26zaharyvar x = 10
23:22:26zaharyvar y = 100
23:22:26zaharyvar z = 1000
23:22:26zaharybtn1.click do:
23:22:26zahary   x = 20
23:22:26zahary y = 25
23:22:27zaharybtn2.click do:
23:22:27zahary   x = 30
23:22:28zahary z = 40
23:22:28zaharybtn3.click do:
23:22:29zahary   echo x
23:22:29zahary echo z
23:23:03Araqit's a "union" closure then, doesn't hurt to pass 'z' to btn1.click
23:26:51zaharyso you get 1 closure per scope?
23:26:51zaharyand I can use blocks to get a finer grained separate objects?
23:27:05Araqthat's the plan, yes
23:27:29Araqyou can also use '.bycopy.' to capture a local by copy
23:28:59AraqError: internal error: (filename: compiler/semstmts.nim, line: 903)
23:29:15Araqyour new compiler doesn't compile the tester :P
23:29:50zaharyI've fixed it locally. I'll push a bit later (still need to add the destructor pragma)
23:29:59Araqalright great
23:30:37Araqbtw feel free to make TSym 4 bytes bigger (aka introduce new flags properly)
23:30:53Araqthe flag name aliasing is starting to get messy :-)
23:31:09zaharyalright :)
23:32:06Araqlooking at it, it's aligned on a 8 byte boundary for 64 bit anyway
23:32:29Araqso it shouldn't affect TSym's size at all for 64bit
23:33:27zaharyif a flag check spans the 2 words the cost will be a bit greater, right (in ifs and the like)?
23:34:05Araqfor 64bit machines no, for 32bit I dunno
23:34:50Araqin fact, I don't know what the compiler does, I think it uses int64 even on 32bit platforms so it's up to the C compiler
23:36:10zaharybtw, what are the genericAssign bugs mentioned in the todo?
23:36:29Araqthey should be fixed by now
23:37:16Araqwas about assignment of 'case objects' where the assignment changes the branch
23:37:19zaharyI've just implemented destructors for case objects and considered doing something similar for genericAssign (exact code without RTTI)
23:37:58zaharyaha, you must first reset the old value ...
23:38:09Araqyeah that's what my fix does
23:38:56Araqso how come that C++'s inheritance breaks my alignment assumptions?
23:39:11Araqthat was the memory corruption you encountered, right?
23:39:26zaharynah, it wasn't this problem.
23:40:12Araqugh, what it the problem then?
23:41:38zaharyit was the setFrame call I asked about - it was in the wrong place in the Cpp proc
23:44:01Araqah I see
23:45:22zaharyI chased the sequences for a while, because this was my only change and the usage of the code was very near the crash point