<<20-11-2012>>

00:30:43*q66 quit (Quit: Quit)
00:34:16zaharyAraq, what's the purpose of getUniqueType in the backend? can you give me an example of types that needs to be canonicalized to the same type?
04:45:59fowlhrm i cant do {.pragma: SF, importcpp.} =(
07:37:15*XAMPP quit (Read error: Connection reset by peer)
09:25:53Araqzahary: tuples come to mind and I think also generic objects are kind of structural in nimrod
09:34:31fowlim continuing work on sfml c++ wrapper, im attempting to sidestep inheritance with (A or B or C) types
09:34:49Araqhi fowl that's nice
09:34:59fowlits working well so far
09:35:05Araqdunno what (A or B or C) types are ;-)
09:35:15Araqsum types?
09:35:17fowlhttps://gist.github.com/4116737
09:35:20fowlsee TDrawable
09:36:04fowlline 24
09:37:38AraqI prefer | instead of 'or' here
09:37:59Araqfunny that it works :P
09:38:19AraqI mean you're creating an implicit generic with it and importcpp it
09:38:36Araqbut hey, if it works it's fine
09:38:46fowlyea
09:39:35fowlsfml.cpp has like no code in it
09:39:39fowl25 lines
09:40:02Araqit's all lazy :P
09:40:25fowlI was wondering how to call C++ destructor?
09:40:50Araqimport it "Class::~destructor" ?
09:41:08fowldont you call `delete` though in cpp
09:41:45Araqgood point; if you generate C++ and it relies on the C++ header the C++ will invoke the destructor for you
09:42:29Araqimplicitly
09:42:34Araqas it's C++ code ...
09:42:56fowlbut how do i call it from nimrod
09:43:57Araqhack around with .emit ...
09:44:11Araqyou're right it's hard thanks to C++'s delete syntax
09:44:53fowli was thinking like proc destroy*[A](some: var A) = {.emit "delete `some`".}
09:45:21Araqthat could work
09:46:38fowl*** glibc detected *** /home/fowl/projects/newsfml/sftest: double free or corruption (!prev): 0x00000000026ac3a0 ***
09:46:41fowlit works :D
09:46:58fowlthats cuz i put it in a loop to make sure it crashed
09:47:12Araqyeah I figured
11:30:46fowlis there a conditional i can check for cpp/c
11:32:49fowli want to throw {.error.} if someone tries to use sfml with c instead of getting a bunch of errors like unknown typename 'namespace'
11:40:53AraqI'm not sure I think it's 'when defined(cpp)'
11:44:03fowlah perfect :D ty
12:56:34*q66 joined #nimrod
14:24:00*XAMPP joined #nimrod
15:23:17*apriori| joined #nimrod
15:25:01*apriori| is now known as |apriori|
15:35:19Araqhi |apriori|
15:35:25|apriori|hi Araq
15:36:09Araqin case you didn't notice: we're getting C#-like async support :-)
15:36:41|apriori|Araq: hm, I don't even know what that is :/
15:36:42|apriori|looking up
15:37:53|apriori|ah
15:37:54|apriori|nice :)
15:43:23Araqit's also a pretty cool collaborative tasking system ;-)
15:50:35zaharyAraq, my question yesterday about getUniqueType was because I got caas to the point where it can recompile nimrod, but right now we've got around 100MB of logical memory leaks on each compilation so I'm investigating the purpose of all global caches
15:51:30Araqawesome :D
15:51:58zaharythe caches for generics, methods and ropes are easy to understand, but getUniqueType is more puzzling
15:52:29zaharywhat kind of properties must it preserve between two compilations? I see that the type info is somewhat affected by it
15:52:55Araqit doesn't need to preserve anything afaik
15:52:56zaharye.g. on assignments, you want the ID tag of the object to be that of the unique type
15:53:13Araqotherwise rodfiles would serialize the cache somehow
15:53:57Araqwell ... do you want caas to work with C code generation?
15:54:04zaharyit doesn't need to preserve, because it will be rebuilt or it just doesn't store sensitive data?
15:54:30Araqanswer my question first :P
15:54:43zaharywhat do you mean?
15:54:50|apriori|Araq: I just talked with my professor about the nimrod OS stuff
15:55:05|apriori|Araq: he would like to see it released under apache license
15:55:20zaharyI cache the results of sem (the complete PContext) and I cache the parts of the BModule that would have been read from the C source
15:55:46zaharythen, if merge is required I reuse the old merging code for rodfiles
16:01:42Araq|apriori|: that sounds good
16:02:14Araqwhy do you cache the PContext? that sounds wrong ...
16:02:46Araqmy idea was that we already "cache" the module's PSym
16:02:58Araqand that contains the interface and thus everything of interest
16:03:15zaharywhat's wrong about it? if the module doesn't change and another module tries to import it, I just give them the cached Module
16:03:46AraqPContext is supposed to be scratch data for while processing a module
16:04:16Araqyou either cache a whole module or you recompile a module
16:04:35Araqit doesn't make sense to keep the interim data structure
16:04:57zaharyI'll review and revisit everything when the system is stable enough - right now I often need more per-module data in order to be able to properly "unload" some module before it's recompiled
16:06:14zaharygCompiledModules: seq[PSym] = @[]
16:06:18zaharyI and lied actually :)
16:06:21zaharyI don't cache the context
16:07:31zaharyso, back to getUniqueType. it doesn't need to preserve, because it will be rebuilt or it just doesn't store sensitive data?
16:09:34AraqI'm still thinking about it :-)
16:09:55zaharyit's massive hit for var types (the cache)
16:09:58Araqit doesn't matter if you use 'caas' for intellisense
16:10:23Araqobviously but I'm not of the consequences if you want codegen to work
16:10:28Araq*not sure
16:10:29zaharyI want the full incremental builds experience
16:11:09Araqbtw don't push your changes
16:11:16zaharysure
16:11:25Araqnimbuild will have branch support very soon :D
16:12:44zaharybtw if the data in the getUniqueType cache is sensitive, it really should affect rodfiles too, because slight changes in the order of compilation can lead to different canonicalizations
16:14:29Araqtrue
16:14:44zaharycan you explain what's important for type IDs, when it comes to canonicalization?
16:15:43zaharytypes like var T and array[ref T] can be assigned IDs that must match in all modules?
16:16:20Araqno 'var T' and 'array' are boring as they are pointers in C which use structural typing
16:16:39zaharyso it's really only about tuples in the end?
16:16:41Araqit's only important for things that become a 'struct' in C
16:16:55zaharybecause named types are nominal anyway
16:16:59Araqclosures for instance are affected too
16:17:36Araqother proc types are not
16:17:44zaharywhat about the GC? doesn't it use these IDs somehow?
16:18:00Araqno it doesn't
16:18:13Araqfor RTTI in the worst case we get duplicate entries
16:18:32Araqbut RTTI doesn't use pointer equivalence
16:18:43Araqexcept for the "of" operator
16:19:05Araqbut "of" deals with classes anyway which use nominal typing
16:19:24Araqit should be buggy for DLLs though :-/
16:22:33*|apriori| quit (Ping timeout: 244 seconds)
16:23:32Araqin general the getUniqueType prevents wrong C code for everything "struct" related and optimizes/merges RTTI
16:28:46Araqhowever if you ensure that the type gets the same ID as it used to the gTypeTable caching should work, right?
16:29:07zaharyalright, normalizing tuples is similar to normalizing generic types so I'll get that part easily
16:29:15Araqcan't see how this cache causes the leak
16:30:03zaharythe leaks are easily explained. after all all types link to their module, which links to all public procs, which links ...
16:30:19Araqand yeah invalidating modules by deleting them from gCompiledModules was my idea too
16:30:36zaharyI have quite a lot of work to do yet for dealing with the caches. I wanted to understand them first well
16:30:56Araqer ... 'main.compMods' is it
16:31:14Araqno need to introduce another sequence for them
16:31:22zaharyI must have renamed that
16:32:38Araqthere is also rodread.gMods
16:32:45zaharyI know
16:33:03Araqbut it's irrelevant since you don't use rodfiles, right?
16:33:09zaharyright
16:33:23zaharybut I'll merge some of the crc checking algorithms
16:33:33zaharyright now, I'm duplicating a bit of that
16:34:00Araqwhy is that necessary?
16:34:13zaharycrc checking or the duplication?
16:34:19Araqthe editor should tell nimrod what to invalidate
16:34:25Araq(the crc checking)
16:36:18zaharyI plan to support dirty buffers and even syncing of buffer contents (vim and some other editors support a special protocol for that), but right now I need to test so I need crc (doesn't hurt to have it too)
16:41:08AraqI see
16:48:42Araqwhat's up with #254 btw? can we easily support that?
16:51:04zaharyprobably something is sigmatch, the default argument is not the last one
16:52:09Araqyeah I know
16:52:22Araqthe question was if it can be supported easily
16:52:43Araqdon't remember the nkDo transformation :P
16:52:57zaharytheoretically, param matching is like regular expression matching. you can easily have param?
16:53:41zaharyI think nkDo doesn't affect that
16:54:05zaharycan you have proc foo(x: int, y = 10, z: int) right now?
16:54:18Araqyeah but you need named params to call it
16:54:31Araqfoo(x=2, z=3)
16:58:36Araqand using a non-deterministic algorithm for param matching is insane :P
16:58:53Araqtoo slow :P
16:59:08Araqespecially since nimrod uses full overloading resolution everywhere ...
16:59:46zaharyI said "theoretically" :)
17:03:24Araqso ... I'm thinking about 'shared ref'
17:04:09Araqas I said GC support could use boehm but it looks easy to do with the current GC too
17:04:50zaharywhat's the plan?
17:05:17zaharywhat's out there as algorithms? is there an incremental concurrent collector?
17:05:28Araqyes
17:05:47Araqin fact the current GC has been based on a paper about such a beast
17:06:10Araqbut for version 1 I will go for something easier ;-)
17:06:52Araqthe basics we need are the same anyway
17:07:01Araqwe need a stop the world mechanism
17:07:12Araqwhich we can put into 'new(x: var shared ref T)'
17:07:48Araqand then people can insert the barrier explicitly in some loop; I don't really like the compiler doing it behind the backs
17:08:13zaharywhat does boehm do? it uses set_context tricks to cheat the other threads into running a collect cycle?
17:08:30Araqit uses signals magic to stop threads
17:09:09zahary… but doesn't use multi-threaded collection?
17:09:09Araqbut as I said, one new idea is to implement '--gc:mixed' and use boehm for the shared heap
17:09:21Araqit uses parallel marking
17:09:44zaharyso it, must force the other threads to start executing the marking code?
17:09:56zaharythat's what I meant - it replaces their current context?
17:10:01Araqno it stops all mutator threads
17:10:04Araqand then collects
17:10:15Araqbut uses parallelism within its collection
17:10:16zaharyaha, I see
17:10:47Araqwell that's how I would implement it, I think boehm does it the same way ;-)
17:11:01zaharylook at their code
17:11:07*FreeArtMan joined #nimrod
17:12:55Araqnah the code is ugly
17:13:23zaharyI've looked it when we chased the interior pointer problems
17:13:43zaharyit was relatively easy to follow
17:14:29Araqnot for me
17:14:40*fowl quit (Quit: Leaving)
17:14:46Araqthe data structure that turns into a hash table for 64bit was ... meh
17:15:17Araqbut anyway
17:15:31Araqfor 'shared ref' we need an even more expensive write barrier
17:15:49Araqit's essentially the same write barrier as today but it requires atomic inc/dec
17:15:56zaharyyes
17:16:56zaharybtw, a very long term question. do you think we should make strings and sequences automatic types at some point?
17:16:56zaharyI'm interested in writing old-school threading code without paying the GC price for nimrod threads .
17:17:59Araqautomatic types == STL like with destructors?
17:18:07zaharyyes
17:18:16zaharyand generally, it would be possible to create a bit more complicated programs without bringing the GC
17:18:30Araqshould definitely become a compile-time option yes
17:18:36zaharyok, coolk
17:18:48Araqand was one reason I chose value semantics for them :-)
17:19:28Araqthough allowing 'nil' for them is a bit awkward then
17:19:44Araqbut we'll get rid of that too
17:19:58zaharyyeah, you did good there
17:21:15*fowl joined #nimrod
17:37:09Araqso ... 'shared' a keyword or a pragma for a start?
17:41:40zaharyI don't really care
17:41:58zaharyit's fine both ways
17:46:29AraqI'll go with the keyword then
17:46:50Araqintroduces new AST nodes but it's too dangerous to be a pragma
17:47:17Araqwe could have shared[ref T] I guess ... hrm ...
17:48:09zaharyXL was cool with its pointer types, but here you may strive for consistency
17:55:28Araqthe more important question is whether it's tyRef + flag or tySharedRef
17:55:48AraqI fear it's the later as RTTI is affected by this decision
17:56:02zaharyyes, makes sense
17:56:02Araqand for RTTI tySharedRef seems preferable
17:56:17zaharyshared ref should bind stronger in overloads too
17:57:08Araqwell I think they should be completely incompatible :-/
17:57:37zaharyis it unsafe to use the shared write barrier on a normal ref? etc
17:57:58Araqyou can pass 'shared ref' to 'ref' but not the other way round
17:58:15zaharyyes, that's what I meant
17:59:18Araqwell hrm no you can't
17:59:25zaharyactually, isn't it the other way around, you can pass a ref to a shared ref proc?
17:59:49zaharyshared ref to ref will be unsafe, because the normal ref write barrier will be used
18:00:06Araqthe write barrier is not only problem
18:00:46Araqx.shared = unshared # but local GC collects 'unshared'
18:01:18Araqx.unshared = shared # requires 2 different marker procs then
18:01:36Araqone for the local GC and another one for the shared GC ...
18:01:36zaharyahm, yes
18:02:25Araqok we need to improve our thread analysis pass then :-)
18:02:36Araqto get back some polymorphism for these pointers
18:02:58AraqI figured my thread analysis is in fact an application of abstract interpretation :D
18:03:23zaharyhaven't looked at it so far
18:04:32Araqyou should ... it's creepy
18:05:02Araqmakes me want to learn coq and prove things ...
18:12:30Araqif we only pick the --gc:mixed solution we can use 'ptr' for Boehm's GC ...
18:13:08zaharythere should be unsafe ptr type. what do you mean?
18:13:44Araqwe have the unsafe ptr type already, it's called 'ptr'
18:13:51Araqwe can do:
18:14:07Araqproc new(x: var shared ref T) # future proof
18:14:14Araqor we can do:
18:14:33Araqproc new(x: var ptr T) # shared pointer; uses Boehm's GC
18:14:46Araqthe later doesn't require changes in the type system
18:15:04Araqbut is not a good long term solution
18:15:25zaharyI'm still not following. new should be overloaded, right?
18:15:44zaharywhy isn't var ptr T the same as T** in C
18:16:27Araqwell we discussed introducing another pointer type, 'shared ref' for a shared GC'ed heap
18:16:42zaharyaha, you are thinking how to avoid that?
18:16:45Araqand it turns out to get complex with no subtyping between 'ref' and 'shared ref'
18:17:10zaharycalling shared T to eliminated the confusion for example
18:17:18zaharycall it *
18:17:46*apriori| joined #nimrod
18:18:14Araqhowever we can also leave 'shared ref' unnamed in the language and misuse 'ptr' for the feature
18:18:31zaharyI dislike that. var ptr T is T** for me
18:18:46Araqwhat has 'var ptr T' to do with that?
18:19:08zaharyproc new(x: var ptr T) irc://irc.freenode.net:6667/# shared pointer; uses Boehm's GC
18:19:15zaharyI'm responding to this message
18:19:16Araqah ok
18:20:44Araqwell ... the more pointer types we get the harder it gets to write generic code
18:21:02zaharygeneric code should be written without ref as I have advocated before
18:21:39Araqtrue and it should be possible to make ptr/ref another param for the generic
18:21:41zaharythe unsureAsgnRef business can be addressed with additional hidden arguments
18:22:00AraqI'd prefer specialization
18:22:02zaharyor direct multiple compilation of the procs
18:22:05Araqyeah
18:28:30Araqbtw you know about the ABA problem in C++, right?
18:29:16zaharywhy do you limit it to C++?
18:30:07zaharythe time-of-check-vs-time-of-… problem?
18:30:32Araqit's not limited to C++, but mitigated by a GC
18:31:01zaharyhmm, why so? it's a algorithmic problem for me
18:31:18zaharyI could write a program that demonstrates it in nimrod
18:33:19Araqwait a sec, I'm looking for the paper
18:33:39zaharyhttp://en.wikipedia.org/wiki/ABA_problem I'm rereading this
18:40:19Araqah yeah, it's this: http://www.research.ibm.com/people/m/michael/RC23089.pdf
18:48:26zaharydo you have to write lock-free code for the thread channels?
18:48:50*FreeArtMan quit (Quit: Out of this 3D)
18:50:11Araqno, but it would make them faster I think
18:51:14zaharysuch features can be optimized after everything else is polished
18:58:40*apriori| quit (Remote host closed the connection)
19:22:18*apriori| joined #nimrod
19:22:47Araqsure
19:54:34Araqhu?
19:54:48Araqthe compiler still uses fastcall ...
19:55:22Araqnot for GNU though ...
19:58:48apriori|http://www.kickstarter.com/projects/2083649206/the-d-programming-language-conference-2013-0 O_o
19:59:51Araqyes I'm aware ;-)
20:02:30apriori|out of curiosity...
20:02:46apriori|is it not possible to push the "discardable" pragma using pragma push for some reason?
20:03:03apriori|so that it will be applied to all following function declarations until "pop"?
20:03:12Araqyou can't push every pragma, only a few selected ones
20:03:24apriori|okay
20:03:34apriori|well, maybe that's ok
20:04:04Araqnah it's a stupid implementation restriction
20:04:28Araqlet me see if I can fix it, fowl moaned about it too
20:04:51apriori|ok
20:34:37Araqzahary join #nimbuild please :D
20:34:58Araqit now notifies when the tester has finished
20:39:52*apriori|| joined #nimrod
20:42:26*apriori| quit (Ping timeout: 244 seconds)
22:14:16*zahary quit (*.net *.split)
22:14:28*zahary joined #nimrod
22:24:34*ccssnet quit (*.net *.split)
22:33:49Araqapriori||: I've implemented this feature
22:33:54Araqdo you want to test it?
22:34:26apriori||Araq: ok, on it
22:34:32apriori||is it in git?
22:34:37Araqwait a sec
22:35:43Araqhrm doesn't work :-/
22:39:59apriori||I need to go to bed now
22:40:01apriori||bye Araq
22:40:02apriori||bye all
22:40:09Araqbye
22:40:12*apriori|| quit (Quit: Konversation terminated!)
22:47:00*ccssnet joined #nimrod