<< 07-07-2015 >>

00:02:45*gyeates joined #nim
00:14:52*Varriount_ joined #nim
00:16:14*Varriount quit (Ping timeout: 248 seconds)
00:17:51*xet7 joined #nim
00:22:05*jaco60 quit (Ping timeout: 256 seconds)
00:29:38*strcmp1 joined #nim
00:30:38*gyeates quit (Ping timeout: 248 seconds)
00:38:37*BitPuffin|osx joined #nim
00:45:15*brson quit (Quit: leaving)
00:56:51*saml_ joined #nim
01:00:50*drewsrem quit (Quit: Leaving)
01:14:32*vendethiel quit (Ping timeout: 265 seconds)
01:23:46*gyeates joined #nim
01:25:51*Demos joined #nim
01:27:20*pregressive quit (Remote host closed the connection)
01:30:19*Demos quit (Ping timeout: 246 seconds)
01:30:45*vendethiel joined #nim
01:31:51*pregressive joined #nim
01:33:50*dalarmmst joined #nim
01:55:00*gyeates quit (Ping timeout: 276 seconds)
01:57:43*vasher_ joined #nim
02:14:59*devzerp quit (Remote host closed the connection)
02:14:59*no_name quit (Remote host closed the connection)
02:19:49*strcmp2 joined #nim
02:22:21*ozra quit (Ping timeout: 246 seconds)
02:22:47*strcmp1 quit (Ping timeout: 240 seconds)
02:37:49*dalarmmst quit (Ping timeout: 252 seconds)
02:51:08*darkf joined #nim
02:56:12*no_name joined #nim
02:56:13*devzerp joined #nim
03:00:18*saml_ quit (Quit: Leaving)
03:00:40*johnsoft quit (Ping timeout: 246 seconds)
03:01:13*johnsoft joined #nim
03:16:12*z1y joined #nim
03:32:31*EXetoC quit (Ping timeout: 246 seconds)
03:37:31*elbow joined #nim
04:07:36*infinity0 quit (Ping timeout: 264 seconds)
04:12:17*infinity0 joined #nim
04:35:32*BitPuffin|osx quit (Ping timeout: 256 seconds)
04:44:08*Jesin joined #nim
04:52:54*xcombelle joined #nim
05:00:31*gyeates joined #nim
05:08:23*filcuc joined #nim
05:23:33*johnsoft quit (Ping timeout: 256 seconds)
05:23:50*z1y quit (Remote host closed the connection)
05:24:35*johnsoft joined #nim
05:28:49*vasher_ quit (Quit: Connection closed for inactivity)
05:46:02*darkf_ joined #nim
05:49:02*darkf quit (Ping timeout: 248 seconds)
05:52:25*z1y joined #nim
05:52:25*z1y quit (Client Quit)
05:52:32*dalarmmst joined #nim
05:54:57*darkf_ is now known as darkf
05:55:44*wirbi joined #nim
05:55:52wirbiHello!
05:56:46wirbiAfter dom96 help me I have this code: https://gist.github.com/wirbi7/5f420c9d320438936019
05:57:56wirbiThen I call processHandshake it's read a first line, but on second I receive error:
05:58:31wirbi<-----> 15 recvLine Traceback (most recent call last) t4.nim(175) t4 asyncdispatch.nim(1540) runForever asyncdispatch.nim(983) poll asyncdispatch.nim(1091) cb asyncdispatch.nim(186) complete asyncdispatch.nim(1199) cb os.nim(1596) recvLineIntoIter asyncdispatch.nim(195) complete asyncdispatch.nim(1199) cb asyncnet.nim(411) recvLineIter asyncdispatch.nim(186) complete asyncdispatch.nim(1199) c
05:59:40wirbiI use pastebin for error trace: http://pastebin.com/LpTc7iWV
05:59:52*strcmp2 quit (Quit: Leaving)
06:00:25*zenmower_ joined #nim
06:00:39*zenmower_ left #nim (#nim)
06:01:55*pipeep joined #nim
06:07:45*dalarmmst quit (Ping timeout: 256 seconds)
06:13:43*z1y joined #nim
06:15:57*z1y quit (Remote host closed the connection)
06:18:23*z1y joined #nim
06:24:44*dalarmmst joined #nim
06:28:55*yglukhov_ joined #nim
06:29:34*jszymanski joined #nim
06:33:18*yglukhov_ quit (Ping timeout: 248 seconds)
06:41:17*Jesin quit (Quit: Leaving)
07:02:27*darkf quit (Read error: Connection reset by peer)
07:02:52*darkf joined #nim
07:11:24*shodan45 quit (Quit: Konversation terminated!)
07:26:45*yglukhov_ joined #nim
07:35:09*jubalh joined #nim
07:35:44*jaco60 joined #nim
07:41:28*Trustable joined #nim
07:53:29*z1y left #nim (#nim)
08:06:19*z1y joined #nim
08:09:46*z1y quit (Remote host closed the connection)
08:15:52*Kingsquee joined #nim
08:16:04*z1y joined #nim
08:17:04*coffeepot joined #nim
08:40:21*jubalh quit (Remote host closed the connection)
09:00:24*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
09:09:14*pregressive quit (Remote host closed the connection)
10:02:01*vasher_ joined #nim
10:20:11*lokulin quit (Ping timeout: 252 seconds)
10:22:35*lokulin joined #nim
10:29:43*milosn quit (Ping timeout: 246 seconds)
10:31:34*milosn joined #nim
10:37:20gokrJust stumbled on a sneaky gotcha.
10:37:50gokrSo... let's say I have a seq - and do "myseq.delete(myseq.high)" to remove last element.
10:38:01gokr(I had forgotten about pop etc)
10:38:16gokrAnd to my astonishment - nothing happened!
10:38:42gokrAnyone knows why? (its pretty funny)
10:39:47gokr(drum roll) ... the problem is that I had sequtils imported. So I was running sequtils.delete and not system.delete
10:40:07gokrAnd sequtils.delete takes two arguments - but sets default values to 0 for them!
10:40:41gokrSo "system.delete(myseq, myseq.high)" works fine.
10:47:21Araqwhy does sequtils.delete match?
10:48:52Araqoutch, proc delete in system takes a Natural ... so there is a conversion involved and none in sequtils.delete
10:48:58Araqthat sucks
10:51:08Araqwhy does it have default values anyway when the default ends up as system.delete's behaviour anyway?
10:55:26gokrNo idea
10:55:57*z1y quit (Remote host closed the connection)
10:56:28*z1y joined #nim
11:05:57*z1y quit (Remote host closed the connection)
11:06:11Araqwell i fixed it
11:06:27*z1y joined #nim
11:17:08gokrcool
11:17:50wirbiHello!
11:20:05*xet7 quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com ))
11:21:04wirbiPleace, see my code https://gist.github.com/wirbi7/5f420c9d320438936019 in processHandshake, let line = await ws.recvLine() work only once http://pastebin.com/LpTc7iWV . I think it's because some thing in async macro.
11:21:08*xet7 joined #nim
11:22:31*z1y quit (Remote host closed the connection)
11:22:50*z1y joined #nim
11:26:25Araqwirbi: why the nested recvSizeClosure ?
11:28:01wirbiNothing special, because I noob, please, say me other way.
11:32:25*z1y left #nim (#nim)
11:35:27Araqwell I don't know how async really works, but your code looks convoluted ;-)
11:35:34Araqdid you look at asynchttpserver.nim?
11:37:41wirbiNo, I don't see asynchttpserver. So, I'll try to understand it.
11:38:02Araqin general, as a noob I wouldn't start with Nim's async IO stuff. but hey, dom96 will be here today and help you, I'm sure
11:38:13Araqsorry, got to go, see you later
11:41:01wirbiI just very need websockets, so I went to a difficult way. Thank you for help.
11:41:28*aziz joined #nim
11:44:52*coffeepot joined #nim
11:50:12*xcombelle quit (Ping timeout: 264 seconds)
11:53:36*raza joined #nim
12:02:28*Kingsquee quit (Quit: Konversation terminated!)
12:07:10*jszymanski quit (Ping timeout: 248 seconds)
12:08:49*vasher_ quit (Quit: Connection closed for inactivity)
12:25:33*umurgdk joined #nim
12:29:04*z1y joined #nim
12:31:57*umurgdk quit (Remote host closed the connection)
12:32:43*EXetoC joined #nim
12:33:54*umurgdk joined #nim
12:45:02*FedeOmoto joined #nim
12:56:02r-kuAraq: how iterators get their stack space?
13:00:06Araqr-ku: it's allocated on the heap
13:00:19Araqbut since these cannot be recursive we can allocate an exact stack
13:00:25Araqwhich doesn't need to grow
13:01:20r-kui see. thinking of ways to do coroutines exploiting those cause im really having hard time with gc heh
13:02:09r-kuthinking of having iterator chain of sorts to allow yielding from iterator called from coroutine entry point iterator
13:02:17r-kualthough its nowhere near nice..
13:04:36*Demos joined #nim
13:04:41Araqwell once your stuff works I plan to base async on top of that
13:05:29*umurgdk quit (Remote host closed the connection)
13:05:55r-kuexcept i nearly dont know what im doing with gc so nim might reach 2.0 until it works :D
13:06:59*umurgdk joined #nim
13:08:17*Demos_ joined #nim
13:09:33Araqtold you everything there is to know
13:09:41Araqdoes it work now?
13:09:51*umurgdk quit (Remote host closed the connection)
13:10:47*Demos quit (Ping timeout: 240 seconds)
13:11:11*umurgdk joined #nim
13:12:56r-kuit "works". and by "works" i mean there is stack corruption somewhere which is fixed by introducing unused variable on stack in one proc (lol) and then adding main app stack to gc stacks makes it completely fail in echoing some debug repr() so obviously gc related
13:13:27r-kubut having that "fix" variable and not adding main app stack to gc - it works
13:13:42r-kustuff gets garbage-collected, coroutines exit normally
13:13:55r-kumight be luck though idk
13:14:40*umurgdk quit (Remote host closed the connection)
13:15:36*umurgdk joined #nim
13:17:27*Demos_ quit (Remote host closed the connection)
13:21:59Araqcan you give me the URL again please?
13:22:03AraqI'll play with it
13:23:16*Demos joined #nim
13:24:48r-kuAraq: https://github.com/r-ku/Nim/tree/coroutines
13:25:03r-kui tossed coro.nim and gctest.nim in main folder
13:26:18*jvrmaia joined #nim
13:36:47*umurgdk quit (Remote host closed the connection)
13:41:12*jvrmaia quit (Ping timeout: 264 seconds)
13:47:32*darkf_ joined #nim
13:50:06*darkf quit (Ping timeout: 248 seconds)
13:54:45*z1y left #nim (#nim)
13:55:21*wirbi quit (Ping timeout: 246 seconds)
13:57:19*darkf_ is now known as darkf
14:00:14*jvrmaia joined #nim
14:12:17*jvrmaia quit (Ping timeout: 240 seconds)
14:25:07*jvrmaia joined #nim
14:27:57*jvrmaia quit (Client Quit)
14:28:35*pregressive joined #nim
14:28:41*pregressive quit (Remote host closed the connection)
14:29:02*pregressive joined #nim
14:31:08*dgellow joined #nim
14:33:46*dgellow left #nim (#nim)
14:37:47*umurgdk joined #nim
14:38:17*gyeates quit (Ping timeout: 240 seconds)
14:44:36*umurgdk quit (Ping timeout: 276 seconds)
14:44:45Araqr-ku: why is alloca save here?
14:44:51Araq*safe
14:46:12r-kuits the only way i managed to make nim shift stack without using {.emit.}. since its pretty much like adding variable length array (char sp_shift[<size passed to alloca>];) i guess it should be safe
14:46:16*umurgdk joined #nim
14:47:50Araqalloca(cast[csize](addr(stack)) - cast[csize](stack) - coro.stacksize) # wtf?
14:48:13Araqand then you jump back to this thing?
14:48:28*Demos quit ()
14:48:46*vendethiel quit (Ping timeout: 248 seconds)
14:49:57r-kuits like.. non standard trick people should not be doing. i just manipulated functionality to set rsp register to new malloced memory ^_^
14:50:10r-kunot sure what you mean by "jump back to this thing"
14:50:28*vendethiel joined #nim
14:50:51Araqmeh just use inline assembler to switch stack pointers ffs
14:51:20r-kuyeah well.. for every arch compiler is gonna support..
14:51:36r-kuthere also is OS api but then its different for every OS nim is gonna support
14:51:52Araqit's 2015. there are only x86, x86_64 and ARM left
14:51:56r-kualloca is by far most portable (and jackass?) way ^_^
14:52:09FedeOmotohi, is this supposed to work?:
14:52:10FedeOmototype
14:52:10FedeOmoto A = ref object of RootObj
14:52:10FedeOmoto B = ref object of A
14:52:10FedeOmotomethod `$`(t: B): string = "B"
14:52:10FedeOmotomethod `$`(t: A, opt: string = nil): string = $t
14:52:11FedeOmoto#method `$`(t: A, opt: string = nil): string = `$`(cast[B](t))
14:52:13FedeOmotoproc newA: A = new(result)
14:52:15FedeOmotoproc newB: B = new(result)
14:52:17FedeOmotoecho newA()
14:52:19FedeOmotoecho newB()
14:52:31r-kuFedeOmoto: you have awakened serial killer in me. im coming for you :|
14:52:45EXetoCuse a pastebin service if you need to show us more than 2-3 lines
14:52:47FedeOmotohaha, sorry :P
14:52:52*xcombelle joined #nim
14:53:04FedeOmotopastebin for 10 lines?
14:53:26r-kuAraq: are you sure noone else will want to use nim on some weird arch? like say arduino. not sure if it doesnt run arm though
14:53:27AraqFedeOmoto: declare method A before method B
14:53:27FedeOmotook...
14:53:46EXetoC.eval
14:53:52Araqbut hijacking $ with dynamic binding is considered bad style
14:54:08FedeOmotoAraq: already tried, same problen
14:54:30AraqFedeOmoto: well these need to agree on the signature
14:54:41Araqyou give A and opt: string but not B
14:54:46Araq*an opt: string
14:55:09FedeOmotoAraq: so, it's not a bug?
14:55:37Araqr-ku: arduino doesn't have memory for multiple stacks anyway
14:56:02r-kuwell i cant think of better example
14:56:12AraqFedeOmoto: not really but methods will be slightly re-designed
14:56:22*BitPuffin joined #nim
14:57:15Araqr-ku: luajit comes with assembler code for coroutine switching
14:58:41FedeOmotook, thx
14:59:24*umurgdk quit (Remote host closed the connection)
14:59:52r-kuerr Araq what about msvc compiler on x64? it does not even support inline asm
15:01:32*pregressive quit (Remote host closed the connection)
15:01:44*jszymanski joined #nim
15:02:59*pregressive joined #nim
15:04:47*johnsoft quit (Ping timeout: 240 seconds)
15:09:16Araqhrm indeed. o.O
15:09:52*jszymanski quit (Read error: Connection reset by peer)
15:10:11Araqbut an external assembler can always be used
15:11:27r-kucould yes.. after all msvc ships with masm
15:12:02*strcmp1 joined #nim
15:12:37Araqthe compilers don't agree on an assembler syntax anyway
15:13:10*jszymanski joined #nim
15:19:53BitRTrying to debug my way through some of the lambda lifting issues on github, as I've stumbled upon one... is it so that a PNode always contains sons? I guess since it's sorta defined like a union (KindU that is) it might be possible. It's just that some of the LL code always assumes that you can use the sons property of PNodes.
15:22:49Araqusually there are some invariants that ensure the node has sons
15:23:18Araqfor instance, if n.kind == nkStmtlist it's ensures it has sons
15:23:39Araqeven though this one can have zero sons
15:23:43BitRah, so it's hopefully handled implicitly by an earlier check
15:23:57BitRsure, but the pointer would be valid
15:24:00Araqyes and if not it would crash in a debug build
15:24:15Araqnot simply misbehave and generate wrong C code
15:24:35Araqbut afaik it doesn't crash :P
15:25:04BitRcool, so just doing a debug build with koch would run some safety checks on the AST stuff then?
15:25:23Araqnot "some". a tremendous amount of checks.
15:25:35BitRnice :)
15:25:48Araqkoch temp c tests_that_fails.nim
15:25:58Araq<-- use that one for developing
15:26:17Araqand use if n.info ?? "test_that_fails": debug n
15:26:35Araqinstead of messing with GDB and KindU crap
15:28:10BitRNice, I'll keep that in mind. So far I'm just trying to find my way around, in which case GDB stack traces and --lineDir:on helps tremendously
15:28:34BitRI take it --opt:none implies -t:O0?
15:30:22*jszymanski quit (Ping timeout: 246 seconds)
15:30:37BitRholy hell that output is crazy
15:31:37BitRI was thinking of writing some GDB commands to inspect nim objects as it doesn't seem to be that complicated anyways
15:32:19BitRI mean, just doing 'x/s local->name->s->data' would reveal the name of a symbol
15:33:11BitRBut yeah getting around kindU is a bit annoying
15:35:23*BitPuffin quit (Read error: Connection reset by peer)
15:35:53*jszymanski joined #nim
15:36:37*BitPuffin joined #nim
15:41:18*vasher_ joined #nim
15:49:27wuehlmauswhat's kindU?
15:51:03BitRIt's the C union generated by the case in TNode that checks what type of node it is
15:52:10r-kuman whoever thought of that gcc extended inline asm deserves some nasty things to happen to him..
15:52:55*elbow quit (Quit: Leaving)
15:53:26*pleiosaur quit (Remote host closed the connection)
15:53:33*pleiosaur joined #nim
16:07:26*darkf quit (Quit: Leaving)
16:08:56*gyeates joined #nim
16:09:50*yglukhov_ quit (Ping timeout: 248 seconds)
16:13:04*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:19:01*darithorn quit (Quit: Leaving)
16:27:57*arnetheduck quit (Ping timeout: 276 seconds)
16:37:58*unclechu joined #nim
16:40:07*dgellow joined #nim
16:40:23dgellowhello
16:40:57dgellowI'm trying nim and I have some troubles with the sort fn
16:41:13dgellowI have this code `@[5, 7, 1, 2].sort(proc (x: int, y: int): int = cmp(x, y))`
16:41:37dgellowAnd I'm getting this error:
16:41:37dgellow"Error: type mismatch: got (seq[int], proc (x: int, y: int): int{.gcsafe, locks: 0.})
16:41:37dgellowbut expected one of:
16:41:37dgellowalgorithm.sort(a: var openarray[T], cmp: proc (x: T, y: T): int{.closure.}, order: SortOrder)"
16:42:05dgellowI don't understand what I'm doing wrong
16:44:44def-dgellow: it's not var, it's a let
16:45:05def-what you pass to sort has to be mutable
16:45:08def-otherwise use sorted
16:45:15dgellowah thank you !
16:45:44dgellowyeah, it works with sorted.
16:46:03dgellowthank you def-.
16:46:43*yglukhov__ joined #nim
16:46:45apenseIs there a reason why `echo 42'i` doesn't work like `42'f` and `42'u` do?
16:47:18def-import unsigned?
16:47:23def-ah wait
16:47:25def-misread
16:47:53def-it's i by default i guess
16:48:15apenseyeah I guess that's it
16:48:26apensethere's no reason to have it. just curious
16:49:12apenseanother question: anyone have any timeline for float128 support?
16:52:48*dgellow left #nim (#nim)
16:54:52unclechuhi there, i'm newbie in nim. i'm trying to start with example from nim-lang.org (simple http server)
16:54:52unclechui builded nim from sources and trying to build this example: 'nim c -r test.nim'
16:54:52unclechubut i've got error: "test1.nim(3, 3) Error: cannot open 'jester'"
16:54:58unclechuhow i can get this package?
16:56:29def-unclechu: use nimble and "nimble install jester"
16:56:51def-apense: you can do it yourself like this: https://bitbucket.org/behrends/nimlongint
16:57:17unclechudef-: i need build it, right? https://github.com/nim-lang/nimble
16:57:31def-unclechu: if you're on windows, there are binaries i think
16:57:40def-otherwise build it, yes
16:57:47unclechudef-: okay, i need build it
16:58:31apensedef-, thanks. I've done something like that before. just wondering when the nkFloat128Lit parts of the compiler will become more than placeholders
17:00:31apensedumpTree:
17:00:31apense 42.0'f128 gives Float128Lit. it's discussed in the lexer
17:01:13apenseagainst, just curious. I'm guessing computationally precise libraries can use it in the future. don't think anything needs it now, though
17:01:17apense*again
17:08:11*brson joined #nim
17:12:31*elbow_jason joined #nim
17:16:07r-kuAraq: i pushed version with stack switching using inline asm. now it 100% correctly switches/restores stacks (carefully checked in IDA). still no idea how some nim frame gets lost since test app crashes at the end of execution during last call to free(coro). I wonder.. with these longjmps nim frame chain gets mangled. order is totally not what it would be if it were normal calls. is this even correct thing to
17:16:08r-kuhave? i have no idea how to fix it if its not correct.
17:17:01*Arrrr joined #nim
17:17:34*gyeates quit (Ping timeout: 248 seconds)
17:19:49*MatrixBridge quit (Ping timeout: 256 seconds)
17:20:55*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
17:24:03*MatrixBridge joined #nim
17:27:48Araqr-ku: ah yeah, you need to set the stack frame after a yield
17:28:00Araqor disable it with --stackTrace:off
17:28:59r-kuhaha indeed it worked
17:29:04r-kucan you explain that stack frame stuff?
17:29:21r-kuhow i set it? where do i get it?
17:29:33AraqI don't think there is an API :P
17:30:36*gmpreussner|work quit (Ping timeout: 244 seconds)
17:30:49r-kualrighty, will have to ignore it for now then
17:30:56*gmpreussner|work joined #nim
17:30:58Araqno
17:31:07Araqlook into lib/system/excpt.nim
17:31:19Araqproc setFrame(s: PFrame) {.compilerRtl, inl.} =
17:31:21Araq framePtr = s
17:31:51Araqtoo bad you don't have a frame 's' that you can pass
17:32:17*gyeates joined #nim
17:33:33*raza joined #nim
17:33:44Araqor do you? :P
17:34:03Araqproc resetFrame() =
17:34:49Araq {.emit: "setFrame(&FR);".}
17:35:24Araqyou need to enclose this in a {.push stackFrame: off.} ... {.pop.} combo though for obvious reasons
17:35:34*raza left #nim (#nim)
17:35:55r-kuobvious to you right? i have no idea why im supposed to do this here :D
17:36:04Araqthe codegen always names the stack frame FR so this is rather stable
17:36:34*raza joined #nim
17:37:07*umurgdk joined #nim
17:37:17Araqit's better to importc the FR though and not use .emit for this
17:37:33Araqthis way it's ensured you don't call something without a C prototype
17:37:37*gmpreussner|work quit (Read error: Connection reset by peer)
17:37:52*gmpreussner|work joined #nim
17:38:22Araqr-ku: it's obvious if you inspect the generated C
17:40:22*yglukhov__ quit (Quit: Be back later ...)
17:41:19*drewsrem joined #nim
17:42:42*gmpreussner|work quit (Read error: Connection reset by peer)
17:44:17*BitPuffin quit (Ping timeout: 240 seconds)
17:44:58*gmpreussner|work joined #nim
17:45:47*gyeates quit (Ping timeout: 240 seconds)
17:49:32*umurgdk quit (Remote host closed the connection)
17:51:09*umurgdk joined #nim
17:54:34*lokulin quit (Ping timeout: 250 seconds)
17:58:52*gyeates joined #nim
17:59:44*X67r joined #nim
18:03:28*luntik2012 joined #nim
18:05:02*filcuc quit (Ping timeout: 248 seconds)
18:05:29*luntik2012 quit (Client Quit)
18:05:50*luntik2012 joined #nim
18:06:18*lokulin joined #nim
18:07:24*luntik2012 quit (Client Quit)
18:08:33r-kuAraq: soo.. i got to save old FR -> yield -> restore old FR? something like that?
18:08:49*vasher_ quit (Quit: Connection closed for inactivity)
18:09:35*filcuc joined #nim
18:10:00Araqyeah but actually since FR is a local variable it's a tad more complex
18:13:43r-kuehh by FR i actually meant framePtr from excpt.nim
18:17:11r-kuanyway will have to return to this tomorrow. head no workie any more. time for rest. gn crowd
18:18:20unclechuthere's any recommended vim-syntax plugin for vim?
18:19:19federico3unclechu: nim.vim
18:19:43unclechufederico3: http://vimawesome.com/plugin/nimrod-vim this one?
18:19:53reactormonkunclechu, https://github.com/zah/nim.vim
18:20:08reactormonkunclechu, or you can come to the dark side and use evil... and nim-mode ;-)
18:21:08*apense quit (Ping timeout: 265 seconds)
18:21:45unclechureactormonk: it's too early to choose dark side) may be later
18:23:23federico3ok, soo... how difficult it is to wrap a C library in Nim?
18:23:48reactormonkfederico3, you run c2nim and clean up the fallout
18:24:31federico3you make it sound easy
18:24:53reactormonkThat's the idea ;-)
18:25:26federico3nimble install c2nim failed already :D
18:25:52reactormonkdom96, ^ time to sort things out
18:26:34dom96hrm
18:26:41dom96how does it fail?
18:27:11reactormonkAre there explosions? :3
18:28:16federico3looks like nible is cloning c2nim and then <gh>/Araq/Nim.git (why?)
18:28:35reactormonkBecause it needs the compiler sources to generate the code
18:29:05federico3can it look for the compiler sources from another directory? Araq/Nim is the old repo
18:29:30*gyeates quit (Ping timeout: 244 seconds)
18:29:36federico3it then starts the build and fails with: compiler-0.11.3/compiler/options.nim(304, 7) Error: undeclared identifier: 'writeLine'
18:29:38reactormonkit should redirect
18:32:07federico3same error with nim c c2nim.nim from a local c2nim repo - looks like it's unrelated to nimble
18:33:00ArrrrIt is possible to make a seq of types? (seq[typedesc])
18:34:13EXetoCsomething exploded? what happened?
18:34:28reactormonkArrrr, why not
18:34:48Arrrrbecause the compiler throws me errors
18:34:51EXetoCcus unpredictable magic
18:35:08*mytrile joined #nim
18:37:39*xcombelle quit (Remote host closed the connection)
18:38:10EXetoCvarargs[typedesc]? I know there's some special behavior for varargs[expr] that's all
18:40:35*mytrile quit (Quit: mytrile)
18:41:01ArrrrMaybe im doing something wrong ... http://pastebin.com/e2kLxnCz
18:41:23EXetoCwill varargs be used for all these occasions?
18:42:40*xificurC quit (Read error: Connection reset by peer)
18:43:05AraqArrrr: typedesc has no runtime representation whatsoever
18:43:14EXetoCArrrr: yeah, you can't do that, and this triggers an internal error which implies a bug
18:43:15*xificurC joined #nim
18:43:49Araqfederico3: c2nim works for me but maybe cause nimble keeps my old compiler package around
18:44:08Araqin fact, the new c2nim is so awesome that no tweaking of the generated Nim code is required anymore :-)
18:44:11EXetoCvariants can be used for this, to some extent, but you must specify the valid types in advance
18:44:29AraqEXetoC: or you use seq[RootRef]
18:44:41Arrrrpff, well, maybe with the help of templates ..
18:45:15EXetoCright. runtime polymorphism might make more sense
18:46:11AraqArrrr: usually I just use Json instead of re-inventing Json
18:46:46*gyeates joined #nim
18:47:17Araqit's crazy how often one writes some Variant only to discover later that's not that different from what Json does and with Json you get all these interop benefits
18:50:35ArrrrI dont need to store data, but heterogeneous behaviours (procs).
18:50:52ArrrrLike, a list of procs which accept different types of args
18:52:37Araqthat's a list of closures then
18:53:15*mytrile joined #nim
18:53:36Araqin the closure's environments you can hide the different (heterogeneous) type requirements
18:56:32*mytrile quit (Client Quit)
18:56:45Arrrri want to achieve this in nim http://bit.ly/1gmbD0S
18:59:49Araqaye Eric Lippert.
19:01:13EXetoCI think many variant conveniences can be implemented in userland
19:03:11EXetoCbtw, could you access the type AST before the addition of getType? perhaps I would need that
19:03:33AraqArrrr: so you have a list of rules? I don't see any difficulties
19:04:10AraqEXetoC: no, instead it was tried to patch this problem with ever more typedesc voodoo hacks
19:04:36Araqtypetraits.nim ... bah
19:04:47EXetoCok
19:05:04ArrrrThe thing is, i dont have to define before hand a list for every possible rule, but a generic list, and whenever i want to check if it contains a rule which accepts certain type, just check it using another array of types
19:05:10Arrrr*i dont want to
19:06:51Araqseq[proc (actorA, actorB: ref Base): bool]
19:07:10*jszymanski quit (Read error: Connection reset by peer)
19:07:19Araqproc wizardCanHoldASword(actorA, actorB: ref Base): bool =
19:08:01Araq ensure actorA of Wizard, actorB of Weapon:
19:08:09*jszymanski joined #nim
19:08:37Araq result = actorA.isMale # male wizards can hold any weapon
19:09:11Arrrryeah, but in that seq i want also to have procs of type wizardCanEat(EatEvent) and wizardCanWalk(WalkSurface) for example
19:09:25Arrrrin your example i'd have to define like 3 separate seqs
19:09:45Araqno, but you need a common Base
19:09:49Arrrri'd like a way to iterate over one seq and ask every proc if it can accept certain kind of event
19:10:17EXetoCauto-generated "variant = 1" shortcuts for example
19:10:26EXetoCor something else if it's considered too error prone
19:10:43Arrrri dont mind as long as it is not a pain in the ass
19:11:45Araqwell in my example I have a Base class and then an 'ensure' which does the runtime type checking and conversions
19:12:33AraqI can imagine lots of different sugar but under the hood you want to disable the type system
19:12:53ArrrrThe example of the blog may not the best, i'll write some pseudocode for what i need
19:13:15Araqwhich can be done via 'case objects' or inheritance or via closures or via unsafe low level pointer hacking
19:15:54Arrrrhttp://pastebin.com/pEyCAUQQ
19:16:52ArrrronX are instances of Die | Eat
19:17:37EXetoChave you used entity component systems yet?
19:17:57ArrrrYes, but this is more convenient.
19:18:08EXetoCok
19:18:17ArrrrMore flexible, can be used with ES
19:19:14EXetoCI found it a little tricky to come up with a design, but it's very convenient
19:19:59EXetoCit just comes with a slight overhead, I think
19:20:34federico3WTF? Now it compiled successfully!
19:23:31*gmpreussner|work quit (Read error: Connection reset by peer)
19:27:22*gmpreussner|work joined #nim
19:28:47*umurgdk quit (Remote host closed the connection)
19:30:46AraqArrrr: I don't get it. ;-)
19:33:19Arrrrwell, i'll try writting a better example
19:35:25*umurgdk joined #nim
19:38:38*silven quit (Ping timeout: 252 seconds)
19:39:36*silven joined #nim
19:41:16*elbow_jason quit (Quit: Leaving)
19:44:06Arrrrit is mostly the same example with a little more detail http://pastebin.com/CaEBmCya
19:44:20ArrrrI have done it in java, but it is ugly as ... well, java
19:47:51Araqwell sorry but the solution I gave is still valid
19:49:40ArrrrYes, you are right, but i dont want to make checks inside every proc, but before entering them. And i dont want to use ref types for events
19:50:36AraqI'd just make the events an enum and case on them
19:51:44Araqusually you need a state machine for these things anyway or use a scripting layer
19:51:52Araq*or even use
19:52:28Araqthe "is unit X allowed to do that" problem is a fraction of the real problem
19:53:21Araqthe real problem is that you cannot write 'attack(x); attack(y); walkToXy(0, 8)' because in between the game loop and all that stuff needs to run
19:53:44*unclechu quit (Quit: Leaving.)
19:55:55ArrrrYes, but in this way i could handle how it is managed every 'event', whenever a player dispatches the 'onWear' event, i could for example tell to the player actor "addEvent player, onUnDressCancel", in case it tries to wear a cursed dress
19:56:32Arrrrand when it tries to undress its clothes, it would dispatch the 'onUnDressCancel' callback
19:56:52Arrrri can add/remove events like you could add/remove items from a list
19:57:49ArrrrEvents are situations i know beforehand, and eventcallbacks are a handy way to describe how to react to them, adding or removing them on runtime
19:58:38ArrrrAnd with a heterogeneous list, i dont event have to know on rumtime which kind of events an actor can react to
19:58:43Arrrr*even
19:59:03Araqbut if your state machine is already a seq[State] where State is a 'case object' you can remove and re-add stuff all you like
20:00:05Araqperhaps you want to attach a "isPossible" callback to the State
20:00:14EXetoCAraq: "scripting" with nim would be neat, in a way that is safer than loading dynamic libraries
20:00:19EXetoCwould it be necessary to use the vm?
20:01:51*Matthias247 joined #nim
20:02:07*unclechu joined #nim
20:03:13AraqEXetoC: I don't understand the question. you can DLL loading mechanisms or the VM. Neither of which seems ideal but if people don't use it it's hard to improve it.
20:03:19EXetoCor maybe there's OS magic for this, but taking that route would be difficult
20:04:08*yglukhov__ joined #nim
20:07:20ArrrrIt is possible to retrieve the address of a proc?
20:07:59AraqArrrr: just use foo instead foo()
20:09:46Arrrri cannot write a: seq[pointer]; add a, foo
20:10:09EXetoCAraq: safe as in sandboxed plugins
20:10:10Araqadd a, cast[pointer](foo)
20:10:14EXetoCok well I'll think about this
20:11:52Arrrrbut i cannot cast it back to proc()
20:12:01Arrrrit gives me strange c errors
20:13:41AraqArrrr: cast to proc () {.nimcall.}
20:14:27ArrrrOh yeah, that was it. Thank you araq
20:14:40Arrrri'll try to program a working example of my intentions
20:23:10EXetoCthe VM approach would be best, but there's not much to test yet, because you can't run instances of it at runtime, right?
20:23:32Araqhrm? we expose a (shitty) API to the VM
20:24:12Araqhttp://forum.nim-lang.org/t/1319#8265
20:25:18EXetoCok
20:26:49*unclechu quit (Ping timeout: 256 seconds)
20:26:58*ozra joined #nim
20:27:38Arrrrworks pretty well http://pastebin.com/FdL8hiie i need to learn how macro stuff works
20:27:41Arrrruntil next day
20:27:43*Arrrr quit (Quit: WeeChat 1.2)
20:30:38*unclechu joined #nim
20:42:21*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
20:46:41*yglukhov__ quit (Quit: Be back later ...)
20:47:53*drewsrem quit (Quit: Leaving)
20:50:33*johnsoft joined #nim
20:58:23*jszymanski quit (Ping timeout: 252 seconds)
21:00:44*elbow_jason joined #nim
21:10:45*zahary joined #nim
21:33:16*fizzbooze joined #nim
21:40:26*fizzbooze left #nim (#nim)
21:45:26*thales joined #nim
21:45:50*thales is now known as Guest27764
21:49:49*Trustable quit (Remote host closed the connection)
22:04:58*pregressive quit (Remote host closed the connection)
22:17:25*umurgdk quit (Remote host closed the connection)
22:21:33*aziz quit (Remote host closed the connection)
22:23:42*cornusammonis quit (Ping timeout: 248 seconds)
22:31:25*Matthias247 quit (Read error: Connection reset by peer)
22:45:48*filcuc quit (Quit: Konversation terminated!)
22:46:56*zahary quit (Read error: Connection reset by peer)
22:47:12*zahary joined #nim
22:47:52*unclechu quit (Remote host closed the connection)
23:11:00*X67r_ joined #nim
23:11:05*X67r quit (Ping timeout: 244 seconds)
23:18:19*umurgdk joined #nim
23:23:18*umurgdk quit (Ping timeout: 276 seconds)
23:29:45*drewsrem joined #nim
23:34:37*johnsoft quit (Ping timeout: 264 seconds)
23:40:18*brson quit (Quit: leaving)
23:41:11Araqwb zahary