<< 06-02-2016 >>

00:01:23*yglukhov joined #nim
00:01:23*yglukhov_ quit (Read error: Connection reset by peer)
00:02:27*darkf quit (Quit: Leaving)
00:04:56*yglukhov quit (Read error: Connection reset by peer)
00:05:18*yglukhov joined #nim
00:07:26*yglukhov quit (Read error: Connection reset by peer)
00:07:36*yglukhov joined #nim
00:09:47*yglukhov quit (Read error: Connection reset by peer)
00:17:39*yglukhov joined #nim
00:19:59*yglukhov quit (Read error: Connection reset by peer)
00:23:37ThePythonicCowDoes someone know what was the 'echo $foo gotcha' that was recently fixed (or know where that is explained)? (Newbie here)
00:24:14def-ThePythonicCow: http://nim-lang.org/news.html#Z2016-01-18-version-0-13-0-released
00:24:18def-look at the syntax changes for 0.13.0
00:24:43ThePythonicCowthanks - looking
00:25:33*yglukhov joined #nim
00:28:27*arnetheduck joined #nim
00:32:26ThePythonicCowSo ... next question ... what is the meaning of an infix '$', as in (echo) $ (foo) ?
00:34:34def-when you define a proc `$`(...) you can use it as `$`(x, y) or x $ y
00:34:53def-so it's a function call to `$` with the parameters echo and foo
00:35:21ldleworkin both cases, def- means
00:35:39ephjasimilar to the perhaps more familiar "3 + 4"
00:35:55ldleworka third way to call it would be, echo.$(foo)
00:35:57ldleworkerr
00:35:59ThePythonicCowah - no builtin meaning - but I can provide one if I want (so the parser has to allow '$' as an infix operator, if the syntax reads that way)
00:35:59ldleworknope
00:36:05def-ldlework: echo.`$`(foo)
00:36:09ldleworkright
00:36:39ephja3 + 4: proc `+`(a, b: int)
00:37:25*vendethiel joined #nim
00:37:28ThePythonicCowok - I hadn't integrated macro ability of Nim into my mental Nim parser yet :)
00:38:58ephjait doesn't involve macros
00:39:53ThePythonicCowyes - not macros - overloading operators - thanks
00:41:13ephjanot necessarily overloading
00:41:56ThePythonicCowok ... I will continue reading def's book before I insert foot further into mouth
00:42:12ephjaI don't think `?` for example is defined anywhere. btw, multiple "special" characters can be part of the name (`?$`)
00:44:02ephjawell, `[]` and `==` for example would be more obvious examples :p
00:44:14ThePythonicCowDo we have any ancient APL programmers around ... they could have some fun with this.
00:47:10def-ThePythonicCow: it's not my book, it's dom96's
00:47:29ThePythonicCowah - name confusion here
00:47:55*jaco60 quit (Ping timeout: 240 seconds)
01:00:25*vendethiel quit (Ping timeout: 240 seconds)
01:13:44*Matthias247 quit (Read error: Connection reset by peer)
01:14:51*vendethiel joined #nim
01:17:46*yglukhov quit (Remote host closed the connection)
01:21:32*junw_ quit (Remote host closed the connection)
01:35:00ldleworkthis looks nice, http://www.dinomage.com/tag/sdl_gpu/
01:35:26*vendethiel quit (Ping timeout: 240 seconds)
01:41:12ephjachromium doesn't like that website
01:41:50def-neither does firefox, crashed my browser
01:41:51ephjait keeps waiting for resources and nothing can be clicked
01:48:51ephjaldlework: which browser are *you* using? :p
01:51:52ldleworkwell it crashed my browser too
01:51:56ldleworkI mean the library looks nice
01:54:47ephjahttps://github.com/grimfang4/sdl-gpu
01:57:07ThePythonicCowand DinoMage Games uses SDL_gpu: http://www.dinomage.com/2014/03/sdl_gpu-0-8-0-released/
01:57:34ThePythonicCowdidn't crash my "browser" (wget ... the browser for dubious sites <grin>)
01:58:07ldleworkI wonder if c2nim would just bind it without pain
01:58:16ldleworkwhenver I get stuck with c2nim I don't know what I'm supposed to do
02:12:46*avsej quit (Ping timeout: 240 seconds)
02:16:18*Trustable quit (Remote host closed the connection)
02:17:03*avsej joined #nim
02:17:03*avsej quit (Changing host)
02:17:03*avsej joined #nim
02:18:06ldleworkHow do you produce an empty json object ltieral with the json macro?
02:18:15*yglukhov joined #nim
02:18:24ldleworkI just get an error that it got a set[empty]
02:19:46def-ldlework: oops, let me fix that
02:22:33*yglukhov quit (Ping timeout: 240 seconds)
02:23:25*avsej quit (Ping timeout: 245 seconds)
02:30:45def-ldlework: this should fix it: https://github.com/nim-lang/Nim/pull/3829/
02:31:10ldleworkdef-: cool you going to merge it
02:31:48ldleworkor does someone else have to lgtm it
02:31:57def-ldlework: I'd rather wait for someone else to look over it, no one told me if i'm allowed to merge my own commits, so I only do it for trivial ones
02:32:14ldleworkok
02:32:24ldleworkI'll just switch over to parseJson for now
02:32:28ldleworkthanks!
02:41:17*avsej joined #nim
02:41:18*avsej quit (Changing host)
02:41:18*avsej joined #nim
03:08:58*Jesin quit (Quit: Leaving)
03:15:21*ephja quit (Ping timeout: 245 seconds)
03:16:43*gokr quit (Quit: Leaving.)
03:19:25*Jesin joined #nim
03:19:53*yglukhov joined #nim
03:23:55*yglukhov quit (Ping timeout: 240 seconds)
03:28:23*lompik quit (Ping timeout: 264 seconds)
03:39:41Varriountldlework: I could try my hand at wrapping the sdl_gpu with c2nim
04:10:29*nande quit (Read error: Connection reset by peer)
04:19:22*lompik joined #nim
04:21:35*yglukhov joined #nim
04:25:44*yglukhov quit (Ping timeout: 252 seconds)
04:28:24*ludocode quit (Ping timeout: 272 seconds)
04:33:57*vendethiel joined #nim
04:36:18*ludocode joined #nim
04:38:54icsIs there some way to declare endian-ness in a type? e.g. I have a type Foo = object with field x: cshort # big-endian
04:39:11ics...which I am reading in from a binary file
04:42:28icsOr do I need to call bigEndian16 (import endian) while parsing the binary?
04:48:09*brson quit (Quit: leaving)
04:56:01*filwit quit (Quit: Leaving)
04:58:00*vendethiel quit (Ping timeout: 252 seconds)
05:07:33*Varriount quit (Disconnected by services)
05:07:33*Varriount_ joined #nim
05:19:47Varriount_ics: Types have the endian-ess of the host platform.
05:25:07icsOkay. The binary I'm working with is mixed, first two bytes are big and the rest (I think) are little. In a read proc I'm doing f.readData(addr(this.x), sizeof(this.x)) where x: cshort but I'm not sure how I should flip this value (needs pointers?)
05:26:11Varriount_ics: http://nim-lang.org/docs/endians.html
05:27:25Varriount_ics: Those procs convert from host to target endianess
05:28:14icsVarriount_: I'm looking at the source, but very new to Nim and I guess having trouble with how to call it
05:28:37Varriount_ics: Can I see a larger block of your code?
05:32:02icsVarriount_: http://pastebin.com/ykLUqznf
05:33:55*ics is on day 2.5 of Nim
05:37:26icsWith a line like this this.vs = addr(this.vs).bigEndian16(addr(this.vs)) I get this back: Error: expression 'bigEndian16(addr(this.vs), addr(this.vs))' has no type (or is ambiguous)
05:37:31Varriount_ics: Is the source data little or big endian?
05:37:41*Varriount_ is now known as Varriount
05:37:46icsThe first two bytes are big endian, the rest is little endian
05:38:10icsIt's an old format from Mac OS 5 era
05:38:41Varriountics: And the data is supposed to be read into..? I mean, you can't read the entire thing into the vc member.
05:42:25icsI [think I] want an object, i.e. something like var example = MPObject().load("./example_file") where I can then access its fields
05:44:57VarriountDo the first two bytes signify anything in particular? Are they a header or something, or just a marker?
05:45:00icsThe data contains coordinate components (x1, ..., xn, y1, ..., yn, z1, ..., zn) and so I want two things: to read in the data in its original form, and to then have a method to transform and write that data to another format
05:45:21icsThe first two bytes stored in vs are the length of data
05:45:32icsor len-1, don't remember
05:46:59Varriountics: One moment. I have a solution, but this has also evolved into an addition for the endian module. It currently lacks in-place conversion.
05:56:04icsVarriount: Cool- so with the current module I see what I needed to do (cleaner maybe): http://pastebin.com/i1GqR78V
05:56:34Varriountics: Yes, pretty much.
05:56:55Varriountics: You can change the read operation to a readInt16
05:57:12VarriountThat's what a cshort is, if you look at the typedef.
06:06:59*brson joined #nim
06:09:33icsVarriount: this.vs = f.readInt16() works, is that the preferred way (setting to the variable)?
06:10:33icsAnd because readInt16 uses read() it advances the read position on the stream... I think I'm understanding this a bit. It certainly looks clearer than the discard readData ... ...
06:10:36Varriountics: Yes. readData would be used when reading a stream into an array or sequence (read 50 bytes into an array denoted by pointer 'p')
06:11:38Varriountics: And to prevent any headaches, if you need to take the address of a sequence so that you can read data into it via a pointer, use 'addr(mySeq[0])', *not* 'addr(mySeq)'
06:12:24Varriountsame holds true for strings. Sequences and strings, being variable length, have their length and capacity at the beginning of the structure.
06:13:31*vendethiel joined #nim
06:15:05icsAh okay, that's very good to know. Related, is seq the way to go here (as opposed to openarray, which I wrote first but didn't work)?
06:16:20VarriountOpen arrays are for parameter/argument types only. They are a way for a procedure to accept arrays and sequences without code duplication.
06:17:01VarriountSequences and strings are dynamically (re)allocated arrays with length & capacity headers.
06:17:15*endragor joined #nim
06:17:46VarriountAlso, unlike arrays, sequences and strings are always normally allocated on the heap (barring optimizations for string literals)
06:20:42Varriountics: Also, just a fair warning if you're doing optimizations, using streams is easier/more flexible, but less efficient (as streams are essentially function tables).
06:21:29VarriountI mean, it won't be slow, but if you're looking to squeeze every last bit of performance out of the operation, you'll need to use the basic file read procedures.
06:22:03VarriountAlthough, I do wonder if the processor wouldn't optimize out the function calls somehow...
06:22:52*yglukhov joined #nim
06:23:15icsGiven the system these files were created on I think I'd need to be processing thousands with fully saturated data before it became an issue...
06:23:25Varriountics: Probably.
06:23:52icsThough I am trying to learn Nim in part because my Python proof of concept was just a *tiny* bit slow just to exec from the shell
06:24:09icsThat was my excuse anyway...
06:24:31Varriountics: It will probably be faster than Python, if only because Python does quite a bit of work encoding everything.
06:24:47*lompik quit (Ping timeout: 264 seconds)
06:25:20Varriountics: If you want real fun, try using memory mapped files. :D
06:25:23*zaquest joined #nim
06:25:40VarriountHello zaquest
06:25:51icsI'm hoping that as I learn a bit more I can play around with actually generating new files from all sorts of random junk and then putting them back on the Mac Classic they came from. Fun!
06:26:03zaquesthello
06:27:10*yglukhov quit (Ping timeout: 245 seconds)
06:27:42icsMemory mapped files... *sees module...* maybe next weekend...
06:33:02icsThanks Varriount, that was very helpful. Enough to keep the bits flowing a little longer.
06:34:31*vendethiel quit (Ping timeout: 245 seconds)
06:38:26*Jesin quit (Ping timeout: 240 seconds)
06:47:04*Jesin joined #nim
06:49:40*vendethiel joined #nim
06:59:03*krux02 quit (Quit: Verlassend)
07:00:23*gour joined #nim
07:11:00*vendethiel quit (Ping timeout: 248 seconds)
07:16:07*brson quit (Quit: leaving)
07:20:01*desophos_ joined #nim
07:23:56*desophos quit (Ping timeout: 252 seconds)
07:24:59ThePythonicCowVarriount wrote << as streams are essentially function tables >>
07:25:57ThePythonicCowIf by "streams" you mean the stdio based routines, such as those that read from stdin, then the slowness is due to more than a function ptr table.
07:26:45ThePythonicCowIt's also due to the additional data copy ... stdio does system call reads into its own buffers, and then copies out the characters, strings, whatever is asked for, into the caller's buffers
07:27:40ThePythonicCowRaw speed comes from avoiding copies, and further from avoiding any inefficient scanning, of the data.
07:29:34ThePythonicCowI was working inside Bell Labs, in the 1970's, on Unix and C, when stdio was introduced ... it's performance costs were controversial then, and still are in my mind.
07:33:09ThePythonicCowIt's my impression, though I'm not an expert in the matter, that Perl has worked around this with its own high performance i/o independent of stdio, for default i/o ops.
07:34:44ThePythonicCowBut other than that, the only escape for speed freaks is C code using read/write syscalls and minimal copying/scanning.
07:37:18ThePythonicCowI don't know Nim anywhere near well enough yet to have a reliable clue, but it seems on the surface that its natural structures, such as its strings (length plus nul term) will mandate at least one copy, and its memory management may reinforce that mandate.
07:37:34AraqThePythonicCow: cool to have you around. too bad that Unix is the best you guys could come up with ;-)
07:38:07ThePythonicCowAh ? ... what's wrong with Unix ? <grin>
07:39:40Araqthe file hierarchy, the case sensitivity, the 'fork' system call, the security concept, the basic design ideas ... ;-)
07:40:04ThePythonicCowI doubt that Nim can do what Perl did, avoiding copes of most incoming data ... Perl is rather too fuzzy-wuzzy do whatever Larry Wall means, so can play games with its internal data representation
07:40:27ThePythonicCowNim is too transparent (good!) as to its choice of data layout, memory management and such
07:41:11ThePythonicCow<< file ... case ... fork ... security ... basic design >>.... all things I love about Unix/Linux !
07:41:22*Demon_Fox quit (Ping timeout: 240 seconds)
07:41:37ThePythonicCow(which means that the next great generation of operating system will probably not come from my keyboard)
07:44:55Araqyes, it will come from mine.
07:45:21ThePythonicCowexcellent ... I should screen shot this ... so I can brag that I knew you when !
07:45:52Araqtoo bad I have much better things to do. but in 10 years ... who knows.
07:46:14ThePythonicCowgood new O.S.'s are a young man's game ... better hurry up
07:47:37ThePythonicCowI don't have a good mapping of names to who does what around here ... are you the lead creator of Nim, or is my newbie ignorance about to embarrass me again?
07:49:12Araqyeah I'm that guy.
07:50:07ThePythonicCowcool language ... first one I've seen with the clean semantic power of Python (part of my screen name) and the speed of C (my most expert language)
07:50:25ThePythonicCowI just might have to change my screen name (of 15 years now) to "theNimCow" :)
07:57:53Araqthanks.
08:06:26ThePythonicCowMy initial objective is to port a fancy backup program that I've been working on for many years to Nim plus lmdb ... lightning memory mapped database.
08:07:14ThePythonicCowI see where fowlmouth uploaded a straight c2nim of the lmdb.h header file to github last year ... but otherwise I have not noticed any interaction of Nim and lmdb yet.
08:07:45ThePythonicCowIf someone reading this in the near future knows of more Nim + lmdb work, kindly let me know.
08:09:20Araqsure. I have a monetdb wrapper that I need to open source
08:11:14Araqsee you later guys
08:11:33ThePythonicCowAt first glance, just now, MonetDB is quite different than lmdb ... not what I would need
08:11:43ThePythonicCowHave a good day Araq - good to meet you here
08:13:17ThePythonicCowlmdb is a B+ memory mapped <key, value> store, not a table or relational dbms ... lmdb is an absolute speed freak
08:14:25VarriountThePythonicCow: I meant streams as in the Nim module
08:15:10ThePythonicCowAre those streams implemented using stdio ... my first glance at the code just now suggests to me that they are
08:15:24VarriountWell, the file stream is.
08:15:45ThePythonicCowah - there are other streams ? (newbie question, sorry)
08:16:08VarriountThePythonicCow: Not in the module, however it provides an interface for others.
08:16:31VarriountYou could have, for example, a 'RandomData' stream.
08:16:45ThePythonicCowok - sorta makes sense
08:17:05VarriountThe stream structure contains a bunch a procedure pointers to the underlying implementation routines.
08:17:26ThePythonicCowok - that's what was meant by the function ptrs then
08:17:32ThePythonicCowok - that's what was meant by the function ptrs then ?
08:17:47VarriountYes.
08:18:11VarriountThePythonicCow: http://nim-lang.org/docs/streams.html#StreamObj
08:18:18*vendethiel joined #nim
08:18:55ThePythonicCowso default Nim file i/o is done using function ptrs to a stream implementation using stdio ... yeah ... not going to get a speed freak excited :)
08:19:21VarriountThePythonicCow: Well, that's not the default for IO, that's just a choice.
08:19:38ThePythonicCowok
08:19:53ThePythonicCowI should shut up ... my typing is getting ahead of my cluefulness
08:19:58Varriounthttp://nim-lang.org/docs/system.html#readBytes,File,openArray[],Natural,Natural
08:20:19VarriountEh, be careful of that URL, it might not open correctly.
08:21:37VarriountThePythonicCow: Essentially, the builtin file routines use the underlying stdio procedures.
08:21:59ThePythonicCowURL opened ok for me (Firefox on Linux).
08:22:16ThePythonicCowThose links go into the docs further down that I've read so far ... lots to learn
08:22:44VarriountThePythonicCow: Don't try memorizing system.nim, or else your head will explode.
08:24:03ThePythonicCowNo problem ... I'll keep tinkering with it, as I have many languages in the past ... until I either get good at it, or get interested in something else
08:24:18*yglukhov joined #nim
08:26:10VarriountAraq: Can intrinsic functions be imported, or must the emit pragma be used?
08:26:23VarriountEr, by import, I mean importc
08:28:41*yglukhov quit (Ping timeout: 245 seconds)
08:30:05ThePythonicCowWouldn't intrinsic functions be handled by Nim as if they were just another C routine ... and then let the C compiler realize it can inline that code?
08:30:24VarriountThePythonicCow: Probably?
08:30:34ThePythonicCow:)
08:40:22*dashed quit (Quit: Connection closed for inactivity)
08:42:01VarriountThePythonicCow: Ah, the importc and nodecl pragmas seem to work.
08:42:52ThePythonicCowgood - someday I will understand what you just wrote :)
08:43:08Varriountimportc replaces use of the Nim procedure with the imported C identifier, and nodecl prevents Nim from generating a prototype in the C file.
08:47:43ThePythonicCowah "no-decl", not "node-cl" - ok
08:49:29VarriountThePythonicCow: I'm trying to make use of GCC & Clang's builting byte swapping routines.
08:56:59ThePythonicCowok
08:58:17*darkf joined #nim
09:03:49*Varriount quit (Disconnected by services)
09:03:49*Varriount_ joined #nim
09:06:45dom96hey ThePythonicCow, thank you for buying Nim in Action and for all the feedback you've given :)
09:09:01ThePythonicCowYou're welcome - - damn good book -- just 45% of the way through -- good read and informative
09:09:34*vendethiel quit (Ping timeout: 250 seconds)
09:10:14dom96Glad you're enjoying it :)
09:29:21*desophos__ joined #nim
09:32:42*desophos_ quit (Ping timeout: 256 seconds)
09:37:45*irrequietus joined #nim
09:40:42*vendethiel joined #nim
09:46:12*irrequietus quit (Remote host closed the connection)
09:47:05*irrequietus joined #nim
09:49:20*yglukhov joined #nim
09:53:45*yglukhov quit (Ping timeout: 240 seconds)
09:59:24*desophos__ quit (Read error: Connection reset by peer)
10:03:18*vendethiel quit (Ping timeout: 256 seconds)
10:05:21*vendethiel joined #nim
10:13:53*sheerun joined #nim
10:14:35*lg_ quit (Ping timeout: 264 seconds)
10:23:04*irrequietus quit (Remote host closed the connection)
10:26:31*irrequietus joined #nim
10:28:25*vendethiel quit (Ping timeout: 245 seconds)
10:35:05*ephja joined #nim
10:38:00*filcuc joined #nim
10:38:19*vendethiel joined #nim
10:38:54filcucwhat is the correct way for passing the pointer to the first element of a seq to C
10:39:21*gokr joined #nim
10:39:30filcuclet a: seq[int] | let b: pointer = a[0].addr
10:39:59filcucgives me "expression has no address"
10:50:29ephjain case of 'let', use unsafeAddr
10:50:36ephjaif it's not to be modified of course
10:50:56*Matthias247 joined #nim
10:51:01filcucno just to be read
10:51:12filcucfrom C
10:52:46ephjajust replace addr with unsafeAddr then. it should work
10:55:32filcuc:| no same error
10:56:30filcuclet b = a[0].unsafeAddr
10:56:52filcucgives me again "Error: expression has no address"
10:56:55ephjahow old is your version? an unsafeAddr bug was fixed recently
10:57:13ephja18 days ago
10:57:31ephjano that's when the issue was opened. I meant 7 days ago
10:58:04filcuchash: 732479b797422adaadf6891b8d8c32230f548692
10:58:40filcucephja: ok for safety i'll rebuild everything with today master branch
11:01:06*vendethiel quit (Ping timeout: 256 seconds)
11:01:16filcucephja: yes i checked the git log and i don't have the fix for https://github.com/nim-lang/Nim/issues/3736
11:09:36filcucno same error with latest devel
11:10:37filcucpastebin.com/dWJVFg2e
11:10:49filcucthe error comes from line 44
11:18:23ephjafilcuc: is it compatible with the latest revision for DOtherSide on github?
11:19:14ephjaI guess not. I don't see a nim module
11:20:35filcucephja: the nim module has been moved to nimqml
11:20:58filcucephja: the dotherside it's just the C library
11:21:47filcucephja: right now i'm working on a separate branch (objectFactories) in the nimqml repo
11:22:31filcucephja: for updating the bindings for the upcoming changes made in the dotherside library
11:24:04*jaco60 joined #nim
11:24:33*vendethiel joined #nim
11:24:40ephjaok. share the dotherside module and I'll test your code
11:26:23*endragor quit (Remote host closed the connection)
11:29:14filcucephja: just git clone the nimqml objectfactories branch
11:29:43filcucephja: https://github.com/filcuc/nimqml.git
11:30:00filcucephja: git clone https://github.com/filcuc/nimqml.git && cd nimqml && git checkout ObjectFactories
11:30:24ephjaI was trying it with nimble. I used the wrong case
11:31:59filcucephja: for correctly compile you'll need also to build the dotherside library..but it's needed for the linking phase and but right now the error i have comes from the compile time phase
11:33:19filcucfor testing (one you clone) go to the examples/helloworld directory and type nim c --path:../../src main.nim
11:33:30filcuc*once*
11:36:17*gokr quit (Quit: Leaving.)
11:37:53ephjafilcuc: it does seem like a bug to me
11:38:44ephjabut you could loop over the indices instead, and then do signalDefinitions[i].parametersTypes[0].unsafeAddr
11:39:40filcucephja: ok i'll try that, thank you ;)
11:40:33ephjaI would personally rename it to 'parameterTypes', or perhaps just 'parameters'
11:43:54filcucephja: yep probably but that it syntactic sugar..i've a lot of more work to do :) basically i've to rework all the QObject macro...
11:44:28filcucephja: so right now the renaming it's not on the top of my todo list :)
11:44:55*vendethiel quit (Ping timeout: 276 seconds)
11:44:57filcucephja: given also the user shouldn't create a qmetaobject manually...it should be created by a macro at compile time
11:50:46*yglukhov joined #nim
11:55:45*yglukhov quit (Ping timeout: 240 seconds)
12:00:48*skyfex joined #nim
12:01:03ephjaAraq: should it be possible to apply unsafeAddr to non-var loop symbols? (for x in [1]: discard x.unsafeAddr)
12:01:10*wuehlmaus joined #nim
12:02:41*junw joined #nim
12:03:11filcucephja: i'll fill an issue
12:04:42Araqephja: doesn't this work already with devel?
12:04:59AraqI recently improved unsafeAddr
12:05:01filcucephja: Araq: to be honest if i think about it i can see that it's not a safe thing to do..i mean, if i think in C++ this should work iff the loop variable is a reference
12:05:23filcucso for (const auto& ref : container) or (auto& ref : container)
12:05:29Araqwell it's called unsafeAddr ...
12:05:44Araqso any safety regards are pointless
12:06:01filcucAraq: yes i agree but i'm saying a different thing
12:06:36filcuci mean that i don't know if writing " for x in sequence" means that x is reference or a copy
12:07:36*vendethiel joined #nim
12:07:37filcucso in turn i don't know if doing " let c = x.unsafeAddr " is taking the address inside the sequence or of the copy
12:08:04Araqyeah well it seems like you need to learn about 'mitems'
12:08:14filcucprobably
12:08:25filcuc:)
12:08:55ephjathe sequence is immutable though
12:09:41ephjaAraq: well, I use a revision that is about 2 days old. you did fix another bug that I discovered. reporting it
12:09:59filcucAraq: this is a test case http://pastebin.com/Bz7K1hci
12:10:25filcucif you think that it's a bug i'll create an issue of github
12:10:33filcucin
12:15:17ephjafilcuc: does qml cut down on the development time? gtk et al have gobject interfaces which allows for automatic generation of bindings
12:15:31ephjaanyway, I'm looking forward to it, as are many others I'm sure
12:16:28ephjathough gtk isn't so bad, but a lot of people are upset with the state of gtk
12:19:50filcucephja: it' a matter of being proficient in a technology. I'm biased because i love Qt. But basically Qml it's like XAML done right (if you know MS techs)
12:20:37filcucephja: the idea is to create databound applications. So the qml layer (visual) basically just pull data from the backend.
12:21:44filcucephja: but UI it's a hot topic and to be honest you should take your own poison
12:22:11filcucbe it gtk, wxwidgets, web techs or whatever
12:24:18arnetheduckVarriount_, had a chance to look at those exceptions?
12:24:31filcucAraq: if i cannot use mitems(myseq) since myseq it's a proc parameter..should i "var copymyseq = myseq" ?
12:25:52Araqfilcuc: well if it's immutable maybe you shouldn't try to mutate it ;-)
12:26:13Araqyou can use a 'var' parameter to make it mutable
12:26:17filcucephja: i'll write in the forum when the next release comes out
12:26:31Araqbut if you're just doing it for speed, don't. It usually is not necessary
12:26:55filcucAraq: i don't want to mutate it, but i would like the loop variable to be a reference to the element not a copy. With mitems() i think that basically i'm forcing it to be a reference
12:27:09filcuccorrect?
12:27:37Araqcorrect.
12:28:41filcucAraq: i don't know if you looked at the last pastebin i posted. Basically i want to iterate over a sequence and store the addresses of its elements
12:28:52ephjabut you can't pass in a let anyway
12:29:33ephjavar goes in, var goes out (of mitems, typically)
12:29:39filcucAraq: and right know i'm facing the "Error: expression has no address"
12:30:04*vendethiel quit (Ping timeout: 256 seconds)
12:30:10filcucephja: infact i asked if i've to workaround it by " var copy = myseq"
12:30:23arnetheduckAraq, ran into something - when a variable is declared local (no *), it should in theory not be accessed by other modules directly, so in most cases it could be made private (static global), and yet, if an iterator accesses it, the name will be used in other modules as well, so they have to import it with extern, and all seemingly private vars have to be exported from each module, just in case.. an example is environment in system - it's private to
12:30:24arnetheduckthe os module but osproc uses an exported iterator (envpairs) and thus in the c code, environment is accessed through an extern.. any thoughts on this?
12:30:37filcucbrb
12:32:01arnetheduckkeeping it private would make it easier to optimize, but also lessen inter-module deps which opens the door for smarter recompiles
12:32:34ephjafilcuc: is it going to be type safe?
12:33:56Araqarnetheduck: you're describing the effects of inlining.
12:34:27Araqthe solution is to not rely on such petty optimizations and embrace link time optimizations.
12:34:38Araqwhich LLVM supports too.
12:34:50filcucephja: what?
12:35:21arnetheduckyeah, it could be solved with LTO, but it's also kind of wasteful.. just wondering if there's some way to tell from the ast what belongs in which module..
12:35:36arnetheduckelse, it kind of doesn't make sense to gen all those .c files, might as well just do a huge one
12:36:36ephjafilcuc: is the library going to be type safe? as in no untyped pointers and such that might cause segfaults and so on
12:39:16arnetheduckanyway, just wanted to check if this behavior is a feature or not ;)
12:39:33Araqarnetheduck: it does make sense since only the .c files that change need to be recompiled
12:39:58*dv- quit (Remote host closed the connection)
12:40:13AraqLTO is not wasteful, it's the only thing that makes sense to begin with.
12:40:24arnetheduck.. except you compile them all again if you want to apply lto
12:40:51Araqoptimizers should not be handicapped by the linking technology of the 70ies.
12:43:16ephjaamen
12:43:23Araqand no, you don't have to "compile them all again" for LTO.
12:43:39*skyfex quit (Quit: My Mac has gone to sleep. ZZZzzz…)
12:49:00arnetheduckwell, kind of... you take all ir and rerun optimization and machine code generation.. you get to skip some parsing, but..
12:57:45*junw quit (Ping timeout: 240 seconds)
13:00:07filcucfilcuc: i tried my best to do that. So yes. But as a side note, QML has internally a JS engine and so it's not a static language. But you should not need to use JS except for simple property bindings
13:01:57ephjaok. I assume you were referring to me :p
13:05:07*vendethiel joined #nim
13:08:33ephjaAraq: did we have a tool for deprecating old type names?
13:22:07*FreezerburnV joined #nim
13:22:34*yglukhov joined #nim
13:22:55ephjanevermind
13:26:56*vendethiel quit (Ping timeout: 250 seconds)
13:27:32*gokr joined #nim
13:33:36*gokr quit (Quit: Leaving.)
13:43:36*yglukhov quit (Remote host closed the connection)
14:06:47*vendethiel joined #nim
14:08:23*yglukhov joined #nim
14:09:08*lompik joined #nim
14:21:24*yglukhov quit (Remote host closed the connection)
14:22:05*yglukhov joined #nim
14:28:54*vendethiel quit (Ping timeout: 252 seconds)
14:28:55filcucephja: yep sorry, :)
14:40:35ephjais borrow with 'var' parameters broken?
14:40:53*vendethiel joined #nim
14:41:49Araqephja: possible.
14:43:58ephjait has been reported already
14:44:05Araqno
14:44:58ephjathis seems relevant https://github.com/nim-lang/Nim/issues/3082
14:45:16ephjaI meant by someone else, several months ago
14:45:45*yglukhov quit (Remote host closed the connection)
14:47:52*sheerun quit ()
14:49:41Araqok, so now that's been reported, fix it.
14:51:00ephjaI get lost whenever I try to fix anything
14:52:59ephjathough I didn't know about ?? before
15:00:16ephjano, that bug is slightly different
15:06:28filcucis it more idiomatic to usa newFoo() or a Foo.new
15:06:32filcuc?
15:06:38filcuc*use*
15:13:30*junw joined #nim
15:16:26Araqfilcuc: newFoo
15:19:41*Matthias247 quit (Read error: Connection reset by peer)
15:23:35ephjaAraq: https://github.com/nim-lang/Nim/issues/3832. where do I look? in sigmatch or somewhere else?
15:24:14ephjaI should also try to step through the code this time
15:26:26*vendethiel quit (Ping timeout: 272 seconds)
15:26:27Araqnimgrep -y sfBorrow --ext:nim compiler
15:26:45Araqcompiler/semstmts.nim
15:26:45Araq 1203: if sfBorrow in s.flags:
15:26:45Araq 1233: if {sfImportc, sfBorrow} * s.flags == {} and s.magic == mNone:
15:26:47Araq 1235: elif sfBorrow in s.flags: semBorrow(c, n, s)
15:28:45Araqsemcall.nim searchForBorrowProc
15:29:09Araqand it's immediately obvious why 'var' causes problem
15:29:11Araqs
15:30:07Araq # New approach: generate fn(x, y, z) where x, y, z have the proper types
15:30:07Araq # and use the overloading resolution mechanism:
15:30:20Araq call.add(newNodeIT(nkEmpty, fn.info, t.baseOfDistinct))
15:30:27*jaco60 quit (Quit: Leaving)
15:30:32Araqbut empty nodes are not L-values and so the code fails
15:30:47Araqpretty easy, no need to trace anything.
15:30:48*jaco60 joined #nim
15:32:25*sheerun joined #nim
15:32:53Araqyou could generate a dummy 'var' for that or you change the compiler that empty is a valid L-value
15:37:06*niv quit (Ping timeout: 240 seconds)
15:37:55*vendethiel joined #nim
15:39:34ephjaok
15:40:26*arnetheduck quit (Ping timeout: 250 seconds)
15:41:15*sheerun quit (Ping timeout: 240 seconds)
15:50:17*yglukhov joined #nim
15:53:02filcucAraq: is it better to use an object or a tuple for mapping a C struct
15:53:06filcuc?
15:53:18filcucright now i'm using a object that doesn't derive from RootObj
15:54:48*derka joined #nim
15:59:35*vendethiel quit (Ping timeout: 264 seconds)
15:59:54*Trustable joined #nim
16:02:14ephja"tyVar(tyDistinct T(tyInt int))", and hasDistinct remains false
16:02:44ephjamaybe I'll actually learn something this time. I'll continue later
16:03:55*vendethiel joined #nim
16:11:35*yglukhov quit (Remote host closed the connection)
16:21:08*skyfex joined #nim
16:34:59*irrequietus quit (Ping timeout: 264 seconds)
16:44:06*derka quit (Ping timeout: 245 seconds)
16:45:42*derka joined #nim
16:47:16*Trustable quit (Remote host closed the connection)
16:53:26*Jesin quit (Quit: Leaving)
16:57:25*irrequietus joined #nim
17:06:59*skyfex quit (Quit: My Mac has gone to sleep. ZZZzzz…)
17:22:06filcucis there a Nim beautifier?
17:25:04Araqnimfix but its not used anymore
17:35:56*gour quit (Quit: WeeChat 1.3)
17:43:12*derka quit (Quit: derka)
17:54:41*gour joined #nim
17:55:40*derka joined #nim
17:55:45*derka quit (Client Quit)
18:05:21ephjaAraq: a dummy var passed to 'call'? would empty as an L-value allow procs to accept 'empty' too? what about set[empty]?
18:05:55ephjawhat should I use instead of 'debug'?
18:07:22Araqecho tree works too
18:07:28ephjaright
18:07:55*Matthias247 joined #nim
18:09:59*derka joined #nim
18:12:14*yglukhov joined #nim
18:14:31filcucis there a page in the manual where the return value of a proc is explained?
18:14:54*derka quit (Quit: derka)
18:14:56filcuchow does: proc foo(): int = 0 work?
18:15:18filcucwhy we can directly 0 without using the implicit result variable?
18:15:52filcuci mean..i see three choices: return 0 | 0 | result = 0
18:16:13bbl_filcuc: if it's possible, why not?
18:16:39filcucbbl_: no problem for me i just didn't know that using directly '0' return that value
18:16:45ephjayes, but only if it's the last statement
18:17:04filcucso the last expression is also the proc return value?
18:17:18bbl_many langauges have that feature
18:17:18ephjaotherwise you have to either discard it or explicitly assign the value to a variable
18:17:23ephjafilcuc: it might be
18:17:34filcucbbl_: yep i'm not complaing
18:17:54filcuci didn't read it in the manual
18:18:08filcucso i was not sure about that..maybe it could work we just one single expression
18:18:11ephjawell, if it's the last expression in the proc block, then yes. 'if' can also be used as an expression: "let x = if true: 1 else: 2"
18:18:17filcucand not with multiple statements
18:18:35filcucfine thanks ;)
18:18:58ephjaright
18:20:03ephja"let x = if true: (echo 1; 1) else: 2"
18:20:07*irrequietus quit ()
18:20:31ephjaworks with 'block' too but it's a little ugly atm because it must be surrounded by parentheses
18:21:00*junw quit (Read error: Connection reset by peer)
18:21:05*junw_ joined #nim
18:21:17ephjaunlike 'if' expressions
18:26:43Araqephja: want my fix or do you like to fix it on your own?
18:29:42bbl_That's nice :P certainly less verbose than using lambdas in C++ to do the same
18:32:14filcucif i've a distinct type Foo = distinct pointer
18:32:43filcucis there a simpler way for nulling it istead of let f: Foo = nil.pointer.Foo
18:33:03filcuc(without writing a ad hoc proc)
18:33:33filcuci mean maybe by borrowing some operator
18:35:32Araqfilcuc: usually you define a NilFoo constant
18:35:57Araqand of course it's initialized to null implicitly for you anyway
18:36:32*derka joined #nim
18:36:52filcucok
18:40:12*Demon_Fox joined #nim
18:41:15*derka quit (Ping timeout: 260 seconds)
18:44:49ephjaAraq: your fix I guess
18:45:23Araqephja: sorry, I just noticed my fix doesn't work for every case. :-)
18:47:23*derka joined #nim
18:48:45*derka quit (Client Quit)
18:49:02*derka joined #nim
18:53:54*derka quit (Client Quit)
18:53:54*yglukhov quit (Read error: Connection reset by peer)
18:54:13*yglukhov joined #nim
18:55:08*Jesin joined #nim
18:57:03ephjaI guess I'll look for something even simpler and read commits
18:57:03*yglukhov quit (Read error: Connection reset by peer)
18:59:18*yglukhov joined #nim
19:02:25*derka joined #nim
19:02:45ephjaAraq: can I print the stack trace related to a specific line in a file? just before the next statement is processed
19:03:02*wh1t3r0s3 quit (Ping timeout: 276 seconds)
19:03:32*wh1t3r0s3 joined #nim
19:10:02*sinnyt joined #nim
19:10:36*sinnyt left #nim ("Good Bye")
19:11:11*derka quit (Quit: derka)
19:11:46*derka joined #nim
19:18:13*yglukhov_ joined #nim
19:18:13*yglukhov quit (Read error: Connection reset by peer)
19:20:29*yglukhov joined #nim
19:20:30*yglukhov_ quit (Read error: Connection reset by peer)
19:21:56Araqyou sound confused
19:22:13Araqwhat would a stack trace related to a specific file mean?
19:22:25*brson joined #nim
19:22:28Araqif n.info ?? "temp": writeStackTrace()
19:22:33Araqis certainly possible
19:32:03*derka quit (Quit: derka)
19:34:09bbl_https://github.com/baabelfish/nvim-nim if any vim users are interested to check this out, still really a work in progress but I'll get the first usable version out soon
19:34:41def-bbl_: ooh, very exciting!
19:34:49bbl_def-: thanks
19:35:59def-you're aware of the other vim plugin I guess. really looking forward to the nimsuggest integration
19:36:12bbl_def-: yeah, I forked it some time ago even
19:37:10bbl_This is/was a learning experience in vimscript and nim tooling so I did it from scratch
19:37:48*M-max quit (Remote host closed the connection)
19:37:51bbl_def-: you using vim?
19:40:30*yglukhov_ joined #nim
19:40:30*yglukhov quit (Read error: Connection reset by peer)
19:40:41bbl_Araq: I got a few requests for nimsuggest: it would be nice for the for loop variables (on line 21 && 22 in the picture in that repo) to get the skForVar with nimsuggest highlight and it would be really great if outline returned also the imported modules
19:41:31bbl_Should I add them to github?
19:43:58*Demon_Fox quit (Quit: Leaving)
19:46:42*yglukhov joined #nim
19:46:43*yglukhov_ quit (Read error: Connection reset by peer)
19:48:57*yglukhov quit (Read error: Connection reset by peer)
19:56:48*yglukhov joined #nim
20:02:10*yglukhov quit (Read error: Connection reset by peer)
20:02:24Araqyeah please and be a bit more specific cause I don't really know what you mean
20:03:47*Trustable joined #nim
20:06:49*pregressive joined #nim
20:06:51*yglukhov joined #nim
20:09:38gouranyone subscribed to nim-dev list can confirm it's in sync with the forum? i'm missing several posts since today afternoon...
20:09:44*yglukhov quit (Read error: Connection reset by peer)
20:16:58*yglukhov joined #nim
20:17:01*yglukhov quit (Remote host closed the connection)
20:17:33federico3gour: your email addr?
20:18:12gourgour at atmarama dot com
20:18:45federico3you show up subscribed 8 days ago and no bounces
20:19:31gourhmm...maybe it's some gray listing by the server...
20:19:49ldleworkHas anyone written a nice FSM?
20:20:07*nsf quit (Quit: WeeChat 1.3)
20:22:22*nsf joined #nim
20:33:18*yglukhov joined #nim
20:35:19ldleworkHow do I test for procs on a type in a concept?
20:36:21ldleworkoh I see
20:42:24ldleworkFSM is really easy to implement with methods
20:42:33ldleworkI was wracking my brain on how to do it with concepts.
20:43:37*Jesin quit (Read error: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number)
20:43:50ldleworkactually methods don't help much because the module that manipulates the states will still need to have imported the methods belonging to the state objects passed into it
20:44:04*Jesin joined #nim
20:44:15ldleworkIts like the only way to do it with a nice interface is to pass in a structure that has procvar fields
20:45:00ldleworkcrazy module system
20:45:17ldleworkwell I guess not
20:47:07*derka joined #nim
20:47:21ldleworkhi derka
20:47:32derkaidlework hi how are you doing
20:48:04ldleworkgood, just hacking on my game engine
20:48:12ldleworktrying to figure out a good way to do scene management
20:49:08derkaidlework c
20:49:20derkaidlework good luck dont know about scene management
20:49:43*yglukhov quit (Remote host closed the connection)
20:49:52*Jesin quit (Ping timeout: 256 seconds)
20:51:30*derka quit (Client Quit)
20:52:16*yglukhov joined #nim
20:52:39*filwit joined #nim
21:02:09ldleworkI'm terrified of using methods :3
21:04:17*gour quit (Quit: WeeChat 1.4)
21:09:58*k1io quit (Quit: Connection closed for inactivity)
21:24:45*M-max joined #nim
21:24:46M-maxqq: does nim have unary suffix operators?
21:25:01M-maxI know I can write an operator that handles +foo, but can I write one that handles foo+ ?
21:26:14*Jesin joined #nim
21:33:09*yglukhov quit (Remote host closed the connection)
21:33:32filwitM-max: no
21:33:55filwityou have to write: foo += 1
21:34:16*yglukhov joined #nim
21:34:17filwit(type of thing)
21:34:19M-maxah, but I'm trying to implement a parser combinator
21:34:27M-maxso I want foo+ to imply at least one foo
21:34:55M-maxit's not the end of the world, as I can just flip so that +foo has the same meaning, it's just slightly less elegant
21:35:32M-maxi.e. +foo transforms foo (a matching rule) into a rule that uses foo to match at least one time
21:36:34filwityou could always do something like: foo+0 which would allow you to specify a min/max count (with '0' acting as an 'infinite')
21:36:39filwitbut anyways...
21:38:02M-maxyes, I was just thinking that would be one way to do it
21:42:37*pregressive quit (Remote host closed the connection)
21:45:24Araqpegs uses prefix ops
21:46:27Araqwhich become natural soon enough, after all if math decided to use postfix or prefix is totally arbitrary anyway
21:46:38Araq*whether
21:47:53*Jesin quit (Quit: Leaving)
21:50:16ephjaM-max: https://github.com/fowlmouth/glossolalia
21:50:49ephjait's neat
21:51:12*mat4 joined #nim
21:51:17mat4hello
21:52:11M-maxwow: looks impressive!
21:52:27M-maxalthough the examples look pretty complex
21:53:40M-maxfor now I'm just trying to teach myself parsers (and nim), and trying to get something that implements something pretty close to pegs, but gives me an AST
21:54:24ephjait is a little difficult to learn
21:55:29*pregressive joined #nim
22:06:12*yglukhov quit (Remote host closed the connection)
22:06:16*TheManiac joined #nim
22:07:55*yglukhov joined #nim
22:12:09*yglukhov quit (Ping timeout: 240 seconds)
22:18:11*Demon_Fox joined #nim
22:28:08*T_ joined #nim
22:31:36*lompik quit (Quit: WeeChat 1.3)
22:32:25ldleworkI have a parent class `Foo = ref object of RootObj` and then I have a class `Bar = ref object of Foo`. I have a function that takes a Foo, and calls a multimethod on it. When I pass it a Bar, the multi-method for Foo is called, not Bar.
22:32:28ldleworkWhat gives?
22:32:36*T_ quit (Ping timeout: 252 seconds)
22:36:55*derka joined #nim
22:38:33ldleworkI thought that it was supposed to use dynamic dispatch
22:38:51ldleworkbut it doesn't seem to know about the Bar.method
22:42:49Araqdunno, usually it does that :P
22:43:12ldleworkAraq: Does Bar.method have to be imported where Bar.method is being called?
22:43:21Araqno.
22:43:50*Trustable quit (Ping timeout: 245 seconds)
22:44:29*Trustable joined #nim
22:45:33*pregressive quit (Remote host closed the connection)
22:48:38*darkf quit (Quit: Leaving)
22:48:47ldlework:(
22:49:37ldleworkAs soon as I pass this `ref object of Scene` GameScene object to a method that takes Scene (which is defined as `ref object of RootObj`) then calling any method on the GameScene object invokes the base Scene implementation.
22:50:25ldleworkcalling any multi-method that is
22:51:56ldleworkadding the .base pragma did not help
22:52:58ldleworkcalling the method on the object before passing it to the proc that takes the base-type calls the right sub-type implementation
22:53:05ldleworkshouldn't this work since they are all reftypes?
22:54:30mat4I have an object with a member variable fInit which indicated the invocation of an initialisation routine. For all dependent procs these flag is tested (assert). Exist there another way to check if initialisation was done ?
22:54:46ldleworkoh god
22:58:07mat4does Nim support contract programming ?
23:00:52mat4I've only found these pragma: '.requiresInit.'
23:01:32*euantor joined #nim
23:03:03mat4but it's unclear to me how the described, explicit initialisation is checked
23:03:48mat4or better ensured at compile time
23:08:47*shodan45 joined #nim
23:09:41*yglukhov joined #nim
23:11:54*cY63rJUnkY joined #nim
23:13:55*cY63rJUnkY left #nim (#nim)
23:14:57*yglukhov quit (Ping timeout: 240 seconds)
23:24:01*mat4 quit (Quit: Verlassend)
23:35:31*derka quit (Quit: derka)
23:36:49*Jesin joined #nim
23:37:09*desophos joined #nim
23:47:21*euantor quit ()