00:00:12 | * | rking quit (Read error: Connection reset by peer) |
00:01:11 | reactormonk | Araq, found a rather nasty bug - base (for type base) is created as base_ID |
00:01:19 | reactormonk | where id is the good ol' int |
00:02:55 | reactormonk | Araq, grab my repo, boot, run nimrod -d:nodejs -r js tests/run/texcsub.nim |
00:03:39 | Araq | why? |
00:03:49 | Araq | what's so hard to fix about it? |
00:04:19 | reactormonk | http://sprunge.us/gdOE <- solves it |
00:04:24 | reactormonk | I'm not sure where isObj is defined |
00:04:35 | reactormonk | it's magic, but I haven't found where it's defined :-( |
00:05:00 | reactormonk | wait. |
00:06:07 | reactormonk | apparently PNimType isn't imported correctly |
00:08:01 | reactormonk | what's a codegenType ? |
00:08:31 | Araq | is it in jsgen or in system.nim? |
00:08:40 | reactormonk | jssys.nim |
00:09:03 | reactormonk | the code I'm looking at is hti.nim:85 |
00:10:42 | Araq | when defined(NimString): |
00:10:43 | Araq | # we are in system module: |
00:10:45 | Araq | {.pragma: codegenType, compilerproc.} |
00:10:46 | Araq | else: |
00:10:48 | Araq | {.pragma: codegenType.} |
00:11:01 | reactormonk | yep |
00:11:06 | reactormonk | same in hti.nim |
00:11:41 | Araq | well it's either an alias for "compilerproc" or an empty pragma |
00:11:51 | reactormonk | hm. |
00:11:58 | Araq | for system.nim it's the same as "compilerproc" |
00:12:01 | Araq | which is a misnomer |
00:12:04 | reactormonk | it's only used in hti.nim anyway |
00:12:13 | Araq | as it's obviously not a proc ;-) |
00:12:42 | Araq | "compilerproc" it means that the codegen emits this symbol for its purposes |
00:13:00 | Araq | and so it doesn't work without it |
00:14:08 | reactormonk | what is NimString? |
00:15:43 | Araq | it doesn't matter |
00:15:50 | Araq | oh wait ... |
00:16:06 | Araq | that can be the problem :D |
00:16:24 | Araq | NimString is an implementation detail in system.nim |
00:16:48 | Araq | I use that check to determine whether hti.nim is included from system.nim or from typeinfo.nim |
00:17:03 | Araq | but maybe it's not defined for the JS backend ... |
00:17:23 | Araq | yeah ... that's it |
00:17:33 | Araq | system.nim:195 |
00:17:45 | Araq | it's in a "not defined(JS)" guard |
00:18:02 | Araq | so ... we need some better way to detect this |
00:18:35 | reactormonk | why do you care? |
00:18:50 | Araq | huh? |
00:19:05 | Araq | I do care about the JS backend ... |
00:19:31 | reactormonk | why do you care if it's incloded form system.nim or typeinfo? |
00:20:01 | Araq | some implementation trickery that I can't remember |
00:20:18 | Araq | well I do: |
00:20:27 | Araq | "compilerproc" prevents name mangling |
00:20:44 | Araq | so if you *include* (not import) it twice it will get the same name |
00:20:51 | Araq | leading to wrong C code |
00:21:15 | Araq | so for typeinfo it has to be mangled |
00:22:15 | reactormonk | ohh |
00:22:44 | reactormonk | why do you include it twice? |
00:23:13 | Araq | information hiding I think |
00:23:26 | Araq | this stuff should not be exported but typeinfo needs it |
00:23:27 | reactormonk | Ok. Can you pass parameters to include/import? |
00:23:43 | Araq | I had that idea :P |
00:23:47 | Araq | but no |
00:23:51 | Araq | not implemented |
00:24:00 | Araq | and maybe will never be |
00:24:17 | Araq | it causes problems for separate compilation |
00:24:51 | Araq | which can be solved, but it's work :P |
00:25:10 | reactormonk | so you use pragmas? |
00:26:11 | Araq | so I use hacks |
00:27:25 | Araq | er ... |
00:27:49 | Araq | hti.nim is not included in system.nim for the JS target |
00:28:07 | Araq | oh |
00:28:20 | Araq | it is in jssys |
00:29:16 | Araq | well add this in jssys.nim:493 |
00:29:21 | * | Trixar_za is now known as Trix[a]r_za |
00:29:42 | reactormonk | gotta run for the bus, let's see how well edge works |
00:29:44 | Araq | type NimString = string # hack for hti.nim |
00:30:10 | Araq | good night |
00:33:54 | reactormonk | let'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:55 | Zor | Araq: ping |
07:50:45 | * | gour joined #nimrod |
08:00:15 | gour | #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:23 | Araq_ | Zor: pong |
08:10:14 | Zor | Araq_: does nimrod have destructors? if so, how do you code gen them for the C target? |
08:24:20 | Araq_ | destructors are being worked on; we simply do a transformation in the frontend so that they end up in a try-finally |
08:24:38 | Zor | I see |
08:25:07 | Araq_ | the destructor is bound to a type but is only invoked for variables of that type |
08:25:26 | Araq_ | this causes problems for temporaries |
08:26:23 | Araq_ | for the next version I want the compiler to emit an error if the type is used in f(g()) |
08:26:55 | Araq_ | but ultimately it will work like in C++ |
08:27:32 | Araq_ | it's however very expensive for the C target because 'try' is expensive to emulate in C |
08:29:10 | Araq_ | 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:01 | Araq_ | allowing a type T with a destructor only in a 'var x: T' context solves many problems ... |
08:39:32 | Araq_ | Zor: F# uses 'use x = ....' vs. 'let x = ...' where the 'use' version invokes the destructor implicitly at scope end |
08:39:43 | Araq_ | this seems like a pretty nice solution |
08:40:59 | * | Zor nods |
08:42:06 | Araq_ | but it only works for files and database connections etc. not for memory management |
08:42:28 | Zor | what makes you say that? |
08:42:30 | Araq_ | it doesn't scale for anything expression based like bignums or regexes |
08:43:47 | Zor | it's common to use destructors and IDisposable to dispose of external memory in C# and F# |
08:43:55 | Araq_ | true |
08:44:07 | Araq_ | but it doesn't scale in this sense: |
08:44:17 | Araq_ | a + b + c needs to become: |
08:44:26 | Araq_ | use tmp = a + b; |
08:44:33 | Araq_ | use tmp2 = tmp + c; |
08:44:40 | Araq_ | --> human compiler at work here ;-) |
09:24:35 | Araq_ | 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:58 | Zor | not 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:48 | filwit | hi Araq, you around? |
22:16:42 | * | gradha joined #nimrod |
22:18:22 | gradha | filwit: 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:37 | reactormonk | Araq, looks like I need to write an stdout wrapper for node |
22:36:53 | reactormonk | as 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 |