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:52 | wirbi | Hello! |
05:56:46 | wirbi | After dom96 help me I have this code: https://gist.github.com/wirbi7/5f420c9d320438936019 |
05:57:56 | wirbi | Then I call processHandshake it's read a first line, but on second I receive error: |
05:58:31 | wirbi | <-----> 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:40 | wirbi | I 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:20 | gokr | Just stumbled on a sneaky gotcha. |
10:37:50 | gokr | So... let's say I have a seq - and do "myseq.delete(myseq.high)" to remove last element. |
10:38:01 | gokr | (I had forgotten about pop etc) |
10:38:16 | gokr | And to my astonishment - nothing happened! |
10:38:42 | gokr | Anyone knows why? (its pretty funny) |
10:39:47 | gokr | (drum roll) ... the problem is that I had sequtils imported. So I was running sequtils.delete and not system.delete |
10:40:07 | gokr | And sequtils.delete takes two arguments - but sets default values to 0 for them! |
10:40:41 | gokr | So "system.delete(myseq, myseq.high)" works fine. |
10:47:21 | Araq | why does sequtils.delete match? |
10:48:52 | Araq | outch, proc delete in system takes a Natural ... so there is a conversion involved and none in sequtils.delete |
10:48:58 | Araq | that sucks |
10:51:08 | Araq | why does it have default values anyway when the default ends up as system.delete's behaviour anyway? |
10:55:26 | gokr | No 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:11 | Araq | well i fixed it |
11:06:27 | * | z1y joined #nim |
11:17:08 | gokr | cool |
11:17:50 | wirbi | Hello! |
11:20:05 | * | xet7 quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )) |
11:21:04 | wirbi | Pleace, 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:25 | Araq | wirbi: why the nested recvSizeClosure ? |
11:28:01 | wirbi | Nothing special, because I noob, please, say me other way. |
11:32:25 | * | z1y left #nim (#nim) |
11:35:27 | Araq | well I don't know how async really works, but your code looks convoluted ;-) |
11:35:34 | Araq | did you look at asynchttpserver.nim? |
11:37:41 | wirbi | No, I don't see asynchttpserver. So, I'll try to understand it. |
11:38:02 | Araq | in 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:13 | Araq | sorry, got to go, see you later |
11:41:01 | wirbi | I 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:02 | r-ku | Araq: how iterators get their stack space? |
13:00:06 | Araq | r-ku: it's allocated on the heap |
13:00:19 | Araq | but since these cannot be recursive we can allocate an exact stack |
13:00:25 | Araq | which doesn't need to grow |
13:01:20 | r-ku | i see. thinking of ways to do coroutines exploiting those cause im really having hard time with gc heh |
13:02:09 | r-ku | thinking of having iterator chain of sorts to allow yielding from iterator called from coroutine entry point iterator |
13:02:17 | r-ku | although its nowhere near nice.. |
13:04:36 | * | Demos joined #nim |
13:04:41 | Araq | well 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:55 | r-ku | except 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:33 | Araq | told you everything there is to know |
13:09:41 | Araq | does 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:56 | r-ku | it "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:27 | r-ku | but having that "fix" variable and not adding main app stack to gc - it works |
13:13:42 | r-ku | stuff gets garbage-collected, coroutines exit normally |
13:13:55 | r-ku | might 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:59 | Araq | can you give me the URL again please? |
13:22:03 | Araq | I'll play with it |
13:23:16 | * | Demos joined #nim |
13:24:48 | r-ku | Araq: https://github.com/r-ku/Nim/tree/coroutines |
13:25:03 | r-ku | i 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:45 | Araq | r-ku: why is alloca save here? |
14:44:51 | Araq | *safe |
14:46:12 | r-ku | its 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:50 | Araq | alloca(cast[csize](addr(stack)) - cast[csize](stack) - coro.stacksize) # wtf? |
14:48:13 | Araq | and then you jump back to this thing? |
14:48:28 | * | Demos quit () |
14:48:46 | * | vendethiel quit (Ping timeout: 248 seconds) |
14:49:57 | r-ku | its like.. non standard trick people should not be doing. i just manipulated functionality to set rsp register to new malloced memory ^_^ |
14:50:10 | r-ku | not sure what you mean by "jump back to this thing" |
14:50:28 | * | vendethiel joined #nim |
14:50:51 | Araq | meh just use inline assembler to switch stack pointers ffs |
14:51:20 | r-ku | yeah well.. for every arch compiler is gonna support.. |
14:51:36 | r-ku | there also is OS api but then its different for every OS nim is gonna support |
14:51:52 | Araq | it's 2015. there are only x86, x86_64 and ARM left |
14:51:56 | r-ku | alloca is by far most portable (and jackass?) way ^_^ |
14:52:09 | FedeOmoto | hi, is this supposed to work?: |
14:52:10 | FedeOmoto | type |
14:52:10 | FedeOmoto | A = ref object of RootObj |
14:52:10 | FedeOmoto | B = ref object of A |
14:52:10 | FedeOmoto | method `$`(t: B): string = "B" |
14:52:10 | FedeOmoto | method `$`(t: A, opt: string = nil): string = $t |
14:52:11 | FedeOmoto | #method `$`(t: A, opt: string = nil): string = `$`(cast[B](t)) |
14:52:13 | FedeOmoto | proc newA: A = new(result) |
14:52:15 | FedeOmoto | proc newB: B = new(result) |
14:52:17 | FedeOmoto | echo newA() |
14:52:19 | FedeOmoto | echo newB() |
14:52:31 | r-ku | FedeOmoto: you have awakened serial killer in me. im coming for you :| |
14:52:45 | EXetoC | use a pastebin service if you need to show us more than 2-3 lines |
14:52:47 | FedeOmoto | haha, sorry :P |
14:52:52 | * | xcombelle joined #nim |
14:53:04 | FedeOmoto | pastebin for 10 lines? |
14:53:26 | r-ku | Araq: 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:27 | Araq | FedeOmoto: declare method A before method B |
14:53:27 | FedeOmoto | ok... |
14:53:46 | EXetoC | .eval |
14:53:52 | Araq | but hijacking $ with dynamic binding is considered bad style |
14:54:08 | FedeOmoto | Araq: already tried, same problen |
14:54:30 | Araq | FedeOmoto: well these need to agree on the signature |
14:54:41 | Araq | you give A and opt: string but not B |
14:54:46 | Araq | *an opt: string |
14:55:09 | FedeOmoto | Araq: so, it's not a bug? |
14:55:37 | Araq | r-ku: arduino doesn't have memory for multiple stacks anyway |
14:56:02 | r-ku | well i cant think of better example |
14:56:12 | Araq | FedeOmoto: not really but methods will be slightly re-designed |
14:56:22 | * | BitPuffin joined #nim |
14:57:15 | Araq | r-ku: luajit comes with assembler code for coroutine switching |
14:58:41 | FedeOmoto | ok, thx |
14:59:24 | * | umurgdk quit (Remote host closed the connection) |
14:59:52 | r-ku | err 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:16 | Araq | hrm indeed. o.O |
15:09:52 | * | jszymanski quit (Read error: Connection reset by peer) |
15:10:11 | Araq | but an external assembler can always be used |
15:11:27 | r-ku | could yes.. after all msvc ships with masm |
15:12:02 | * | strcmp1 joined #nim |
15:12:37 | Araq | the compilers don't agree on an assembler syntax anyway |
15:13:10 | * | jszymanski joined #nim |
15:19:53 | BitR | Trying 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:49 | Araq | usually there are some invariants that ensure the node has sons |
15:23:18 | Araq | for instance, if n.kind == nkStmtlist it's ensures it has sons |
15:23:39 | Araq | even though this one can have zero sons |
15:23:43 | BitR | ah, so it's hopefully handled implicitly by an earlier check |
15:23:57 | BitR | sure, but the pointer would be valid |
15:24:00 | Araq | yes and if not it would crash in a debug build |
15:24:15 | Araq | not simply misbehave and generate wrong C code |
15:24:35 | Araq | but afaik it doesn't crash :P |
15:25:04 | BitR | cool, so just doing a debug build with koch would run some safety checks on the AST stuff then? |
15:25:23 | Araq | not "some". a tremendous amount of checks. |
15:25:35 | BitR | nice :) |
15:25:48 | Araq | koch temp c tests_that_fails.nim |
15:25:58 | Araq | <-- use that one for developing |
15:26:17 | Araq | and use if n.info ?? "test_that_fails": debug n |
15:26:35 | Araq | instead of messing with GDB and KindU crap |
15:28:10 | BitR | Nice, 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:34 | BitR | I take it --opt:none implies -t:O0? |
15:30:22 | * | jszymanski quit (Ping timeout: 246 seconds) |
15:30:37 | BitR | holy hell that output is crazy |
15:31:37 | BitR | I was thinking of writing some GDB commands to inspect nim objects as it doesn't seem to be that complicated anyways |
15:32:19 | BitR | I mean, just doing 'x/s local->name->s->data' would reveal the name of a symbol |
15:33:11 | BitR | But 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:27 | wuehlmaus | what's kindU? |
15:51:03 | BitR | It's the C union generated by the case in TNode that checks what type of node it is |
15:52:10 | r-ku | man 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:23 | dgellow | hello |
16:40:57 | dgellow | I'm trying nim and I have some troubles with the sort fn |
16:41:13 | dgellow | I have this code `@[5, 7, 1, 2].sort(proc (x: int, y: int): int = cmp(x, y))` |
16:41:37 | dgellow | And I'm getting this error: |
16:41:37 | dgellow | "Error: type mismatch: got (seq[int], proc (x: int, y: int): int{.gcsafe, locks: 0.}) |
16:41:37 | dgellow | but expected one of: |
16:41:37 | dgellow | algorithm.sort(a: var openarray[T], cmp: proc (x: T, y: T): int{.closure.}, order: SortOrder)" |
16:42:05 | dgellow | I don't understand what I'm doing wrong |
16:44:44 | def- | dgellow: it's not var, it's a let |
16:45:05 | def- | what you pass to sort has to be mutable |
16:45:08 | def- | otherwise use sorted |
16:45:15 | dgellow | ah thank you ! |
16:45:44 | dgellow | yeah, it works with sorted. |
16:46:03 | dgellow | thank you def-. |
16:46:43 | * | yglukhov__ joined #nim |
16:46:45 | apense | Is there a reason why `echo 42'i` doesn't work like `42'f` and `42'u` do? |
16:47:18 | def- | import unsigned? |
16:47:23 | def- | ah wait |
16:47:25 | def- | misread |
16:47:53 | def- | it's i by default i guess |
16:48:15 | apense | yeah I guess that's it |
16:48:26 | apense | there's no reason to have it. just curious |
16:49:12 | apense | another question: anyone have any timeline for float128 support? |
16:52:48 | * | dgellow left #nim (#nim) |
16:54:52 | unclechu | hi there, i'm newbie in nim. i'm trying to start with example from nim-lang.org (simple http server) |
16:54:52 | unclechu | i builded nim from sources and trying to build this example: 'nim c -r test.nim' |
16:54:52 | unclechu | but i've got error: "test1.nim(3, 3) Error: cannot open 'jester'" |
16:54:58 | unclechu | how i can get this package? |
16:56:29 | def- | unclechu: use nimble and "nimble install jester" |
16:56:51 | def- | apense: you can do it yourself like this: https://bitbucket.org/behrends/nimlongint |
16:57:17 | unclechu | def-: i need build it, right? https://github.com/nim-lang/nimble |
16:57:31 | def- | unclechu: if you're on windows, there are binaries i think |
16:57:40 | def- | otherwise build it, yes |
16:57:47 | unclechu | def-: okay, i need build it |
16:58:31 | apense | def-, thanks. I've done something like that before. just wondering when the nkFloat128Lit parts of the compiler will become more than placeholders |
17:00:31 | apense | dumpTree: |
17:00:31 | apense | 42.0'f128 gives Float128Lit. it's discussed in the lexer |
17:01:13 | apense | against, just curious. I'm guessing computationally precise libraries can use it in the future. don't think anything needs it now, though |
17:01:17 | apense | *again |
17:08:11 | * | brson joined #nim |
17:12:31 | * | elbow_jason joined #nim |
17:16:07 | r-ku | Araq: 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:08 | r-ku | have? 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:48 | Araq | r-ku: ah yeah, you need to set the stack frame after a yield |
17:28:00 | Araq | or disable it with --stackTrace:off |
17:28:59 | r-ku | haha indeed it worked |
17:29:04 | r-ku | can you explain that stack frame stuff? |
17:29:21 | r-ku | how i set it? where do i get it? |
17:29:33 | Araq | I don't think there is an API :P |
17:30:36 | * | gmpreussner|work quit (Ping timeout: 244 seconds) |
17:30:49 | r-ku | alrighty, will have to ignore it for now then |
17:30:56 | * | gmpreussner|work joined #nim |
17:30:58 | Araq | no |
17:31:07 | Araq | look into lib/system/excpt.nim |
17:31:19 | Araq | proc setFrame(s: PFrame) {.compilerRtl, inl.} = |
17:31:21 | Araq | framePtr = s |
17:31:51 | Araq | too 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:44 | Araq | or do you? :P |
17:34:03 | Araq | proc resetFrame() = |
17:34:49 | Araq | {.emit: "setFrame(&FR);".} |
17:35:24 | Araq | you need to enclose this in a {.push stackFrame: off.} ... {.pop.} combo though for obvious reasons |
17:35:34 | * | raza left #nim (#nim) |
17:35:55 | r-ku | obvious to you right? i have no idea why im supposed to do this here :D |
17:36:04 | Araq | the 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:17 | Araq | it's better to importc the FR though and not use .emit for this |
17:37:33 | Araq | this 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:22 | Araq | r-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:33 | r-ku | Araq: 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:00 | Araq | yeah but actually since FR is a local variable it's a tad more complex |
18:13:43 | r-ku | ehh by FR i actually meant framePtr from excpt.nim |
18:17:11 | r-ku | anyway will have to return to this tomorrow. head no workie any more. time for rest. gn crowd |
18:18:20 | unclechu | there's any recommended vim-syntax plugin for vim? |
18:19:19 | federico3 | unclechu: nim.vim |
18:19:43 | unclechu | federico3: http://vimawesome.com/plugin/nimrod-vim this one? |
18:19:53 | reactormonk | unclechu, https://github.com/zah/nim.vim |
18:20:08 | reactormonk | unclechu, 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:45 | unclechu | reactormonk: it's too early to choose dark side) may be later |
18:23:23 | federico3 | ok, soo... how difficult it is to wrap a C library in Nim? |
18:23:48 | reactormonk | federico3, you run c2nim and clean up the fallout |
18:24:31 | federico3 | you make it sound easy |
18:24:53 | reactormonk | That's the idea ;-) |
18:25:26 | federico3 | nimble install c2nim failed already :D |
18:25:52 | reactormonk | dom96, ^ time to sort things out |
18:26:34 | dom96 | hrm |
18:26:41 | dom96 | how does it fail? |
18:27:11 | reactormonk | Are there explosions? :3 |
18:28:16 | federico3 | looks like nible is cloning c2nim and then <gh>/Araq/Nim.git (why?) |
18:28:35 | reactormonk | Because it needs the compiler sources to generate the code |
18:29:05 | federico3 | can 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:36 | federico3 | it then starts the build and fails with: compiler-0.11.3/compiler/options.nim(304, 7) Error: undeclared identifier: 'writeLine' |
18:29:38 | reactormonk | it should redirect |
18:32:07 | federico3 | same error with nim c c2nim.nim from a local c2nim repo - looks like it's unrelated to nimble |
18:33:00 | Arrrr | It is possible to make a seq of types? (seq[typedesc]) |
18:34:13 | EXetoC | something exploded? what happened? |
18:34:28 | reactormonk | Arrrr, why not |
18:34:48 | Arrrr | because the compiler throws me errors |
18:34:51 | EXetoC | cus unpredictable magic |
18:35:08 | * | mytrile joined #nim |
18:37:39 | * | xcombelle quit (Remote host closed the connection) |
18:38:10 | EXetoC | varargs[typedesc]? I know there's some special behavior for varargs[expr] that's all |
18:40:35 | * | mytrile quit (Quit: mytrile) |
18:41:01 | Arrrr | Maybe im doing something wrong ... http://pastebin.com/e2kLxnCz |
18:41:23 | EXetoC | will varargs be used for all these occasions? |
18:42:40 | * | xificurC quit (Read error: Connection reset by peer) |
18:43:05 | Araq | Arrrr: typedesc has no runtime representation whatsoever |
18:43:14 | EXetoC | Arrrr: yeah, you can't do that, and this triggers an internal error which implies a bug |
18:43:15 | * | xificurC joined #nim |
18:43:49 | Araq | federico3: c2nim works for me but maybe cause nimble keeps my old compiler package around |
18:44:08 | Araq | in fact, the new c2nim is so awesome that no tweaking of the generated Nim code is required anymore :-) |
18:44:11 | EXetoC | variants can be used for this, to some extent, but you must specify the valid types in advance |
18:44:29 | Araq | EXetoC: or you use seq[RootRef] |
18:44:41 | Arrrr | pff, well, maybe with the help of templates .. |
18:45:15 | EXetoC | right. runtime polymorphism might make more sense |
18:46:11 | Araq | Arrrr: usually I just use Json instead of re-inventing Json |
18:46:46 | * | gyeates joined #nim |
18:47:17 | Araq | it'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:35 | Arrrr | I dont need to store data, but heterogeneous behaviours (procs). |
18:50:52 | Arrrr | Like, a list of procs which accept different types of args |
18:52:37 | Araq | that's a list of closures then |
18:53:15 | * | mytrile joined #nim |
18:53:36 | Araq | in the closure's environments you can hide the different (heterogeneous) type requirements |
18:56:32 | * | mytrile quit (Client Quit) |
18:56:45 | Arrrr | i want to achieve this in nim http://bit.ly/1gmbD0S |
18:59:49 | Araq | aye Eric Lippert. |
19:01:13 | EXetoC | I think many variant conveniences can be implemented in userland |
19:03:11 | EXetoC | btw, could you access the type AST before the addition of getType? perhaps I would need that |
19:03:33 | Araq | Arrrr: so you have a list of rules? I don't see any difficulties |
19:04:10 | Araq | EXetoC: no, instead it was tried to patch this problem with ever more typedesc voodoo hacks |
19:04:36 | Araq | typetraits.nim ... bah |
19:04:47 | EXetoC | ok |
19:05:04 | Arrrr | The 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:10 | Arrrr | *i dont want to |
19:06:51 | Araq | seq[proc (actorA, actorB: ref Base): bool] |
19:07:10 | * | jszymanski quit (Read error: Connection reset by peer) |
19:07:19 | Araq | proc wizardCanHoldASword(actorA, actorB: ref Base): bool = |
19:08:01 | Araq | ensure actorA of Wizard, actorB of Weapon: |
19:08:09 | * | jszymanski joined #nim |
19:08:37 | Araq | result = actorA.isMale # male wizards can hold any weapon |
19:09:11 | Arrrr | yeah, but in that seq i want also to have procs of type wizardCanEat(EatEvent) and wizardCanWalk(WalkSurface) for example |
19:09:25 | Arrrr | in your example i'd have to define like 3 separate seqs |
19:09:45 | Araq | no, but you need a common Base |
19:09:49 | Arrrr | i'd like a way to iterate over one seq and ask every proc if it can accept certain kind of event |
19:10:17 | EXetoC | auto-generated "variant = 1" shortcuts for example |
19:10:26 | EXetoC | or something else if it's considered too error prone |
19:10:43 | Arrrr | i dont mind as long as it is not a pain in the ass |
19:11:45 | Araq | well in my example I have a Base class and then an 'ensure' which does the runtime type checking and conversions |
19:12:33 | Araq | I can imagine lots of different sugar but under the hood you want to disable the type system |
19:12:53 | Arrrr | The example of the blog may not the best, i'll write some pseudocode for what i need |
19:13:15 | Araq | which can be done via 'case objects' or inheritance or via closures or via unsafe low level pointer hacking |
19:15:54 | Arrrr | http://pastebin.com/pEyCAUQQ |
19:16:52 | Arrrr | onX are instances of Die | Eat |
19:17:37 | EXetoC | have you used entity component systems yet? |
19:17:57 | Arrrr | Yes, but this is more convenient. |
19:18:08 | EXetoC | ok |
19:18:17 | Arrrr | More flexible, can be used with ES |
19:19:14 | EXetoC | I found it a little tricky to come up with a design, but it's very convenient |
19:19:59 | EXetoC | it just comes with a slight overhead, I think |
19:20:34 | federico3 | WTF? 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:46 | Araq | Arrrr: I don't get it. ;-) |
19:33:19 | Arrrr | well, 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:06 | Arrrr | it is mostly the same example with a little more detail http://pastebin.com/CaEBmCya |
19:44:20 | Arrrr | I have done it in java, but it is ugly as ... well, java |
19:47:51 | Araq | well sorry but the solution I gave is still valid |
19:49:40 | Arrrr | Yes, 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:36 | Araq | I'd just make the events an enum and case on them |
19:51:44 | Araq | usually you need a state machine for these things anyway or use a scripting layer |
19:51:52 | Araq | *or even use |
19:52:28 | Araq | the "is unit X allowed to do that" problem is a fraction of the real problem |
19:53:21 | Araq | the 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:55 | Arrrr | Yes, 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:32 | Arrrr | and when it tries to undress its clothes, it would dispatch the 'onUnDressCancel' callback |
19:56:52 | Arrrr | i can add/remove events like you could add/remove items from a list |
19:57:49 | Arrrr | Events 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:38 | Arrrr | And with a heterogeneous list, i dont event have to know on rumtime which kind of events an actor can react to |
19:58:43 | Arrrr | *even |
19:59:03 | Araq | but 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:05 | Araq | perhaps you want to attach a "isPossible" callback to the State |
20:00:14 | EXetoC | Araq: "scripting" with nim would be neat, in a way that is safer than loading dynamic libraries |
20:00:19 | EXetoC | would it be necessary to use the vm? |
20:01:51 | * | Matthias247 joined #nim |
20:02:07 | * | unclechu joined #nim |
20:03:13 | Araq | EXetoC: 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:19 | EXetoC | or maybe there's OS magic for this, but taking that route would be difficult |
20:04:08 | * | yglukhov__ joined #nim |
20:07:20 | Arrrr | It is possible to retrieve the address of a proc? |
20:07:59 | Araq | Arrrr: just use foo instead foo() |
20:09:46 | Arrrr | i cannot write a: seq[pointer]; add a, foo |
20:10:09 | EXetoC | Araq: safe as in sandboxed plugins |
20:10:10 | Araq | add a, cast[pointer](foo) |
20:10:14 | EXetoC | ok well I'll think about this |
20:11:52 | Arrrr | but i cannot cast it back to proc() |
20:12:01 | Arrrr | it gives me strange c errors |
20:13:41 | Araq | Arrrr: cast to proc () {.nimcall.} |
20:14:27 | Arrrr | Oh yeah, that was it. Thank you araq |
20:14:40 | Arrrr | i'll try to program a working example of my intentions |
20:23:10 | EXetoC | the 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:32 | Araq | hrm? we expose a (shitty) API to the VM |
20:24:12 | Araq | http://forum.nim-lang.org/t/1319#8265 |
20:25:18 | EXetoC | ok |
20:26:49 | * | unclechu quit (Ping timeout: 256 seconds) |
20:26:58 | * | ozra joined #nim |
20:27:38 | Arrrr | works pretty well http://pastebin.com/FdL8hiie i need to learn how macro stuff works |
20:27:41 | Arrrr | until 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:11 | Araq | wb zahary |