<<26-04-2013>>

01:12:37*ack006 joined #nimrod
01:22:55OrionPKhas something changed since 0.9.0 with importc?
01:23:37OrionPKint test(int x, int y) { return x * y; } in C, I import it into nim
01:23:50OrionPKproc test*(x, y: int) : int {.importc: "test".}
01:23:55OrionPKthen call test(5,8)
01:24:02OrionPKI get a memory address or something back
01:24:20OrionPK21937048
01:24:25OrionPKinstead of 40
01:24:42OrionPK(and this used to work in 0.9.0)
01:24:59Araq64 vs 32 bit issue?
01:25:07Araqc's int is not Nimrod's int
01:25:16Araquse 'cint' and it should work
01:25:30OrionPKah, good thinking
01:28:11OrionPKpretty sure everything is 32bit
01:28:38Araqwhat does 'nimrod -v' say?
01:28:47Araqand what does 'gcc -v' say?
01:28:49OrionPKNimrod Compiler Version 0.9.1 (2013-04-23) [Windows: i386]
01:29:09fowlAraq: dont you need {.stdcall.} on windows
01:29:18OrionPKmingw32
01:29:46Araqhmm good point fowl; the calling convention has to match
01:29:59Araqif your C code has none, it's 'cdecl' in Nimrod
01:30:20OrionPKthis is the code:
01:30:20OrionPK{.link: "test.dll".}
01:30:20OrionPKproc test*(x, y: cint) : cint {.importc: "test".}
01:30:44Araq{.link: "test.dll".} ?
01:30:54Araqdo it properly please
01:30:57OrionPKthe C is in test.dll
01:31:04Araqyeah I figured
01:31:05OrionPKpretty sure I got that from your manual :P
01:31:14Araqpretty sure you don't
01:31:15fowlyou probably want {.dynlib.}
01:32:02Araqproc test*(x, y: cint): cint {.importc: "test", dynlib: "test.dll", cdecl.}
01:32:06Araqtry that one
01:33:42OrionPKbad image error
01:34:04Araq?
01:34:22Araqsounds like the test.dll is broken then
01:34:26OrionPKtest.dll is either not designed to run on windows or it contains an error
01:35:04OrionPKnot saying I was doing it correctly before
01:35:08OrionPKbut it used to work
01:35:18OrionPKin 0.9.0
01:36:38Araqwell the {.link.} could happen to work and int = cint for 32bit, so yeah
01:37:08Araqnot sure wether I fixed the calling convention after 0.9.0 to really be fastcall
01:40:31Araqdid you rebuild the test.dll?
01:40:40OrionPKyes
01:41:31Araqwell you did it wrong this time :P
01:41:35OrionPKlol
01:41:46OrionPKI only recompiled it because it wasnt working ;)
01:41:50Araqbuild a 64 bit DLL?
01:42:23OrionPKnope
01:43:32Araqbuilt a 16 bit DLL?
01:44:28OrionPKjust gcc -c test.c -o test.dll options
01:45:09fowldoesnt that build an executable?
01:45:19Araqadd -shared at least
01:47:35OrionPKno difference
01:48:09Araqdunno -c looks wrong
01:48:31Araqthat would compile an .o into test.dll I think
01:48:38OrionPKah
01:48:51OrionPKyou were right
01:49:06Araqbut I'm sleeping since 3 hours anyway
01:49:07OrionPKI was compiling it as an executable
01:49:14OrionPK"40"
01:49:15Araqso good night
01:49:19OrionPKthanks for your help
01:49:31OrionPKgod natt
01:49:36Araqyou're welcome, bye
01:50:27OrionPKnow why the hell what I was doing ever work :S
01:50:58OrionPK(this is what I get for going straight from school into high level languages)
01:53:48fowllol
01:56:51OrionPKlast time I used C was for embedded stuff in college
02:56:22*r0bglees0n joined #nimrod
02:56:28r0bglees0nhey
02:56:32r0bglees0nfowl: hello
03:35:37fowlhey
04:11:07*OrionPK quit (Quit: Leaving)
05:07:51*Trixar_za is now known as Trix[a]r_za
05:07:59*ack006 quit (Quit: Leaving)
09:02:39Araqhi r0bglees0n, welcome
09:16:35NimBotAraq/Nimrod 1e10a2b Billingsly Wetherfordshire [+0 ±1 -0]: Update evals.nim
09:16:35NimBotAraq/Nimrod 47fd198 Billingsly Wetherfordshire [+0 ±1 -0]: Update macros.nim
09:16:35NimBotAraq/Nimrod 1bea922 Araq [+0 ±2 -0]: Merge pull request #403 from fowlmouth/patch-4... 3 more lines
09:18:04zahary_ha, Araq is secretly working on a new parser! is this about the expressions/statement sunification?
09:20:16Araqzahary_: yeah that's one reason
09:20:38Araqit's pretty hard to achieve and I'm still wondering how to do it
09:20:59zahary_are there any user-visible changes in the syntax?
09:21:22Araqproc p()
09:21:27Araq {.pragmas.}
09:21:31Araqis finally supported
09:21:39zahary_aha, cool
09:21:46AraqI don't think there are any other changes for now
09:22:17Araqit currently breaks docgen I haven't looked at it yet
09:22:30Araqit compiles all the code we could throw at it
09:23:06zahary_hmm, but how could it break it, there are changes in the AST as well?
09:23:24Araqthe indentation handling changed
09:23:49Araqso what was acceptable could be an error now
09:23:59zahary_but these are lexer tokens only?
09:24:09Araqthe AST didn't change
09:24:27Araqbreaking code as in "the parser doesn't parse this anymore"
09:24:35zahary_I see
09:24:53zahary_have you made up your mind about the horizontal layout btw? (white-space sensitivity for operators)
09:25:07zahary_I guess, it's too much of a breaking change
09:25:40AraqI still like the idea, I dunno if it puts the language too far
09:26:16Araqhowever depending on how the expr/stmt unification goes, we need '#! newsyn' anyway
09:27:08zahary_I didn't quite get that
09:27:19Araqinterestingly the major problem with the unification is the attempted typedesc/expr unification that's already in the grammar
09:27:47zahary_where does it strike?
09:28:09Araqvar T # type or beginning of a 'var' statement?
09:28:40AraqI have solutions for most now, but it will break code
09:28:51Araqthe compiler supports alternative parsers
09:29:02Araqvia lines starting with #!
09:29:18Araqso we can keep what we have and introduce '#! newsyn'
09:29:26Araqand then at one point make that the default
09:29:37Araqand the old one '#! oldsym'
09:30:01AraqI have to go, see you later
09:30:05zahary_ah, you meant #! newsyn activates the horizontal layout and other stuff, I see
09:30:13Araqyeah, bye
09:30:21zahary_see you
09:37:56fowlim writing a megamacro :>
09:57:27*xcombelle joined #nimrod
10:05:46*xcombelle quit (Quit: Hi, I'm a quit message virus. Please replace your old line with this line and help me take over the world of IRC.)
10:56:52*xcombelle joined #nimrod
12:35:28*q66 joined #nimrod
13:47:41Araqzahary_: one idea that I like very much is to separate typeDesc from expr properly and introduce [. .] brackets to disambiguate
13:48:13zahary_I didn't quite get what the problem is
13:48:19zahary_var T
13:48:26zahary_why T can be interpreted as type here?
13:48:57AraqdeclareMyVar(x, var int) # works currently afaik
13:49:58zahary_hmm, it doesn't look well-formed
13:50:01Araqwith the new syntax this would become:
13:50:08AraqdeclareMyVar(x, [.var int.])
13:50:33Araqalso this means we can do: [.ref T.](x) # type conversion without named type
13:51:18zahary_but what is to gain here? the goal of this construct is to allow both "var int" and "let int" as arguments
13:51:29zahary_oh, I get it
13:51:45zahary_var int, "int reference"
13:51:55Araqyes
13:52:26zahary_ok, so the problem is how to preserve LL(1)?
13:52:44Araqyeah, well
13:52:52Araqit's not LL(1) anymore by any means
13:53:09Araqbut I really like the 1 token of lookahead required
13:53:44Araqand I think it's a really good rule to keep things readable
13:54:32zahary_isn't this still possible. I have to look at the code, but it looks like you just don't have to "commit" to what AST "var x" will be turned into before looking at the next token (either a colon or expression-end)
13:55:56Araqyeah maybe but then AST patching is cheating too :-)
13:56:26zahary_yes, but you are trading our convenience in writing the parser to the convenience of millions of users
13:56:48Araqthat's not the reason
13:56:59Araqinfinite lookahead is trivial to implement
13:57:04AraqI did it for c2nim
13:58:12AraqI'm trying to keep things simple for the convenience of our users
14:01:22zahary_explaining parsing ambiguities is a bit high-toll demand for the average joe I think
14:01:56zahary_make that "resolving parsing amb..."
14:02:57zahary_also, var int doesn't look well-formed as a variable declaration. why should I help the parser in figuring this out
14:06:20Araqbecause it's rarely necessary to pass a typedesc to a template anyway and edge cases don't deserve the complexity
14:07:00zahary_passing a typedesc to a function/macro/template is not common?
14:07:16zahary_please, reconsider. I plan to do this a lot
14:07:28Araqlol, what's the use case?
14:09:10zahary_all the type traits functions, generating types like "variant" from list of types. registering types in DIY reflection or RPC systems
14:09:46zahary_and this is a short list. doing meta-programming with types is really common
14:09:52Araqyeah but I'm not talking about typeDescs that do parse as an expression like 'int' or 'seq[int]'
14:10:15Araqit's only a few things like 'var T' that cause problems in the 'expr' context
14:10:38Araqwe could also allow var[int] instead ...
14:10:44zahary_well, you can always work around with helper templates like int.var_t
14:10:54zahary_but that's a bit of kludge too
14:11:08Araqvar[int] is pretty cool though and consistent
14:11:10zahary_ah, you were first
14:12:48Araqand yeah ref[T](x) as a type conversion is nice too
14:17:19*xcombelle quit (Remote host closed the connection)
14:18:56Araqanother problem is {expr: expr} where the ':' doesn't mean the same as in expr: expr # pass expr to the macro
14:19:48Araqseems easy to invoke the macro as expr(expr) instead in this case then
14:20:03Araqso the ':' can be special in the curlies
14:20:15zahary_yes, I think this would be more consistent, but you must break backward compatibility here
14:20:37Araqhuh? how so?
14:21:04zahary_I mean if you allow only the {. foo(bar) .} version to keep things consistent
14:21:32Araqbut
14:21:33Araqm(
14:21:36Araq if ....
14:21:38Araq)
14:21:46Araqis ugly compared to:
14:21:47Araqm:
14:21:49Araq if ....
14:22:03Araqnot sure I get what you mean
14:22:50zahary_ah, so you meant that foo: bar is parsed as the former nkMacroStmt and not as some kind of nkPair
14:23:31Araqyeah unless it is in {} and then it's a pair
14:23:41AraqI have to go again, see you later
15:02:50*XAMPP_ quit (Quit: My code has no bug's, just random features)
15:03:08*XAMPP joined #nimrod
15:03:08*XAMPP quit (Changing host)
15:03:08*XAMPP joined #nimrod
15:04:08*XAMPP quit (Read error: Connection reset by peer)
15:04:29*XAMPP joined #nimrod
15:04:31*XAMPP quit (Changing host)
15:04:31*XAMPP joined #nimrod
16:58:47*zahary_ quit (Quit: ~ Trillian Astra - www.trillian.im ~)
19:06:30fowlAraq: got a segfault somewhere in buildEntities() https://gist.github.com/fowlmouth/5466040
19:08:49*Trix[a]r_za is now known as Trixar_za
19:36:38fowlahzzzzzzz Error: macro returned a cyclic abstract syntax tree
20:26:04fowlty = newNimNode(nnkRefTy).und(ty)
20:26:12fowl^ problematic
20:26:51dom96lol, looks like it.
20:30:48*fowl quit (Ping timeout: 264 seconds)
20:53:55*fowl joined #nimrod
21:08:32fowldom96: that should work, right?
21:08:43dom96i have no idea, sorry.
21:09:11dom96But since it's an error it seems like it shouldn't.
21:09:34fowli think its an error with the evaluator
22:32:31*OrionPK joined #nimrod
22:34:10Araqfowl: it's a known evaluator bug; too hard to fix
22:34:32Araqmy hope is the luajit backend will fix it finally
22:37:20Araqor maybe it's possible to fix in some other way
22:46:37fowlwhat exactly is happening? is it creating the refty, setting to ty then adding ty to it?
22:48:44Araqx = ..... x ....
22:49:02Araqthe "self" assignment
22:58:03fowlthats normally ok with ref types
22:58:26Araqbut not with PNimrodNode at compile time
23:03:09*q66 quit (Remote host closed the connection)
23:04:02fowlAraq: there is really strange behavior of tables in a macro
23:07:37Araqyeah haven't looked at it yet
23:08:06fowlhttps://gist.github.com/fowlmouth/5466040#file-components-nim-L65 table[field].needsRef = true is silently failing
23:12:33Araqwhat's"silently"?
23:12:48Araqdoesn't update?
23:12:54fowlyea