<< 06-08-2015 >>

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:16NotificationI 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:20def-Notification: what benchmark?
08:27:57Notificationhttps://github.com/kostya/benchmarks
08:30:28def-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:37def-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:45yglukhovHi all. How do we call "default" copy from within an overriden one?
08:58:38yglukhove.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:49def-yglukhov: system.`=`?
08:59:05def-system.`=`(foo, bar)
08:59:12yglukhovnope
08:59:19yglukhovError: undeclared identifier: '='
09:01:28def-shallowCopy?
09:01:31*xet7 joined #nim
09:02:05def-hm, no
09:04:36def-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:28yglukhovHmm, some time ago Araq thought of relaxing forward declaration requirements =)
09:06:38def-yeah, that would obviously break it
09:06:54def-and I'd also prefer a way to access the default assignment operator, builtin
09:07:52yglukhovI 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:49yglukhovE.g. for aggreagtes, it copies field-by-field.
09:09:15yglukhovFor non-aggregate disticts it casts to base type.
09:09:30def-Heh, Notification found a memory leak, nice
09:09:33def-in the standard gc
09:09:51magistrnim supports alegebraic data types?
09:10:16def-magistr: not exactly, but object variants have some advantages and some disadvantages
09:11:00magistrdef-, dependent typs programming?
09:11:08magistrtypes*
09:11:27def-magistr: and you can write a macro that converts ADTs into object variants
09:11:36def-See here: http://forum.nim-lang.org/t/904
09:12:54def-magistr: i think we have some restricted kind of dependent types with static, range and compile-time sized arrays
09:13:30def-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:56def-(maybe i misremember)
09:26:02*wuehlmaus quit (Quit: Lost terminal)
09:37:36Araqyeah we need to make system.`=` work
09:37:45Araqit's the obvious thing
09:38:25def-In case Notfication comes back later, here's the memory leak issue: https://github.com/nim-lang/Nim/issues/3184
09:39:46Araqusually these things are codegen bugs
09:40:11Araqsome pointer doesn't get the proper write barrier in the codegen
09:48:05Araqstrange benchmark though, screams "slow!" everywhere
09:53:02def-Araq: indeed, but it's written in a similar way in all the other languages and they're not faster either
10:00:56Araqdoes clang use the CPATH env var?
10:04:30def-yes
10:04:56AraqI finally got the point of env vars ;-)
10:05:28Araqit's so that you can still do something when the compiler invocation is hidden by a layer of 4 scripts
10:24:25yglukhovWow, so now defer gets "exported" to outer scope of template!?
10:26:16yglukhovMore ways to do more magic! Hehe :)
10:27:57*ozra joined #nim
10:32:22Araqdestructors are implemented by 'defer' statement injection
10:32:42Araqand the defer statement is rewritten to 'try' now in a later pass
10:32:48Araqwhere we do scope merging
10:33:03yglukhovAhh, right, and destructors need to be called outside of the template..
10:33:53AraqI'm not really that happy with this solution, but it's much better than what we used to do
10:34:35yglukhovI know it's more implicit, but it gives more power
10:34:43yglukhovalong with responsibility =)
10:35:16yglukhovAre you still against destructors in global scope?
10:35:40Araqyes
10:36:40*Pisuke quit (Ping timeout: 245 seconds)
10:38:35yglukhovAlright, 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:17Araqadding a destructor after the fact is already a breaking change
10:39:31Araqremember that we have the notion of a "destructible context"
10:40:57yglukhoverr.. "breaking change" - why? It's implementation details. The interface doesn't change.
10:41:36yglukhov"destructible context" - i thought this term was used before Nim got a fully-featured RAII support?
10:42:05Araqwe still haven't got "fully-featured RAII"
10:42:27Araqthe "destructible context" still exists
10:45:01Araq(and it still not obvious to me whether that's a good design or a bug)
10:45:17yglukhovcould you give me a hint please?
10:45:32yglukhovthe case, when RAII doesnt work?
10:46:50*Pisuke joined #nim
10:48:07AraqsomeCall(somethingThatConstructsT)
10:48:50yglukhovworks for me
10:50:01yglukhovhttps://gist.github.com/yglukhov/4c200e3299863a9e5fe7#file-raii-nim-L37
10:57:34baabelfishI 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:38yglukhovI guess you can test it with a defer stmt ;)
10:59:35yglukhovOr even simpler, define a var inside using and see if it's visible later
11:00:21baabelfishI 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:08yglukhovAhh, ok, sorry.
11:28:22*dalarmmst joined #nim
11:33:20yglukhovAraq, so, did I miss anything in my example? Just tested passing by var, and it works as well.
11:34:05Araqvar v1 = newA(1) # ok, destructible context
11:34:17Araqfoo(newA(1)) # not ok, not destructible context
11:34:44Araqthe 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:20yglukhovok, funny thing. testA(newA(1)) produces no warning. Moreover, destructor gets called as it should.
11:38:19yglukhovhowever, proc(a: var A) = a = newA(1) # does produce a warning, but still assignment and destructor get called as they should.
11:38:46yglukhov* proc testByRef(a: var A) = a = newA(1)
11:41:30yglukhovoh, sorry, first case doesn't call destructor.
11:42:14yglukhovbut gives no warning.
11:43:20*coffeepot joined #nim
11:46:59*pregressive joined #nim
11:47:31yglukhovso "testA(newA(1))" should be rewritten to smth like "block: let tmp = newA(1); testA(tmp)", right?
11:47:41Araqright
11:48:06Araqbut not for the C++ target once we map Nim's destructors to C++ destructors ...
11:49:43yglukhovIs it possible to map them? I mean, that requires Nim types to be mapped to cpp structs/classes?
11:50:13Araqthe compiler does that since the beginning of time
11:50:17yglukhoveven the distinct ints?
11:50:36yglukhovdistinct pointers?
11:50:45Araqdistinct T is just mapped to T
11:51:23yglukhovbut distinct can have it's own destructor?
11:53:01yglukhovjust tested it, and it can =)
12:04:44yglukhovSo you would need to wrap every distinct type in a cpp struct/class.
12:05:03yglukhovbtw, 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:01Araqmuch better C++ interop
12:34:19*eedee joined #nim
12:43:16*grumbly joined #nim
12:48:31grumblyWhat 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:12Araqyou 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:24grumblyOh, 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:29yglukhovPutting 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:51coffeepotwhat 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:15Demosyeah usually MIT
15:29:24Demosor whatever the library I'm wrapping uses
15:29:30Demosif It's a C library
15:30:34coffeepotok nice one :)
15:30:46coffeepotcheers
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:33eedeeHello?
16:05:46eedeeAnyone here that could help me with one problem
16:07:50def-eedee: hello, just post the problem
16:08:11def-(if it's multiple lines of code, to gist or pastebin)
16:08:19eedeeYea i played with async sockets and threads, so http://pastebin.com/2PnaqNE8
16:08:27*FedeOmoto quit (Ping timeout: 252 seconds)
16:08:28eedeewhen -d:release on it crashes
16:08:37eedeebut without that ti doesn't
16:09:13def-async might just not work with threads yet, I'm not sure, but I think there was work going into that direction
16:09:35eedeeYea but without -d:release it works fine up to 40k sockets
16:09:51eedeewith -d:release on it crashes before 1k
16:10:42eedeeBut thats cool, when will nim go into that direction?
16:11:12*kilon joined #nim
16:15:46def-eedee: how can i check that it crashes?
16:16:25eedeeWell, windows will just pop up the messagebox saying "*.exe has stopped working"
16:16:40def-eedee: yeah, but how do i create 1k sockets for this?
16:16:42def-or how do you?
16:16:44eedeeaaa
16:16:49eedeei just made a tool
16:16:53eedeewith nim
16:16:55eedeefor that
16:16:57def-also, line 67 should be "var client = newSocket()", it's not compiling on devel branch right now
16:16:58eedeelet me paste it
16:17:18eedeeok
16:18:03*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:18:03def-you could also check if it's fixed with the devel branch
16:18:33eedeeAlright, i do that
16:18:34eedeehttp://pastebin.com/k18RC2Y5
16:18:37eedeehere is the tester
16:19:55*doxavore quit (Quit: I said good day, sir.)
16:20:22def-well, on linux the client as well as the server crash with too many connections
16:20:23*FedeOmoto joined #nim
16:20:30def-Client: Error: unhandled exception: Bad file descriptor [Exception]
16:20:36def-Server: Error: unhandled exception: Too many open files [OSError]
16:20:55eedeehow many connections?
16:20:59def-500
16:21:10eedeeweird i can do like 40k
16:21:15eedeeon win tho
16:21:48*Ven quit (Read error: No route to host)
16:22:48eedeeacutally
16:23:10eedeeit wont error on -d:release on if i don't ever recv from the socket.
16:25:26eedeeor 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:49eedeeFinally 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:16baabelfisheedee: tried with a debugger?
16:48:50eedeehm?
16:49:01eedeewith out -d:release it wont crash
16:49:03baabelfishto get more information about the crash
16:49:05baabelfishah
16:49:27eedeehttp://pastebin.com/QpD10vLZ
16:49:34eedeewrong one
16:50:05eedeehttp://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:56coffeepothi guys, is there a way I can display an expansion of a template?
17:41:50*UberLambda joined #nim
17:58:03dom96coffeepot: try a high verbosity value when compiling like --verbosity:5
17:58:33eedeedom
17:58:36eedeedo u know the problem?
17:59:28eedeehttp://pastebin.com/2PnaqNE8 works fine with no -d:release on. Its a async server with threads.
18:00:03eedeenormally +50k socks but when -d:release crashes before 1k
18:00:11*Jesin joined #nim
18:00:44dom96eedee: why are you mixing blocking sockets with asyncdispatch?
18:00:59eedeeWell they are not blocking eachother.
18:01:21eedeeclient.getFd().setBlocking(false) if take this then it blocks
18:01:32dom96Why are you using TAsyncFd instead of AsyncSocket?
18:01:42dom96The asyncnet module does that for you
18:01:54eedeeyea but i wanted it to use all cpu cores like now
18:02:23*eventualbuddha quit (Quit: Connection closed for inactivity)
18:02:30dom96asyncnet doesn't disallow that
18:02:39*Demos_ joined #nim
18:02:42eedeeo
18:02:47dom96but in regards to your problem: I don't know.
18:02:48eedeeWould that fix the problem?
18:02:51eedeeoh
18:03:01*Demos_ quit (Read error: Connection reset by peer)
18:03:05eedeewith -d:release -checks:on it works tho
18:03:21dom96It might be worth a try
18:03:53eedeei'l try that then :d
18:03:59dom96Why does `run` not have the {.thread.} pragma?
18:04:19*Demos_ joined #nim
18:04:21dom96i'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:49Eedee2Whoops connected 100k socks qnd it freezed my computer
18:07:30Eedee2Yea 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:55dom96Eedee2: try using --debugInfo --lineDir:on --checks:off and then gdb
18:14:47eedeewill do, let see what happens
18:17:53eedeedom96: Won't crash :d
18:18:00*Eedee2 quit (Ping timeout: 246 seconds)
18:21:02eedeeah now it did
18:25:16*Jesin quit (Quit: Leaving)
18:26:44*strcmp1 joined #nim
18:27:28eedeeNewcode:http://pastebin.com/4VyYTAPE and error:http://pastebin.com/6CL9uv7T
18:29:13eedeeyea could try with devel
18:32:33*brson quit (Ping timeout: 252 seconds)
18:35:41dom96eedee: try with --useGcAssert
18:36:11dom96and --useSysAssert
18:36:53eedeewith -d:release ?
18:37:44dom96er sorry, -d:useGcAssert and -d:useSysAssert
18:37:45dom96nah
18:37:47dom96well
18:37:53dom96I guess you can try it with -d:release
18:37:55*UberLambda quit (Ping timeout: 245 seconds)
18:37:59dom96or just --checks:off
18:43:26eedeeuseSysAssert 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:59coffeepotdom96, cheers I'll try that :)
18:46:34Araqyglukhov: can you try to fix the 'defer' regression?
18:46:43eedeeand 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:25dom96eedee: Do you see any 'assert' messages?
18:47:41Araqeedee: async doesn't work with threading yet, not sure why you insist on using it
18:48:16eedeeTho Araq it works fine with --checks:on like to 50k sockets
18:48:27eedeedom96: let me check
18:48:31Araqnah, you're just lucky
18:48:47dom96Araq is correct though
18:48:56eedeeno assets
18:49:04eedeelol yea maybe lucky
18:49:26eedeestill 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:45eedeeAraq: http://s27.postimg.org/d9r2zxylv/works_fine.png
18:52:46eedeehttp://pastebin.com/Euxpnwxk
18:55:45ArrrrIs it noReturn actually necessary?
19:02:15AraqArrrr: no, it's not
19:02:37Araqeedee: check out gokr's spawn based server
19:02:52eedeeAraq: where can i find that?
19:08:35dom96http://goran.krampe.se/2014/10/25/nim-socketserver/
19:08:39*Jesin joined #nim
19:11:49eedeety
19:13:04*Sahnvour joined #nim
19:13:43Arrrrthen what does noreturn do
19:20:34*filcuc joined #nim
19:20:49yglukhovAraq, here's the first try: https://github.com/nim-lang/Nim/pull/3188
19:20:53coffeepot--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:14AraqArrrr: it makes you feel better
19:21:58Araqyglukhov: that's not the bug I meant, but ok, that's good too
19:22:08NimBotnim-lang/Nim devel 41a2a9f Yuriy Glukhov [+0 ±1 -0]: Fixes #3185
19:22:08NimBotnim-lang/Nim devel da4b0d9 Andreas Rumpf [+0 ±1 -0]: Merge pull request #3188 from yglukhov/fix-3185... 2 more lines
19:22:54yglukhovDid you mean the defer-at-the-end one?
19:23:06ArrrrSo, it is placebo effect for programmers, now i have seen everything
19:23:59Araqyup
19:24:37yglukhovWhy would anyone want to place a defer at the end? %)
19:24:52yglukhovok, 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:02Araqalso you could look into the typedesc regression
19:30:12coffeepotif 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:42coffeepotI realised i don't know wtf I'm doing lol XD
19:31:48Araqyup
19:31:51*eedee2 quit (Ping timeout: 246 seconds)
19:32:02Araqsorry, but yeah, your template is horrible
19:32:24coffeepotthat's cool, it's my first and it was trial and.. error :)
19:32:58Araqfor a start, never ever do foo as both template parameter and proc parameter
19:33:46Araqthe compiler could allow it but it's not a compatible change and I dunno what it would break
19:34:40coffeepotyes 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:05coffeepoti say bugs but you know, I didn't really expect it to work :3
19:35:21Araqwell an internal error is a bug, for example
19:35:49coffeepotyeah managed to make a few of those, but couldn't reproduce a simple test case for it
19:36:09Araqdude, I don't need a simple test case
19:36:36Araqit lets to overfitting the compiler to trivial problems
19:36:41Araq*leads
19:36:49coffeepothmm that's a good point
19:37:33coffeepotwell, here is one I did manage to simplify anyway https://gist.github.com/coffeepots/9443d86b934cae5e02c0
19:39:29*eedee joined #nim
19:40:34Arrrrif you happen to use macros, have a loot at `quote do:`, it makes life easier
19:41:02coffeepotArrrr: me?
19:41:18Arrrryou, little pot
19:43:11coffeepot:) 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:15coffeepotultimately 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:39Arrrralso, i used dumptree (or treedump?) at first to learn the ast of nim. Eventually you get used to it.
19:44:44ArrrrWhat do you have to do?
19:45:34coffeepotwell, 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:23coffeepotthe idea being I could quickly implement loads of functions without having to copypasta for the tree traversal
19:46:38coffeepotand also have it static
19:46:42Arrrri think seq has something like that, keepIf i think
19:46:59Arrrrsequtils
19:47:02*filcuc joined #nim
19:49:50coffeepotkeepif is kind of what I want to do, but I'd like to compile the stmt part to a static proc
19:50:03coffeepotrather that do calls in the tree traversal
19:50:55coffeepotI tried to do echo dumpTree(query).toStrLit but broke nim again :3
19:51:48Arrrrdont use toStrLit
19:52:13coffeepothow do i echo out the dumptree?
19:52:20coffeepotor is that not possible?
19:52:57Arrrri think you only have to use dumpTree, for example 'dumpTree coffee()'
19:53:06Arrrrand then nim c macrotest
19:53:29ArrrrI 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:59coffeepotman, 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:58coffeepotdumptree outputs "Ident !"query""
19:55:02Arrrrdumptree is to echo the ast
19:55:08*Demos_ quit (Remote host closed the connection)
19:55:41ArrrrIf query contains something, i think you have to use echo(treeRepr(query))
19:55:50Arrrr(inside the macro or template)
19:56:36dom96Just discovered that somebody created an IRC bot called NimBot
19:56:44dom96and it's not even written in Nim!
19:56:51ArrrrBut i really dont know what do you mean by 'compile stmt to static proc'
19:57:35*Demos joined #nim
19:58:17coffeepotArrrr: 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:30Arrrrbut the travensal stuff is done at runtime, am i wrong?
19:59:40coffeepotlike sequtils.mapIt but with a tree
20:00:10Arrrrbut mapIt only copy pastes the code inside the iterator.
20:00:17coffeepotyep :)
20:00:36Arrrrso, what else do you need
20:01:01*NimBot1_ quit (Read error: Connection reset by peer)
20:01:09Arrrri suppose, in your octree you'll have nodes with seqs or arrays
20:01:18Arrrrdo the same thing once you have reached those arrays/seqs
20:02:05coffeepotpretty 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:29coffeepotI 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:56Arrrrwhat did he tell you was wrong
20:05:43coffeepot"never ever do foo as both template parameter and proc parameter"
20:06:08coffeepotI'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:21coffeepotlike, jeez am I gonna have to pass every variable I want to interact with?
20:06:49dom96Araq: You around?
20:07:32Arrrrif i were you, i'd just add every stuff inside a seq, and then iterate it
20:08:15Araqno
20:08:31*Demos_ joined #nim
20:08:58dom96Araq: ok, i'll try to fix NimBot alone then
20:09:01dom96:(
20:09:27eedeemeh
20:09:45eedee--boundchecks:on fixed everyting
20:10:16eedeeAlso 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:32coffeepottbh 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:38eedeehttp://pastebin.com/7V53gWRv same performance, no crashing
20:13:43dom96eedee: You're likely just getting lucky
20:13:49*NimBot1_ quit (Read error: Connection reset by peer)
20:14:06eedeedom96: what do you mean?
20:14:30*xificurC quit (Ping timeout: 240 seconds)
20:15:15dom96eedee: That it's working
20:15:20dom96Threads + Async are not supported
20:17:45Sahnvouranyone 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:08eedeedom96: 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:34eedeeUsed to give OSerror: Paramater is invalid
20:19:46dom96eedee: Go ahead and use it but don't say I didn't warn you
20:20:00coffeepotthreads are a fickle mistress
20:20:17coffeepotat least, when sharing
20:20:21eedeeye tho im just testing lol
20:22:41*filcuc joined #nim
20:22:47Arrrruse sockets instead
20:22:57dom96Araq: Only crashes with the default GC.
20:23:21Araqdom96: yup, not unexpected
20:23:34dom96Araq: So how do I debug this beast?
20:23:49Araqwhat do the assertions say?
20:24:00dom96nothing
20:24:43*NimBot1_ quit (Ping timeout: 265 seconds)
20:25:22Araq-d:fulldebug
20:27:12*NimBot1_ quit (Read error: Connection reset by peer)
20:27:22*strcmp1 quit (Quit: Leaving)
20:27:51dom96Araq: still nothing
20:28:42Araqwhat's the stack trace?
20:29:01*Demos joined #nim
20:29:20*Demos quit (Remote host closed the connection)
20:30:53eedee
20:31:50*Demos joined #nim
20:32:49eedeehttp://pastebin.com/GeDSEcRe
20:33:17dom96Araq: https://gist.github.com/dom96/bcb1f4b207ddad0c5d71
20:33:49yglukhovAraq, so defer doesn't always esacape template scope? Whats the rule for this?
20:36:06Araqdom96: is that with all the debugging switches turned on?
20:36:31Araqyglukhov: it does always escape template scope
20:36:53dom96Araq: yeah, with -d:fullDebug
20:37:11Araqand with -d:useGcAssert -d:useSysAssert ?
20:37:33*NimBot joined #nim
20:37:47yglukhovAraq, 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:50dom96Araq: don't see anything different
20:39:07Araqthat escapes the template's scope but the 'stmtListExpr' gets its own scope
20:39:37yglukhovThe test fails, because of a typo in expected results. But actual result reads
20:39:43yglukhovhi
20:39:43yglukhovhi
20:39:43yglukhov1
20:39:45yglukhovhi
20:39:47yglukhov2
20:39:49yglukhovB
20:39:51yglukhovA
20:40:01yglukhovhi gets in between 1 and 2
20:40:01Xehello
20:40:05Xeoh
20:40:48yglukhovwhile it should be between 2 and B, if defer escaped
20:41:29yglukhovhowever B and A are printed correctly, as if their defers escaped
20:44:06Araqyes, I know. it works as expected, you're free to improve the transformation to do what you think it should do
20:46:19NimBotnim-lang/Nim devel 4a7c1d5 Dominik Picheta [+0 ±1 -0]: Don't crash on `nil` in get* procs in the JSON module.
20:47:47yglukhovActually, I don't mind if it works as expected =). I just can't understand the difference between atFuncEnd and testB template instantiations.
20:48:19yglukhovIs it an expr vs stmt template difference?
20:49:59yglukhovBesides, 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:16dom96Araq: So when all debugging tools fails, what do I do?
20:56:14Araqmmdisp.nim
20:56:20AraqlogAlloc = true
20:56:22yglukhovAh, sorry, missed your message about stmtListExpr. Please disregard everything I wrote after that.
20:57:28Araqand then output the pointer that crashes the GC
20:57:47Araqusually it's a pointer that has already been freed
20:58:07Araqand the logging should tell you what subcomponent freed it already
21:00:20dom96It crashes much earlier if I set logAlloc to true
21:00:37Araqthat doesn't really matter
21:00:46Araqas long as it still crashes
21:01:48*xcombelle quit (Quit: Leaving)
21:02:04dom96yeah, but it doesn't give any stack trace
21:02:42dom96by 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:55Araqhey, we even have a "debugGraph" helper
21:06:35dom96No documentation for any of this :(
21:06:53Araqyeah like you would read it
21:07:36dom96I woul
21:07:38dom96*would
21:08:07dom96all I see is a bunch of "rawAlloc: 4104 0337E018" what do I do with this?
21:09:43Araqwell you need a stacktrace, gdb should be able to give you one
21:09:46*Amrykid2 quit (Quit: Leaving)
21:10:14Araqand then for the failing op you can insert writeCell calls
21:10:43Araqand 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:08dom96Araq: hrm, this line segfaults: cprintf("rawAlloc: %ld %p\n", requestedSize, result)
21:21:40dom96result must be nil
21:21:45dom96isn'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:01Araqwell it is 'nil'?
21:29:10*Demos quit (Ping timeout: 245 seconds)
21:29:39*Demos_ quit (Ping timeout: 252 seconds)
21:30:52dom96Araq: no idea
21:31:04dom96Tried checking, it just segfaults
21:31:15Araqgdb segfaults?
21:33:20dom96no
21:33:31dom96It crashes somewhere in msvcrt.dll
21:34:30dom96so I don't have access to that var
21:40:13*FedeOmoto quit (Quit: Leaving)
21:41:03*nkf1 joined #nim
21:41:53Araqdom96: you can change writeCell so that it only outputs the address
21:42:05Araqit cannot crash when only accessing the address
21:42:57*kilon quit ()
21:43:00dom96writeCell? This is in rawAlloc
21:43:26*nkf1 left #nim (#nim)
21:44:50*NimBot joined #nim
21:46:41dom96Araq: well, m&s crashes too
21:46:48dom96just more randomly
21:49:38dom96Araq: 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:24dom96Araq: in avltree this time
21:53:28*unclechu quit (Client Quit)
21:54:00Araqthat sounds bad
21:55:42*pregressive quit (Remote host closed the connection)
21:55:47dom96Araq: what should I do?
21:56:16*pregressive joined #nim
22:00:21*pregressive quit (Ping timeout: 244 seconds)
22:00:27Araqdunno, 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:22dom96Guess 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:44Araqcoffeepot: 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:33coffeepotAraq: 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:16Araqno, it's not that they are "too detailed".
23:05:23Araqit's that we produce thousands of them.
23:05:34Araqin Nim even != is a template expansion.
23:06:11Araqwe could introduce a .showAfterExpansion pragma though that you can annoate your template with
23:06:22Araqso the compiler actually knows what you're interested in
23:10:17coffeepot"!=" 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:43coffeepota pragma would be cool, but I'm sure there are more important things you are doing :)
23:13:31Araqno, I'm watching "let's play Ecstatica 1"
23:13:46*Araq is kidding
23:15:10coffeepothaha everyone needs some downtime, I don't judge
23:15:15*coffeepot silently judges
23:15:35coffeepotright 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