<<12-03-2013>>

00:00:12*rking quit (Read error: Connection reset by peer)
00:01:11reactormonkAraq, found a rather nasty bug - base (for type base) is created as base_ID
00:01:19reactormonkwhere id is the good ol' int
00:02:55reactormonkAraq, grab my repo, boot, run nimrod -d:nodejs -r js tests/run/texcsub.nim
00:03:39Araqwhy?
00:03:49Araqwhat's so hard to fix about it?
00:04:19reactormonkhttp://sprunge.us/gdOE <- solves it
00:04:24reactormonkI'm not sure where isObj is defined
00:04:35reactormonkit's magic, but I haven't found where it's defined :-(
00:05:00reactormonkwait.
00:06:07reactormonkapparently PNimType isn't imported correctly
00:08:01reactormonkwhat's a codegenType ?
00:08:31Araqis it in jsgen or in system.nim?
00:08:40reactormonkjssys.nim
00:09:03reactormonkthe code I'm looking at is hti.nim:85
00:10:42Araqwhen defined(NimString):
00:10:43Araq # we are in system module:
00:10:45Araq {.pragma: codegenType, compilerproc.}
00:10:46Araqelse:
00:10:48Araq {.pragma: codegenType.}
00:11:01reactormonkyep
00:11:06reactormonksame in hti.nim
00:11:41Araqwell it's either an alias for "compilerproc" or an empty pragma
00:11:51reactormonkhm.
00:11:58Araqfor system.nim it's the same as "compilerproc"
00:12:01Araqwhich is a misnomer
00:12:04reactormonkit's only used in hti.nim anyway
00:12:13Araqas it's obviously not a proc ;-)
00:12:42Araq"compilerproc" it means that the codegen emits this symbol for its purposes
00:13:00Araqand so it doesn't work without it
00:14:08reactormonkwhat is NimString?
00:15:43Araqit doesn't matter
00:15:50Araqoh wait ...
00:16:06Araqthat can be the problem :D
00:16:24AraqNimString is an implementation detail in system.nim
00:16:48AraqI use that check to determine whether hti.nim is included from system.nim or from typeinfo.nim
00:17:03Araqbut maybe it's not defined for the JS backend ...
00:17:23Araqyeah ... that's it
00:17:33Araqsystem.nim:195
00:17:45Araqit's in a "not defined(JS)" guard
00:18:02Araqso ... we need some better way to detect this
00:18:35reactormonkwhy do you care?
00:18:50Araqhuh?
00:19:05AraqI do care about the JS backend ...
00:19:31reactormonkwhy do you care if it's incloded form system.nim or typeinfo?
00:20:01Araqsome implementation trickery that I can't remember
00:20:18Araqwell I do:
00:20:27Araq"compilerproc" prevents name mangling
00:20:44Araqso if you *include* (not import) it twice it will get the same name
00:20:51Araqleading to wrong C code
00:21:15Araqso for typeinfo it has to be mangled
00:22:15reactormonkohh
00:22:44reactormonkwhy do you include it twice?
00:23:13Araqinformation hiding I think
00:23:26Araqthis stuff should not be exported but typeinfo needs it
00:23:27reactormonkOk. Can you pass parameters to include/import?
00:23:43AraqI had that idea :P
00:23:47Araqbut no
00:23:51Araqnot implemented
00:24:00Araqand maybe will never be
00:24:17Araqit causes problems for separate compilation
00:24:51Araqwhich can be solved, but it's work :P
00:25:10reactormonkso you use pragmas?
00:26:11Araqso I use hacks
00:27:25Araqer ...
00:27:49Araqhti.nim is not included in system.nim for the JS target
00:28:07Araqoh
00:28:20Araqit is in jssys
00:29:16Araqwell add this in jssys.nim:493
00:29:21*Trixar_za is now known as Trix[a]r_za
00:29:42reactormonkgotta run for the bus, let's see how well edge works
00:29:44Araqtype NimString = string # hack for hti.nim
00:30:10Araqgood night
00:33:54reactormonklet's see if it works
01:00:14*q66 quit (Remote host closed the connection)
01:48:23*rking joined #nimrod
03:41:13*Zor_ is now known as Zor
05:09:54*Boscop quit (Read error: Connection reset by peer)
05:10:21*Boscop joined #nimrod
05:45:08*ccssnet quit (Ping timeout: 245 seconds)
05:51:40*ccssnet joined #nimrod
06:35:55ZorAraq: ping
07:50:45*gour joined #nimrod
08:00:15gour#modula-2's motto is "Type safety and its strict enforcement is our religion" what about Nimrod?
08:01:59*Araq_ joined #nimrod
08:04:23Araq_Zor: pong
08:10:14ZorAraq_: does nimrod have destructors? if so, how do you code gen them for the C target?
08:24:20Araq_destructors are being worked on; we simply do a transformation in the frontend so that they end up in a try-finally
08:24:38ZorI see
08:25:07Araq_the destructor is bound to a type but is only invoked for variables of that type
08:25:26Araq_this causes problems for temporaries
08:26:23Araq_for the next version I want the compiler to emit an error if the type is used in f(g())
08:26:55Araq_but ultimately it will work like in C++
08:27:32Araq_it's however very expensive for the C target because 'try' is expensive to emulate in C
08:29:10Araq_on the other hand ... maybe we'll find a better solution; I don't really like C++'s solution as it does no escape analysis and optimizer settings can affect semantics
08:30:01Araq_allowing a type T with a destructor only in a 'var x: T' context solves many problems ...
08:39:32Araq_Zor: F# uses 'use x = ....' vs. 'let x = ...' where the 'use' version invokes the destructor implicitly at scope end
08:39:43Araq_this seems like a pretty nice solution
08:40:59*Zor nods
08:42:06Araq_but it only works for files and database connections etc. not for memory management
08:42:28Zorwhat makes you say that?
08:42:30Araq_it doesn't scale for anything expression based like bignums or regexes
08:43:47Zorit's common to use destructors and IDisposable to dispose of external memory in C# and F#
08:43:55Araq_true
08:44:07Araq_but it doesn't scale in this sense:
08:44:17Araq_a + b + c needs to become:
08:44:26Araq_use tmp = a + b;
08:44:33Araq_use tmp2 = tmp + c;
08:44:40Araq_--> human compiler at work here ;-)
09:24:35Araq_Zor: how does rust handle it now? I recall talk about using an escape analysis to determine where to inject the destructor calls
09:24:58Zornot sure
09:41:08*Araq_ quit (Read error: Connection timed out)
09:42:11*Araq_ joined #nimrod
10:05:04*Araq_ quit (Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931])
11:17:46*Araq_ joined #nimrod
11:18:07*Araq_ quit (Client Quit)
14:03:36*Trix[a]r_za is now known as Trixar_za
14:09:05*q66 joined #nimrod
14:40:07*Trixar_za is now known as Trix[a]r_za
16:08:00*xcombelle joined #nimrod
16:14:13*Trix[a]r_za is now known as Trixar_za
18:14:51*Trixar_za is now known as Trix[a]r_za
19:02:14*filwit joined #nimrod
19:58:47*xcombelle quit (Read error: Connection reset by peer)
21:09:58*Zerathul joined #nimrod
21:25:20*gour quit (Disconnected by services)
21:25:21*gour_ joined #nimrod
21:28:38*gour_ is now known as gour
21:39:33*Zerathul_ joined #nimrod
21:41:36*Zerathul quit (Ping timeout: 256 seconds)
21:41:43*Zerathul_ is now known as Zerathul
21:46:48filwithi Araq, you around?
22:16:42*gradha joined #nimrod
22:18:22gradhafilwit: I've got work for you, go to http://build.nimrod-code.org/irclogs/11-03-2013.html and search for "just remembered"
22:26:51*Trix[a]r_za is now known as Trixar_za
22:30:42*Zerathul quit (Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931])
22:36:37reactormonkAraq, looks like I need to write an stdout wrapper for node
22:36:53reactormonkas the test runner does not seem to like my multiline stuff
23:01:46*gradha quit (Quit: bbl, have youtube videos to watch)
23:05:47*gour quit (Quit: WeeChat 0.4.0)
23:38:32*Trixar_za is now known as Trix[a]r_za