00:01:41 | * | Trustable quit (Remote host closed the connection) |
00:17:04 | * | pregressive quit (Remote host closed the connection) |
00:18:29 | * | pregressive joined #nim |
00:25:08 | * | xet7 quit (Read error: Connection reset by peer) |
01:03:29 | * | pregressive quit (Remote host closed the connection) |
01:26:20 | * | notfowl is now known as fowl |
01:28:49 | * | strcmp3 joined #nim |
01:31:27 | * | strcmp2 quit (Ping timeout: 255 seconds) |
01:32:47 | * | MyMind joined #nim |
01:34:06 | * | Sembei quit (Ping timeout: 240 seconds) |
01:41:26 | * | strcmp3 quit (Quit: Leaving) |
02:03:28 | * | brson quit (Quit: leaving) |
02:41:41 | * | darkf joined #nim |
03:25:35 | * | gunn quit (Quit: Textual IRC Client: www.textualapp.com) |
03:26:20 | * | gunn joined #nim |
03:27:40 | * | grumbly joined #nim |
03:31:34 | * | grumbly quit (Client Quit) |
04:16:35 | * | mal`` quit (K-Lined) |
04:19:29 | * | mal`` joined #nim |
04:54:44 | * | strcmp1 joined #nim |
05:11:48 | * | filcuc joined #nim |
05:20:39 | * | filcuc quit (Quit: Konversation terminated!) |
05:43:53 | * | jszymanski joined #nim |
05:57:12 | * | Demon_Fox quit (Quit: Leaving) |
06:09:43 | * | Jesin quit (Quit: Leaving) |
06:19:51 | * | Pisuke joined #nim |
06:21:47 | * | MyMind quit (Ping timeout: 265 seconds) |
06:39:58 | * | Gonzih joined #nim |
06:40:31 | * | profan quit (Remote host closed the connection) |
08:02:41 | * | Gonzih quit (Quit: IRC is just multiplayer vim.) |
08:05:19 | * | coffeepot joined #nim |
08:10:00 | * | NimBot joined #nim |
08:10:54 | * | VPashkov joined #nim |
08:15:29 | * | alpaca joined #nim |
08:21:03 | * | Notification joined #nim |
08:21:16 | Notification | I noticed in the benchmarks that nim uses lots of ram compared to other languages. nim 874.4mb [clang] 913.0mb [gcc] compared to others c++ 174.5mb c# mono 270.0mb python 724.0mb go 424.9mb. nim sometimes uses even more ram than java. why is it that nim uses so much ram compared to the others? |
08:22:46 | * | yglukhov joined #nim |
08:27:20 | def- | Notification: what benchmark? |
08:27:57 | Notification | https://github.com/kostya/benchmarks |
08:30:28 | def- | for brainfuck has the lowest memory usage, for mandelbrot as well, base64 looks a bit high, but ok, json is pretty high, but that's because the nim implementation for that problem does much more than asked for (we need a lower level json lib). matmul and havlak look a bit high too, would have to look into the implementations |
08:30:50 | * | alpaca quit (Ping timeout: 245 seconds) |
08:37:09 | * | Trustable joined #nim |
08:39:37 | def- | Notification: maybe it's because of alignment of small refs |
08:41:11 | * | BitPuffin|osx quit (Ping timeout: 250 seconds) |
08:46:40 | * | Gonzih joined #nim |
08:47:32 | * | Gonzih quit (Client Quit) |
08:50:06 | * | Notification quit (Remote host closed the connection) |
08:53:45 | yglukhov | Hi all. How do we call "default" copy from within an overriden one? |
08:58:38 | yglukhov | e.g. in my `=` proc i want to do what normaly `=` does, plus some magic. If i call `=` from `=` i obviously get a recursion. |
08:58:49 | def- | yglukhov: system.`=`? |
08:59:05 | def- | system.`=`(foo, bar) |
08:59:12 | yglukhov | nope |
08:59:19 | yglukhov | Error: undeclared identifier: '=' |
09:01:28 | def- | shallowCopy? |
09:01:31 | * | xet7 joined #nim |
09:02:05 | def- | hm, no |
09:04:36 | def- | I guess you can define proc oldAssign(x: var Foo, y: Foo) = x = y before you create your custom `=` proc, but that seems more like a workaround |
09:06:28 | yglukhov | Hmm, some time ago Araq thought of relaxing forward declaration requirements =) |
09:06:38 | def- | yeah, that would obviously break it |
09:06:54 | def- | and I'd also prefer a way to access the default assignment operator, builtin |
09:07:52 | yglukhov | I guess, we could figure out a macro that does that. But it seems to it's gonna be a sophisticated one... |
09:08:23 | * | magistr joined #nim |
09:08:49 | yglukhov | E.g. for aggreagtes, it copies field-by-field. |
09:09:15 | yglukhov | For non-aggregate disticts it casts to base type. |
09:09:30 | def- | Heh, Notification found a memory leak, nice |
09:09:33 | def- | in the standard gc |
09:09:51 | magistr | nim supports alegebraic data types? |
09:10:16 | def- | magistr: not exactly, but object variants have some advantages and some disadvantages |
09:11:00 | magistr | def-, dependent typs programming? |
09:11:08 | magistr | types* |
09:11:27 | def- | magistr: and you can write a macro that converts ADTs into object variants |
09:11:36 | def- | See here: http://forum.nim-lang.org/t/904 |
09:12:54 | def- | magistr: i think we have some restricted kind of dependent types with static, range and compile-time sized arrays |
09:13:30 | def- | you can say that you get two arrays of size M and N and return one of size M+N for example, i think |
09:13:56 | def- | (maybe i misremember) |
09:26:02 | * | wuehlmaus quit (Quit: Lost terminal) |
09:37:36 | Araq | yeah we need to make system.`=` work |
09:37:45 | Araq | it's the obvious thing |
09:38:25 | def- | In case Notfication comes back later, here's the memory leak issue: https://github.com/nim-lang/Nim/issues/3184 |
09:39:46 | Araq | usually these things are codegen bugs |
09:40:11 | Araq | some pointer doesn't get the proper write barrier in the codegen |
09:48:05 | Araq | strange benchmark though, screams "slow!" everywhere |
09:53:02 | def- | Araq: indeed, but it's written in a similar way in all the other languages and they're not faster either |
10:00:56 | Araq | does clang use the CPATH env var? |
10:04:30 | def- | yes |
10:04:56 | Araq | I finally got the point of env vars ;-) |
10:05:28 | Araq | it's so that you can still do something when the compiler invocation is hidden by a layer of 4 scripts |
10:24:25 | yglukhov | Wow, so now defer gets "exported" to outer scope of template!? |
10:26:16 | yglukhov | More ways to do more magic! Hehe :) |
10:27:57 | * | ozra joined #nim |
10:32:22 | Araq | destructors are implemented by 'defer' statement injection |
10:32:42 | Araq | and the defer statement is rewritten to 'try' now in a later pass |
10:32:48 | Araq | where we do scope merging |
10:33:03 | yglukhov | Ahh, right, and destructors need to be called outside of the template.. |
10:33:53 | Araq | I'm not really that happy with this solution, but it's much better than what we used to do |
10:34:35 | yglukhov | I know it's more implicit, but it gives more power |
10:34:43 | yglukhov | along with responsibility =) |
10:35:16 | yglukhov | Are you still against destructors in global scope? |
10:35:40 | Araq | yes |
10:36:40 | * | Pisuke quit (Ping timeout: 245 seconds) |
10:38:35 | yglukhov | Alright, here's a usecase. You use a third-party type in global scope. Then third-party adds caching-and-flusing to it, thus a destructor. Suddenly, your code behaves oddly. |
10:39:17 | Araq | adding a destructor after the fact is already a breaking change |
10:39:31 | Araq | remember that we have the notion of a "destructible context" |
10:40:57 | yglukhov | err.. "breaking change" - why? It's implementation details. The interface doesn't change. |
10:41:36 | yglukhov | "destructible context" - i thought this term was used before Nim got a fully-featured RAII support? |
10:42:05 | Araq | we still haven't got "fully-featured RAII" |
10:42:27 | Araq | the "destructible context" still exists |
10:45:01 | Araq | (and it still not obvious to me whether that's a good design or a bug) |
10:45:17 | yglukhov | could you give me a hint please? |
10:45:32 | yglukhov | the case, when RAII doesnt work? |
10:46:50 | * | Pisuke joined #nim |
10:48:07 | Araq | someCall(somethingThatConstructsT) |
10:48:50 | yglukhov | works for me |
10:50:01 | yglukhov | https://gist.github.com/yglukhov/4c200e3299863a9e5fe7#file-raii-nim-L37 |
10:57:34 | baabelfish | I was wondering if using statement could have a scope like "using x:\n add(5)" that would be the same as "block:\n using x\n add(5)" |
10:58:38 | yglukhov | I guess you can test it with a defer stmt ;) |
10:59:35 | yglukhov | Or even simpler, define a var inside using and see if it's visible later |
11:00:21 | baabelfish | I was just thinking if it could be a language feature... not that important of course :D |
11:01:05 | * | xcombelle joined #nim |
11:11:18 | * | dalarmmst quit (Ping timeout: 265 seconds) |
11:13:08 | yglukhov | Ahh, ok, sorry. |
11:28:22 | * | dalarmmst joined #nim |
11:33:20 | yglukhov | Araq, so, did I miss anything in my example? Just tested passing by var, and it works as well. |
11:34:05 | Araq | var v1 = newA(1) # ok, destructible context |
11:34:17 | Araq | foo(newA(1)) # not ok, not destructible context |
11:34:44 | Araq | the compiler produces a "warning", but isn't consequent about it either |
11:35:15 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
11:37:20 | yglukhov | ok, funny thing. testA(newA(1)) produces no warning. Moreover, destructor gets called as it should. |
11:38:19 | yglukhov | however, proc(a: var A) = a = newA(1) # does produce a warning, but still assignment and destructor get called as they should. |
11:38:46 | yglukhov | * proc testByRef(a: var A) = a = newA(1) |
11:41:30 | yglukhov | oh, sorry, first case doesn't call destructor. |
11:42:14 | yglukhov | but gives no warning. |
11:43:20 | * | coffeepot joined #nim |
11:46:59 | * | pregressive joined #nim |
11:47:31 | yglukhov | so "testA(newA(1))" should be rewritten to smth like "block: let tmp = newA(1); testA(tmp)", right? |
11:47:41 | Araq | right |
11:48:06 | Araq | but not for the C++ target once we map Nim's destructors to C++ destructors ... |
11:49:43 | yglukhov | Is it possible to map them? I mean, that requires Nim types to be mapped to cpp structs/classes? |
11:50:13 | Araq | the compiler does that since the beginning of time |
11:50:17 | yglukhov | even the distinct ints? |
11:50:36 | yglukhov | distinct pointers? |
11:50:45 | Araq | distinct T is just mapped to T |
11:51:23 | yglukhov | but distinct can have it's own destructor? |
11:53:01 | yglukhov | just tested it, and it can =) |
12:04:44 | yglukhov | So you would need to wrap every distinct type in a cpp struct/class. |
12:05:03 | yglukhov | btw, what's the benefit of mapping Nim's destructors to cpp? |
12:17:44 | * | BitPuffin|osx joined #nim |
12:26:40 | * | strcmp1 quit (Ping timeout: 246 seconds) |
12:27:01 | Araq | much better C++ interop |
12:34:19 | * | eedee joined #nim |
12:43:16 | * | grumbly joined #nim |
12:48:31 | grumbly | What am I missing if I have to add 'extern "C" { mydef()... }' around the function definitions I want exported in the generated header? I'm using pragmas {.exportc, cdecl.} already. |
12:50:12 | Araq | you can use .codegenDecl to generate extern "C" but I would just wrap the generated header in some other file with extern "C" around it |
12:51:45 | * | pregressive quit (Remote host closed the connection) |
12:56:24 | grumbly | Oh, good thinking. I'll try that. |
13:15:19 | * | grumbly quit (Quit: Page closed) |
13:29:32 | * | doxavore joined #nim |
13:34:55 | * | Amrykid2 joined #nim |
13:44:29 | yglukhov | Putting defer at the end of block leads to ICE. internal error: expr(nkDefer); unknown node kind |
14:06:25 | * | pregressive joined #nim |
14:10:20 | * | pregressive quit (Remote host closed the connection) |
14:10:34 | * | pregressive joined #nim |
14:21:49 | * | Amrykid2 quit (Ping timeout: 246 seconds) |
14:41:51 | * | xet7 quit (Quit: Leaving) |
14:58:33 | * | FedeOmoto joined #nim |
15:09:15 | * | Demos joined #nim |
15:10:43 | * | Ven joined #nim |
15:13:42 | * | linkmonitor joined #nim |
15:17:51 | coffeepot | what license do most ppl use when setting up nim libraries, MIT? |
15:18:53 | * | wuehlmaus joined #nim |
15:25:57 | * | eedee quit (Quit: Page closed) |
15:29:15 | Demos | yeah usually MIT |
15:29:24 | Demos | or whatever the library I'm wrapping uses |
15:29:30 | Demos | if It's a C library |
15:30:34 | coffeepot | ok nice one :) |
15:30:46 | coffeepot | cheers |
15:35:25 | * | brson joined #nim |
15:43:50 | * | xet7 joined #nim |
15:47:19 | * | Demos quit (Remote host closed the connection) |
15:47:57 | * | Demos joined #nim |
15:48:33 | * | jszymanski quit (Quit: computer sleeps...) |
16:00:08 | * | eedee joined #nim |
16:05:33 | eedee | Hello? |
16:05:46 | eedee | Anyone here that could help me with one problem |
16:07:50 | def- | eedee: hello, just post the problem |
16:08:11 | def- | (if it's multiple lines of code, to gist or pastebin) |
16:08:19 | eedee | Yea i played with async sockets and threads, so http://pastebin.com/2PnaqNE8 |
16:08:27 | * | FedeOmoto quit (Ping timeout: 252 seconds) |
16:08:28 | eedee | when -d:release on it crashes |
16:08:37 | eedee | but without that ti doesn't |
16:09:13 | def- | async might just not work with threads yet, I'm not sure, but I think there was work going into that direction |
16:09:35 | eedee | Yea but without -d:release it works fine up to 40k sockets |
16:09:51 | eedee | with -d:release on it crashes before 1k |
16:10:42 | eedee | But thats cool, when will nim go into that direction? |
16:11:12 | * | kilon joined #nim |
16:15:46 | def- | eedee: how can i check that it crashes? |
16:16:25 | eedee | Well, windows will just pop up the messagebox saying "*.exe has stopped working" |
16:16:40 | def- | eedee: yeah, but how do i create 1k sockets for this? |
16:16:42 | def- | or how do you? |
16:16:44 | eedee | aaa |
16:16:49 | eedee | i just made a tool |
16:16:53 | eedee | with nim |
16:16:55 | eedee | for that |
16:16:57 | def- | also, line 67 should be "var client = newSocket()", it's not compiling on devel branch right now |
16:16:58 | eedee | let me paste it |
16:17:18 | eedee | ok |
16:18:03 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
16:18:03 | def- | you could also check if it's fixed with the devel branch |
16:18:33 | eedee | Alright, i do that |
16:18:34 | eedee | http://pastebin.com/k18RC2Y5 |
16:18:37 | eedee | here is the tester |
16:19:55 | * | doxavore quit (Quit: I said good day, sir.) |
16:20:22 | def- | well, on linux the client as well as the server crash with too many connections |
16:20:23 | * | FedeOmoto joined #nim |
16:20:30 | def- | Client: Error: unhandled exception: Bad file descriptor [Exception] |
16:20:36 | def- | Server: Error: unhandled exception: Too many open files [OSError] |
16:20:55 | eedee | how many connections? |
16:20:59 | def- | 500 |
16:21:10 | eedee | weird i can do like 40k |
16:21:15 | eedee | on win tho |
16:21:48 | * | Ven quit (Read error: No route to host) |
16:22:48 | eedee | acutally |
16:23:10 | eedee | it wont error on -d:release on if i don't ever recv from the socket. |
16:25:26 | eedee | or it will.. |
16:27:03 | * | linkmonitor quit (Ping timeout: 246 seconds) |
16:29:52 | * | jszymanski joined #nim |
16:37:37 | * | linkmonitor joined #nim |
16:42:00 | * | yglukhov_ joined #nim |
16:42:46 | * | eedee quit (Quit: Page closed) |
16:44:58 | * | yglukhov quit (Ping timeout: 246 seconds) |
16:44:59 | * | eedee joined #nim |
16:45:49 | eedee | Finally some message from -d:release on "Illegal storage acces. (Attempt to read from nil?) |
16:46:30 | * | yglukhov_ quit (Ping timeout: 260 seconds) |
16:48:16 | baabelfish | eedee: tried with a debugger? |
16:48:50 | eedee | hm? |
16:49:01 | eedee | with out -d:release it wont crash |
16:49:03 | baabelfish | to get more information about the crash |
16:49:05 | baabelfish | ah |
16:49:27 | eedee | http://pastebin.com/QpD10vLZ |
16:49:34 | eedee | wrong one |
16:50:05 | eedee | http://pastebin.com/2PnaqNE8 |
17:05:25 | * | Morfus joined #nim |
17:10:23 | * | Morfus left #nim ("Leaving") |
17:20:47 | * | darkf quit (Quit: Leaving) |
17:33:18 | * | yglukhov joined #nim |
17:38:52 | * | coffeepot joined #nim |
17:39:07 | * | coffeepot quit (Client Quit) |
17:39:22 | * | coffeepot joined #nim |
17:39:56 | coffeepot | hi guys, is there a way I can display an expansion of a template? |
17:41:50 | * | UberLambda joined #nim |
17:58:03 | dom96 | coffeepot: try a high verbosity value when compiling like --verbosity:5 |
17:58:33 | eedee | dom |
17:58:36 | eedee | do u know the problem? |
17:59:28 | eedee | http://pastebin.com/2PnaqNE8 works fine with no -d:release on. Its a async server with threads. |
18:00:03 | eedee | normally +50k socks but when -d:release crashes before 1k |
18:00:11 | * | Jesin joined #nim |
18:00:44 | dom96 | eedee: why are you mixing blocking sockets with asyncdispatch? |
18:00:59 | eedee | Well they are not blocking eachother. |
18:01:21 | eedee | client.getFd().setBlocking(false) if take this then it blocks |
18:01:32 | dom96 | Why are you using TAsyncFd instead of AsyncSocket? |
18:01:42 | dom96 | The asyncnet module does that for you |
18:01:54 | eedee | yea but i wanted it to use all cpu cores like now |
18:02:23 | * | eventualbuddha quit (Quit: Connection closed for inactivity) |
18:02:30 | dom96 | asyncnet doesn't disallow that |
18:02:39 | * | Demos_ joined #nim |
18:02:42 | eedee | o |
18:02:47 | dom96 | but in regards to your problem: I don't know. |
18:02:48 | eedee | Would that fix the problem? |
18:02:51 | eedee | oh |
18:03:01 | * | Demos_ quit (Read error: Connection reset by peer) |
18:03:05 | eedee | with -d:release -checks:on it works tho |
18:03:21 | dom96 | It might be worth a try |
18:03:53 | eedee | i'l try that then :d |
18:03:59 | dom96 | Why does `run` not have the {.thread.} pragma? |
18:04:19 | * | Demos_ joined #nim |
18:04:21 | dom96 | i'm surprised that even works without that pragma |
18:06:14 | * | Eedee2 joined #nim |
18:06:16 | * | Demos quit (Ping timeout: 246 seconds) |
18:06:49 | Eedee2 | Whoops connected 100k socks qnd it freezed my computer |
18:07:30 | Eedee2 | Yea it works fine unless you turn --checks off |
18:08:12 | * | eedee quit (Ping timeout: 246 seconds) |
18:09:33 | * | eedee joined #nim |
18:10:28 | * | Arrrr joined #nim |
18:13:55 | dom96 | Eedee2: try using --debugInfo --lineDir:on --checks:off and then gdb |
18:14:47 | eedee | will do, let see what happens |
18:17:53 | eedee | dom96: Won't crash :d |
18:18:00 | * | Eedee2 quit (Ping timeout: 246 seconds) |
18:21:02 | eedee | ah now it did |
18:25:16 | * | Jesin quit (Quit: Leaving) |
18:26:44 | * | strcmp1 joined #nim |
18:27:28 | eedee | Newcode:http://pastebin.com/4VyYTAPE and error:http://pastebin.com/6CL9uv7T |
18:29:13 | eedee | yea could try with devel |
18:32:33 | * | brson quit (Ping timeout: 252 seconds) |
18:35:41 | dom96 | eedee: try with --useGcAssert |
18:36:11 | dom96 | and --useSysAssert |
18:36:53 | eedee | with -d:release ? |
18:37:44 | dom96 | er sorry, -d:useGcAssert and -d:useSysAssert |
18:37:45 | dom96 | nah |
18:37:47 | dom96 | well |
18:37:53 | dom96 | I guess you can try it with -d:release |
18:37:55 | * | UberLambda quit (Ping timeout: 245 seconds) |
18:37:59 | dom96 | or just --checks:off |
18:43:26 | eedee | useSysAssert made it use all of CPU but took longer time to crash, the error happens always on the await sock.recv(1023)[nameOfTheFile.nim(24) HandleSocketIter], im spamming it with 10k sockets that spam packets |
18:44:59 | coffeepot | dom96, cheers I'll try that :) |
18:46:34 | Araq | yglukhov: can you try to fix the 'defer' regression? |
18:46:43 | eedee | and yea there is small chance with -d:release on to say it "Attempt to read from nil" |
18:47:13 | * | unclechu joined #nim |
18:47:25 | dom96 | eedee: Do you see any 'assert' messages? |
18:47:41 | Araq | eedee: async doesn't work with threading yet, not sure why you insist on using it |
18:48:16 | eedee | Tho Araq it works fine with --checks:on like to 50k sockets |
18:48:27 | eedee | dom96: let me check |
18:48:31 | Araq | nah, you're just lucky |
18:48:47 | dom96 | Araq is correct though |
18:48:56 | eedee | no assets |
18:49:04 | eedee | lol yea maybe lucky |
18:49:26 | eedee | still works somehow with those channels |
18:51:03 | * | brson joined #nim |
18:51:39 | * | brson quit (Read error: Connection reset by peer) |
18:52:02 | * | brson joined #nim |
18:52:45 | eedee | Araq: http://s27.postimg.org/d9r2zxylv/works_fine.png |
18:52:46 | eedee | http://pastebin.com/Euxpnwxk |
18:55:45 | Arrrr | Is it noReturn actually necessary? |
19:02:15 | Araq | Arrrr: no, it's not |
19:02:37 | Araq | eedee: check out gokr's spawn based server |
19:02:52 | eedee | Araq: where can i find that? |
19:08:35 | dom96 | http://goran.krampe.se/2014/10/25/nim-socketserver/ |
19:08:39 | * | Jesin joined #nim |
19:11:49 | eedee | ty |
19:13:04 | * | Sahnvour joined #nim |
19:13:43 | Arrrr | then what does noreturn do |
19:20:34 | * | filcuc joined #nim |
19:20:49 | yglukhov | Araq, here's the first try: https://github.com/nim-lang/Nim/pull/3188 |
19:20:53 | coffeepot | --verbosity:5 doesn't seem to show me what I'm after, is there a way I can pass a template to getAst or toStrLit to list the code that is generated? I noticed in http://forum.nim-lang.org/t/1396 they're mentioned but I can't work out how to fit them into a template |
19:21:14 | Araq | Arrrr: it makes you feel better |
19:21:58 | Araq | yglukhov: that's not the bug I meant, but ok, that's good too |
19:22:08 | NimBot | nim-lang/Nim devel 41a2a9f Yuriy Glukhov [+0 ±1 -0]: Fixes #3185 |
19:22:08 | NimBot | nim-lang/Nim devel da4b0d9 Andreas Rumpf [+0 ±1 -0]: Merge pull request #3188 from yglukhov/fix-3185... 2 more lines |
19:22:54 | yglukhov | Did you mean the defer-at-the-end one? |
19:23:06 | Arrrr | So, it is placebo effect for programmers, now i have seen everything |
19:23:59 | Araq | yup |
19:24:37 | yglukhov | Why would anyone want to place a defer at the end? %) |
19:24:52 | yglukhov | ok, looking into it. |
19:25:24 | * | eedee2 joined #nim |
19:25:51 | * | NimBot joined #nim |
19:26:36 | * | eedee quit (Ping timeout: 246 seconds) |
19:30:02 | Araq | also you could look into the typedesc regression |
19:30:12 | coffeepot | if it helps, here's what I'm trying to cobble together atm https://gist.github.com/coffeepots/b1758d3d96a5bdaab6b6 I thought it'd be cool to try and do the tree traversal as a template, but it's not working. Thought if I could print out the generated query proc maybe it might be easier to see what's going on |
19:31:42 | coffeepot | I realised i don't know wtf I'm doing lol XD |
19:31:48 | Araq | yup |
19:31:51 | * | eedee2 quit (Ping timeout: 246 seconds) |
19:32:02 | Araq | sorry, but yeah, your template is horrible |
19:32:24 | coffeepot | that's cool, it's my first and it was trial and.. error :) |
19:32:58 | Araq | for a start, never ever do foo as both template parameter and proc parameter |
19:33:46 | Araq | the compiler could allow it but it's not a compatible change and I dunno what it would break |
19:34:40 | coffeepot | yes I did pop out a few compiler bugs because I was trying to accumulate from an expr and it was crazy. I don't really understand how to ferry stuff from the template to the proc :-/ |
19:35:05 | coffeepot | i say bugs but you know, I didn't really expect it to work :3 |
19:35:21 | Araq | well an internal error is a bug, for example |
19:35:49 | coffeepot | yeah managed to make a few of those, but couldn't reproduce a simple test case for it |
19:36:09 | Araq | dude, I don't need a simple test case |
19:36:36 | Araq | it lets to overfitting the compiler to trivial problems |
19:36:41 | Araq | *leads |
19:36:49 | coffeepot | hmm that's a good point |
19:37:33 | coffeepot | well, here is one I did manage to simplify anyway https://gist.github.com/coffeepots/9443d86b934cae5e02c0 |
19:39:29 | * | eedee joined #nim |
19:40:34 | Arrrr | if you happen to use macros, have a loot at `quote do:`, it makes life easier |
19:41:02 | coffeepot | Arrrr: me? |
19:41:18 | Arrrr | you, little pot |
19:43:11 | coffeepot | :) that looks similar to what I want, but I've not written a macro yet. Though... I was thinking probably what I wanted to do with tree traversal might be easier with a macro |
19:44:15 | coffeepot | ultimately though I'm not even sure if this is worth 'metaprogramming' as I don't want to be passing around loads of parameters for a tiny bit of code. Then again, it would be cool and would mean I could change the tree stuff in once place |
19:44:39 | Arrrr | also, i used dumptree (or treedump?) at first to learn the ast of nim. Eventually you get used to it. |
19:44:44 | Arrrr | What do you have to do? |
19:45:34 | coffeepot | well, I just wanted to do a basic generic octree and/or quadtree that exposed a template/macro that allowed you to write your own code when a 'hit' was found for an area |
19:46:03 | * | NimBot joined #nim |
19:46:16 | * | filcuc quit (Quit: Konversation terminated!) |
19:46:23 | coffeepot | the idea being I could quickly implement loads of functions without having to copypasta for the tree traversal |
19:46:38 | coffeepot | and also have it static |
19:46:42 | Arrrr | i think seq has something like that, keepIf i think |
19:46:59 | Arrrr | sequtils |
19:47:02 | * | filcuc joined #nim |
19:49:50 | coffeepot | keepif is kind of what I want to do, but I'd like to compile the stmt part to a static proc |
19:50:03 | coffeepot | rather that do calls in the tree traversal |
19:50:55 | coffeepot | I tried to do echo dumpTree(query).toStrLit but broke nim again :3 |
19:51:48 | Arrrr | dont use toStrLit |
19:52:13 | coffeepot | how do i echo out the dumptree? |
19:52:20 | coffeepot | or is that not possible? |
19:52:57 | Arrrr | i think you only have to use dumpTree, for example 'dumpTree coffee()' |
19:53:06 | Arrrr | and then nim c macrotest |
19:53:29 | Arrrr | I have used it before, the thing is that now i have forgotten how it was |
19:53:55 | * | filcuc quit (Quit: Konversation terminated!) |
19:53:59 | coffeepot | man, I really don't know wtf I am doing lmao XD |
19:54:34 | * | filcuc joined #nim |
19:54:42 | * | filcuc quit (Client Quit) |
19:54:58 | coffeepot | dumptree outputs "Ident !"query"" |
19:55:02 | Arrrr | dumptree is to echo the ast |
19:55:08 | * | Demos_ quit (Remote host closed the connection) |
19:55:41 | Arrrr | If query contains something, i think you have to use echo(treeRepr(query)) |
19:55:50 | Arrrr | (inside the macro or template) |
19:56:36 | dom96 | Just discovered that somebody created an IRC bot called NimBot |
19:56:44 | dom96 | and it's not even written in Nim! |
19:56:51 | Arrrr | But i really dont know what do you mean by 'compile stmt to static proc' |
19:57:35 | * | Demos joined #nim |
19:58:17 | coffeepot | Arrrr: ah I just mean I want a template that creates a procedure that includes all the tree traversal guff, and the bit after the : at compile time - ideally I dont want to be doing calls to another procedure if I can avoid it |
19:59:19 | * | linkmonitor quit (Quit: Page closed) |
19:59:30 | Arrrr | but the travensal stuff is done at runtime, am i wrong? |
19:59:40 | coffeepot | like sequtils.mapIt but with a tree |
20:00:10 | Arrrr | but mapIt only copy pastes the code inside the iterator. |
20:00:17 | coffeepot | yep :) |
20:00:36 | Arrrr | so, what else do you need |
20:01:01 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:01:09 | Arrrr | i suppose, in your octree you'll have nodes with seqs or arrays |
20:01:18 | Arrrr | do the same thing once you have reached those arrays/seqs |
20:02:05 | coffeepot | pretty much what I want to do, I just am not sure how to work the scopes - at least, when I tried I couldn't access the variables inside the tree traversal, so I tried passing them in the template parameters and was surprised that that... basically worked, but as Araq said, not good |
20:02:21 | * | Amrykid2 joined #nim |
20:02:29 | coffeepot | I suppose I should try fiddling with {.inject.} |
20:02:35 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:03:23 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:04:56 | Arrrr | what did he tell you was wrong |
20:05:43 | coffeepot | "never ever do foo as both template parameter and proc parameter" |
20:06:08 | coffeepot | I'm kind of glad he said that 'cos it seemed a shoddy way to do it tbh |
20:06:20 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:06:21 | coffeepot | like, jeez am I gonna have to pass every variable I want to interact with? |
20:06:49 | dom96 | Araq: You around? |
20:07:32 | Arrrr | if i were you, i'd just add every stuff inside a seq, and then iterate it |
20:08:15 | Araq | no |
20:08:31 | * | Demos_ joined #nim |
20:08:58 | dom96 | Araq: ok, i'll try to fix NimBot alone then |
20:09:01 | dom96 | :( |
20:09:27 | eedee | meh |
20:09:45 | eedee | --boundchecks:on fixed everyting |
20:10:16 | eedee | Also doing that http benchmarks, gokr's server vs mine same ammount of req per second |
20:10:20 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:10:32 | coffeepot | tbh I'm tempted to just go with the copypasta for now and come back to this idea when I know what I'm doing a bit more |
20:11:50 | * | Demos quit (Ping timeout: 240 seconds) |
20:12:34 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:12:38 | eedee | http://pastebin.com/7V53gWRv same performance, no crashing |
20:13:43 | dom96 | eedee: You're likely just getting lucky |
20:13:49 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:14:06 | eedee | dom96: what do you mean? |
20:14:30 | * | xificurC quit (Ping timeout: 240 seconds) |
20:15:15 | dom96 | eedee: That it's working |
20:15:20 | dom96 | Threads + Async are not supported |
20:17:45 | Sahnvour | anyone using sublime text (+nimline): what's your workflow, regarding build + run a multi-source module ? |
20:18:04 | * | Demos_ quit (Remote host closed the connection) |
20:18:56 | * | NimBot1_ quit (Remote host closed the connection) |
20:19:08 | eedee | dom96: Yea, it used to crash instatly when i tried to recv from other thread. That was maybe because i registered it on the mainthread not on the worker thread. So now i use channels, send the socket via channel to Worker thread. Then register it ont he worker thread. |
20:19:34 | eedee | Used to give OSerror: Paramater is invalid |
20:19:46 | dom96 | eedee: Go ahead and use it but don't say I didn't warn you |
20:20:00 | coffeepot | threads are a fickle mistress |
20:20:17 | coffeepot | at least, when sharing |
20:20:21 | eedee | ye tho im just testing lol |
20:22:41 | * | filcuc joined #nim |
20:22:47 | Arrrr | use sockets instead |
20:22:57 | dom96 | Araq: Only crashes with the default GC. |
20:23:21 | Araq | dom96: yup, not unexpected |
20:23:34 | dom96 | Araq: So how do I debug this beast? |
20:23:49 | Araq | what do the assertions say? |
20:24:00 | dom96 | nothing |
20:24:43 | * | NimBot1_ quit (Ping timeout: 265 seconds) |
20:25:22 | Araq | -d:fulldebug |
20:27:12 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:27:22 | * | strcmp1 quit (Quit: Leaving) |
20:27:51 | dom96 | Araq: still nothing |
20:28:42 | Araq | what's the stack trace? |
20:29:01 | * | Demos joined #nim |
20:29:20 | * | Demos quit (Remote host closed the connection) |
20:30:53 | eedee | |
20:31:50 | * | Demos joined #nim |
20:32:49 | eedee | http://pastebin.com/GeDSEcRe |
20:33:17 | dom96 | Araq: https://gist.github.com/dom96/bcb1f4b207ddad0c5d71 |
20:33:49 | yglukhov | Araq, so defer doesn't always esacape template scope? Whats the rule for this? |
20:36:06 | Araq | dom96: is that with all the debugging switches turned on? |
20:36:31 | Araq | yglukhov: it does always escape template scope |
20:36:53 | dom96 | Araq: yeah, with -d:fullDebug |
20:37:11 | Araq | and with -d:useGcAssert -d:useSysAssert ? |
20:37:33 | * | NimBot joined #nim |
20:37:47 | yglukhov | Araq, ok, what about this test: https://github.com/nim-lang/Nim/commit/0d8942d45e5d477224d486ab66adfcf38230aa8b#diff-89510b72cf88788fac6a5c266d244ed0R33 |
20:38:31 | * | NimBot1_ quit (Read error: Connection reset by peer) |
20:38:50 | dom96 | Araq: don't see anything different |
20:39:07 | Araq | that escapes the template's scope but the 'stmtListExpr' gets its own scope |
20:39:37 | yglukhov | The test fails, because of a typo in expected results. But actual result reads |
20:39:43 | yglukhov | hi |
20:39:43 | yglukhov | hi |
20:39:43 | yglukhov | 1 |
20:39:45 | yglukhov | hi |
20:39:47 | yglukhov | 2 |
20:39:49 | yglukhov | B |
20:39:51 | yglukhov | A |
20:40:01 | yglukhov | hi gets in between 1 and 2 |
20:40:01 | Xe | hello |
20:40:05 | Xe | oh |
20:40:48 | yglukhov | while it should be between 2 and B, if defer escaped |
20:41:29 | yglukhov | however B and A are printed correctly, as if their defers escaped |
20:44:06 | Araq | yes, I know. it works as expected, you're free to improve the transformation to do what you think it should do |
20:46:19 | NimBot | nim-lang/Nim devel 4a7c1d5 Dominik Picheta [+0 ±1 -0]: Don't crash on `nil` in get* procs in the JSON module. |
20:47:47 | yglukhov | Actually, I don't mind if it works as expected =). I just can't understand the difference between atFuncEnd and testB template instantiations. |
20:48:19 | yglukhov | Is it an expr vs stmt template difference? |
20:49:59 | yglukhov | Besides, I don't think I understand compiler code enough to do whatever i think is right =) |
20:50:57 | * | X67r joined #nim |
20:52:55 | * | kilon quit (Read error: Connection reset by peer) |
20:53:49 | * | kilon joined #nim |
20:54:19 | * | filcuc quit (Quit: Konversation terminated!) |
20:55:16 | dom96 | Araq: So when all debugging tools fails, what do I do? |
20:56:14 | Araq | mmdisp.nim |
20:56:20 | Araq | logAlloc = true |
20:56:22 | yglukhov | Ah, sorry, missed your message about stmtListExpr. Please disregard everything I wrote after that. |
20:57:28 | Araq | and then output the pointer that crashes the GC |
20:57:47 | Araq | usually it's a pointer that has already been freed |
20:58:07 | Araq | and the logging should tell you what subcomponent freed it already |
21:00:20 | dom96 | It crashes much earlier if I set logAlloc to true |
21:00:37 | Araq | that doesn't really matter |
21:00:46 | Araq | as long as it still crashes |
21:01:48 | * | xcombelle quit (Quit: Leaving) |
21:02:04 | dom96 | yeah, but it doesn't give any stack trace |
21:02:42 | dom96 | by much earlier I mean before the event which causes the crash in the first place |
21:04:11 | * | Arrrr quit (Quit: WeeChat 1.2) |
21:05:55 | Araq | hey, we even have a "debugGraph" helper |
21:06:35 | dom96 | No documentation for any of this :( |
21:06:53 | Araq | yeah like you would read it |
21:07:36 | dom96 | I woul |
21:07:38 | dom96 | *would |
21:08:07 | dom96 | all I see is a bunch of "rawAlloc: 4104 0337E018" what do I do with this? |
21:09:43 | Araq | well you need a stacktrace, gdb should be able to give you one |
21:09:46 | * | Amrykid2 quit (Quit: Leaving) |
21:10:14 | Araq | and then for the failing op you can insert writeCell calls |
21:10:43 | Araq | and then you can see in the log what has been done with this cell (cell = the address you see in the log) |
21:12:15 | * | X67r quit (Ping timeout: 255 seconds) |
21:12:33 | * | jszymanski quit (Quit: computer sleeps...) |
21:12:49 | * | X67r joined #nim |
21:18:01 | * | xet7_ joined #nim |
21:21:08 | dom96 | Araq: hrm, this line segfaults: cprintf("rawAlloc: %ld %p\n", requestedSize, result) |
21:21:40 | dom96 | result must be nil |
21:21:45 | dom96 | isn't that a bad sign? |
21:21:53 | * | xet7 quit (Ping timeout: 256 seconds) |
21:23:32 | * | Sembei joined #nim |
21:25:25 | * | Demos_ joined #nim |
21:25:28 | * | Pisuke quit (Ping timeout: 250 seconds) |
21:27:01 | Araq | well it is 'nil'? |
21:29:10 | * | Demos quit (Ping timeout: 245 seconds) |
21:29:39 | * | Demos_ quit (Ping timeout: 252 seconds) |
21:30:52 | dom96 | Araq: no idea |
21:31:04 | dom96 | Tried checking, it just segfaults |
21:31:15 | Araq | gdb segfaults? |
21:33:20 | dom96 | no |
21:33:31 | dom96 | It crashes somewhere in msvcrt.dll |
21:34:30 | dom96 | so I don't have access to that var |
21:40:13 | * | FedeOmoto quit (Quit: Leaving) |
21:41:03 | * | nkf1 joined #nim |
21:41:53 | Araq | dom96: you can change writeCell so that it only outputs the address |
21:42:05 | Araq | it cannot crash when only accessing the address |
21:42:57 | * | kilon quit () |
21:43:00 | dom96 | writeCell? This is in rawAlloc |
21:43:26 | * | nkf1 left #nim (#nim) |
21:44:50 | * | NimBot joined #nim |
21:46:41 | dom96 | Araq: well, m&s crashes too |
21:46:48 | dom96 | just more randomly |
21:49:38 | dom96 | Araq: even when I remove cprintf completely, it still crashes. |
21:50:11 | * | unclechu quit (Quit: Leaving.) |
21:50:31 | * | unclechu joined #nim |
21:51:11 | * | kilon joined #nim |
21:51:59 | * | kilon quit (Client Quit) |
21:53:24 | dom96 | Araq: in avltree this time |
21:53:28 | * | unclechu quit (Client Quit) |
21:54:00 | Araq | that sounds bad |
21:55:42 | * | pregressive quit (Remote host closed the connection) |
21:55:47 | dom96 | Araq: what should I do? |
21:56:16 | * | pregressive joined #nim |
22:00:21 | * | pregressive quit (Ping timeout: 244 seconds) |
22:00:27 | Araq | dunno, replace the avl tree by a stupid array based implementation? |
22:01:46 | * | strcmp1 joined #nim |
22:06:47 | * | Trustable quit (Remote host closed the connection) |
22:15:02 | * | Jesin quit (Quit: Leaving) |
22:25:22 | dom96 | Guess that will have to wait for tomorrow |
22:25:23 | * | yglukhov quit (Remote host closed the connection) |
22:26:39 | * | yglukhov joined #nim |
22:30:54 | * | yglukhov quit (Ping timeout: 250 seconds) |
22:38:07 | * | eedee quit (Quit: Page closed) |
22:38:20 | * | Sahnvour quit (Read error: Connection reset by peer) |
22:39:39 | * | xet7_ is now known as xet7 |
22:47:27 | * | elbow_jason joined #nim |
22:51:44 | Araq | coffeepot: the reason you cannot look at the AST after template expansion is that it would produce megabytes of data |
22:56:14 | * | NimBot joined #nim |
23:04:33 | coffeepot | Araq: that's cool, I can imagine the trees are pretty detailed. It'd be amazing if there was a way to produce a half-compiled version of a template so you could see what the nim code equates too though. I assume this isn't as simple as it's stated though :) |
23:05:16 | Araq | no, it's not that they are "too detailed". |
23:05:23 | Araq | it's that we produce thousands of them. |
23:05:34 | Araq | in Nim even != is a template expansion. |
23:06:11 | Araq | we could introduce a .showAfterExpansion pragma though that you can annoate your template with |
23:06:22 | Araq | so the compiler actually knows what you're interested in |
23:10:17 | coffeepot | "!=" god that's a good point I remember reading about that. Yes now you explain it I can see why it's not trivial. I suppose the compiler would have to 'recompress' the trees to get back to the original code and then you're back to square one! |
23:10:43 | coffeepot | a pragma would be cool, but I'm sure there are more important things you are doing :) |
23:13:31 | Araq | no, I'm watching "let's play Ecstatica 1" |
23:13:46 | * | Araq is kidding |
23:15:10 | coffeepot | haha everyone needs some downtime, I don't judge |
23:15:15 | * | coffeepot silently judges |
23:15:35 | coffeepot | right time for bed for me, goodnight! |
23:18:33 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
23:20:38 | * | Varriount joined #nim |
23:22:31 | * | NimBot joined #nim |
23:24:50 | * | fowl quit (Excess Flood) |
23:25:08 | * | silven quit (Quit: No Ping reply in 180 seconds.) |
23:26:31 | * | silven joined #nim |
23:28:14 | * | fowl joined #nim |
23:41:33 | * | X67r quit (Quit: leaving) |
23:51:54 | * | ozra quit (Ping timeout: 246 seconds) |
23:58:00 | * | ozra joined #nim |