<< 09-04-2015 >>

00:00:54BlaXpiritno idea how nim "supports" 64 bit integers in JS
00:01:35flaviuBlaXpirit: A bignum-style implementation should be possible.
00:01:41BlaXpiritof course
00:01:45BlaXpiritbut currently
00:02:00flaviuI'd guess it currently just looses precision.
00:02:02def-The JS backend is pretty buggy from what I can tell
00:02:07def-would be nice if someone worked on it
00:03:18BlaXpiritjsgen is one of the few compiler parts that is not just rocket science to me
00:13:53*zama quit (Ping timeout: 264 seconds)
00:14:24*zama joined #nim
00:20:05*irrequietus quit ()
00:26:34*vendethiel joined #nim
00:26:49*flaviu quit (Remote host closed the connection)
00:27:13*flaviu joined #nim
00:31:58reactormonkBlaXpirit, https://github.com/Araq/Nim/labels/JS
00:35:42*mnemonikk quit (Ping timeout: 276 seconds)
00:36:29*mnemonikk joined #nim
00:45:30*pipeep quit (Excess Flood)
00:45:49*pipeep joined #nim
00:47:28*vendethiel quit (Ping timeout: 245 seconds)
00:54:37dom96is there a bug on github for arrays of objects not working as a const?
00:56:05Joe-Thttps://github.com/Araq/Nim/issues/1986 that rot of?
00:56:07Joe-Tsort*
00:59:00dom96not quite
00:59:04dom96That actually works for me with tuples
00:59:29dom96not that example
00:59:35dom96but in the case of my data structure it works
01:00:08dom96good night
01:04:34*vendethiel joined #nim
01:05:13*Demon_Fox joined #nim
01:11:27*BitPuffin joined #nim
01:11:40*pipeep quit (Changing host)
01:11:40*pipeep joined #nim
01:12:16*wb quit (Ping timeout: 240 seconds)
01:13:53*nande joined #nim
01:20:39*gokr left #nim (#nim)
01:24:57*BlaXpirit quit (Quit: Quit Konversation)
01:25:17*vendethiel quit (Ping timeout: 244 seconds)
01:27:39*endragor joined #nim
01:29:44*BitPuffin quit (Ping timeout: 252 seconds)
01:30:45*vendethiel joined #nim
01:34:56*no_name quit (Remote host closed the connection)
01:34:56*devzerp quit (Remote host closed the connection)
01:40:41*table joined #nim
01:40:50*Jervac quit (Quit: Offline)
01:41:03*devzerp joined #nim
01:41:05*no_name joined #nim
01:41:23tablewho can tell me when to release 0.10.4
01:41:32*MyMind quit (Read error: Connection reset by peer)
01:42:36*MyMind joined #nim
01:42:57tableIs there anyone else ?
01:43:18*no_name quit (Remote host closed the connection)
01:43:18*devzerp quit (Remote host closed the connection)
01:44:02tableok ,bye
01:44:06*table quit (Client Quit)
01:53:03*TEttinger quit (Ping timeout: 252 seconds)
01:53:38*vendethiel quit (Ping timeout: 272 seconds)
02:24:04*brson quit (Quit: leaving)
02:38:40*darkf joined #nim
02:51:04*endragor quit (Remote host closed the connection)
02:54:11*endragor joined #nim
03:00:24*Jehan_ quit (Quit: Leaving)
03:02:21Joe-Thttps://github.com/Araq/Nim/pull/2499
03:26:50*endragor quit (Remote host closed the connection)
03:51:47*endragor joined #nim
03:53:20*endragor quit (Remote host closed the connection)
04:03:40*Kingsquee joined #nim
04:08:33*jacksnipe quit (Ping timeout: 244 seconds)
04:09:48*jacksnipe joined #nim
04:10:26*endragor joined #nim
04:11:58*Menche quit (Quit: Leaving)
04:20:04*brson joined #nim
04:20:22*endragor_ joined #nim
04:24:05*endragor quit (Ping timeout: 264 seconds)
04:25:55*endragor_ quit (Remote host closed the connection)
04:36:46*endragor joined #nim
04:37:46*endragor quit (Remote host closed the connection)
04:46:09*Menche joined #nim
05:03:43*jokra quit (Ping timeout: 252 seconds)
05:11:50*TEttinger joined #nim
05:13:15*a5i quit (Quit: Connection closed for inactivity)
05:16:30*endragor joined #nim
05:19:36*brson quit (Quit: leaving)
05:23:15*RayoGundead joined #nim
05:28:45*endragor quit (Remote host closed the connection)
05:30:43*jokra joined #nim
05:39:15*endragor joined #nim
05:41:08*endragor quit (Remote host closed the connection)
05:43:14*Demon_Fox quit (Ping timeout: 256 seconds)
05:45:30*endragor joined #nim
05:45:30*endragor quit (Read error: Connection reset by peer)
05:46:00*endragor joined #nim
05:49:47*johnsoft quit (Ping timeout: 265 seconds)
05:56:38*HakanD_ joined #nim
06:22:20*MyMind quit (Read error: Connection reset by peer)
06:23:08*Pisuke joined #nim
06:24:45*BlaXpirit joined #nim
06:27:22*HakanD joined #nim
06:27:55*johnsoft joined #nim
06:30:29*HakanD_ quit (Ping timeout: 246 seconds)
06:34:36*nande quit (Remote host closed the connection)
06:41:15*Demon_Fox joined #nim
06:46:42*bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…)
06:58:54*gsingh93 quit (Ping timeout: 272 seconds)
07:04:23*Ven joined #nim
07:10:05*fowl quit (Quit: Leaving)
07:14:12*fowl joined #nim
07:23:01*endragor_ joined #nim
07:25:56*endragor quit (Ping timeout: 240 seconds)
07:31:36*irrequietus joined #nim
07:39:33*endragor_ quit (Remote host closed the connection)
07:40:03*endragor joined #nim
07:51:39*bjz joined #nim
07:59:02*Menche quit (Quit: Leaving)
08:00:23*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:04:04*pipeep quit (Ping timeout: 250 seconds)
08:12:42*pipeep joined #nim
08:18:40*coffeepot joined #nim
08:19:11*Trustable joined #nim
08:20:50*jasondotstar quit (Quit: Leaving)
08:21:49reactormonkAraq, am I too strict on requesting tests, already too many?
08:22:04Araqnah I think it's fine
08:23:32reactormonkAraq, 0-element arrays may be useful in certain instances
08:47:29LoneTechI've seen those used as placeholders for unknown sizes (at the end of structures) and to force alignment
08:48:02LoneTechthe former relies on the absence of bounds checking, though
08:49:24*banister joined #nim
08:52:53*johnsoft quit (Ping timeout: 264 seconds)
08:53:08*johnsoft joined #nim
08:55:02*Demon_Fox quit (Quit: Leaving)
08:56:23*endragor_ joined #nim
08:57:49*endragor_ quit (Remote host closed the connection)
08:57:53*milosn quit (Ping timeout: 245 seconds)
08:59:40*endragor quit (Ping timeout: 255 seconds)
09:01:52*endragor joined #nim
09:12:39AraqLoneTech: C doesn't support 0 length array afaik, but you can use int foo[] as the last struct element
09:15:12dtscodeLoneTech, Araq
09:15:12dtscode<dtscode> ,cc int foo[] = {};
09:15:13dtscode<candide> dtscode: warning: ISO C forbids empty initializer braces [-Wpedantic] error: zero or negative size array 'foo'
09:15:38dtscodecandide is the ##c c eval bot fwiw
09:16:05Araqdtscode: *as the last struct element*
09:16:20Araqor rather *struct field*
09:16:37dtscodeno you misundertood
09:16:52dtscodei was just confirming "<Araq> LoneTech: C doesn't support 0 length array afaik"
09:17:01dtscodenot debasing the struct thing
09:17:05Araqah ok, thanks
09:31:39*Trustable quit (Remote host closed the connection)
09:32:29*Trustable joined #nim
09:39:04*Tennis joined #nim
09:41:46*RayoGundead quit (Ping timeout: 246 seconds)
09:52:48*pafmaf joined #nim
09:55:29*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:00:53*milosn joined #nim
10:04:33*endragor quit (Remote host closed the connection)
10:05:02*endragor joined #nim
10:24:15*milosn quit (Read error: Connection reset by peer)
10:24:40*milosn joined #nim
10:28:19*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:34:13*pafmaf quit (Quit: This computer has gone to sleep)
10:37:01*bjz joined #nim
10:39:30*Ven joined #nim
10:41:17*irrequietus quit ()
10:41:56BlaXpiritAraq, flaviu, I reimplemented `re` based on `nre`
10:42:55*wb joined #nim
10:44:18BlaXpiritall `re` tests pass except for split -> ["", "this", "is", "an", "example", ""] there were no "" at ends
10:46:23flaviuGreat! IMO my API is more pleasant to use, but bug fixes are always nice.
10:47:09BlaXpiritthis is all the bug fixes you could want
10:47:21flaviuIf you're looking for additional fun, you can reimplement split(string, string) to properly handle len-0 needles.
10:47:25BlaXpiritwhat i'm trying to do here
10:47:27*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
10:47:44BlaXpiritis put nre and this in standard library
10:47:52BlaXpiritinstead of re
10:52:33BlaXpiritfixes yesterday's pull request
10:53:03BlaXpiritflaviu, are you ready to try for this?
10:53:18*milosn quit (Ping timeout: 245 seconds)
10:53:26BlaXpiritArаq isn't gonna like Option though
10:53:40BlaXpiriti don't like it, really
10:54:07*bjz joined #nim
10:54:18def-compile times also grow a lot when you build your own PCRE
10:54:36BlaXpiritflaviu, and I keep getting that problem with compilation
10:54:47BlaXpiriti think i know what it is
10:55:00*a5i joined #nim
10:55:09BlaXpiritwhen you use nre in your program and it fails to fully compile because of error in code
10:55:21BlaXpiritwhen you fix your program, then pcre fails to compile
10:56:27flaviuDefinitely a compiler bug though, it happens to everything that brings in external C source files.
10:56:54BlaXpiritwhat is parallelReplace in re?
10:57:06flaviudef-: And executable sizes get bloated. I still need to test the effects of dead code elim though.
10:57:57flaviuBlaXpirit: for pattern, replacement in args: # do replace
10:58:08BlaXpiritwhy is it "parallel" i dont get it
10:58:51flaviu"parallel" doesn't refer to threads.
10:59:01*bjz quit (Ping timeout: 256 seconds)
10:59:14BlaXpiritoh the only difference is you replace with `by[i]` not `by`
11:00:13flaviuIt's like `while stringHasCharacters: for pattern in patterns: if matchAnchored(..., pattern): # replace and break; inc idx
11:00:39BlaXpiritwut
11:00:44flaviuSemantics are more confusing, but it provides efficiency gains from avoiding string copies.
11:00:49flaviuhttps://github.com/Araq/Nim/blob/master/lib/impure/re.nim#L330-L348
11:00:59BlaXpiritwell of course i see the code
11:01:45BlaXpiritmaybe it was meant to be threaded?
11:02:01flaviuNo, the word parallel here has nothing to do with threads.
11:02:35BlaXpiritthere is nothing parallel here at all
11:02:41flaviu"Interleave matching of patterns" instead of "chain matching of patterns"
11:03:48flaviure. option, there isn't really a better solution here.
11:04:27flaviuExceptions will be excessively slow, and ref is basically the same thing but will abuse the GC even more.
11:04:33*milosn joined #nim
11:05:25*pafmaf joined #nim
11:05:38flaviuI don't like the idea of optional_t getting into the stdlib though.
11:06:29*untitaker quit (Ping timeout: 245 seconds)
11:07:56*jefus__ joined #nim
11:12:02*jefus_ quit (Ping timeout: 276 seconds)
11:13:49*irrequietus joined #nim
11:13:50*untitaker joined #nim
11:21:00*davidhq joined #nim
11:25:13*milosn quit (Ping timeout: 265 seconds)
11:26:52*bjz joined #nim
11:33:30*milosn joined #nim
11:58:41*pafmaf quit (Quit: This computer has gone to sleep)
12:04:40*HakanD_ joined #nim
12:04:40*HakanD quit (Read error: Connection reset by peer)
12:05:42*irrequietus quit ()
12:12:17*BlaXpirit quit (Read error: Connection reset by peer)
12:13:08*milosn quit (Ping timeout: 276 seconds)
12:13:13*BlaXpirit joined #nim
12:18:32*egrep joined #nim
12:21:32*banister joined #nim
12:30:49AraqBlaXpirit: parallelReplace is just another example that shows that I know much more about API design than you give me credit for :P
12:31:10BlaXpirithuh
12:31:21BlaXpiritAraq, what do you think about this?
12:31:45Araqsay you want to replace 'foo' by 'bar' and 'bar' by 'foo'. How do you do that with the standard replace?
12:32:06BlaXpiritreplace bar by foo, then replace foo by bar
12:32:16Araq"abc foo bar".replace("foo", "bar").replace("bar", "foo")
12:32:24novistwhere exactly can i get latest nimsuggest? one on github (https://github.com/nim-lang/nimsuggest) seems to be not updated for quite some time and compiling fails
12:32:42pigmejnovist: in nim github repo
12:32:47pigmejin compiler dir
12:32:48pigmej:)
12:32:55novisterr how do i build it then?
12:33:04HakanD_this question came up more than a few times in the last few days (:
12:33:07AraqBlaXpirit: try it and see for yourself
12:33:11*Kingsquee quit (Quit: Konversation terminated!)
12:33:21pigmejnovist: nim c ... :)
12:33:39novistits so hidden away.. k lets try
12:33:41*milosn joined #nim
12:33:46BlaXpiritoh right, Araq
12:33:50BlaXpiritthat's fine
12:34:04BlaXpiriti don't have anything against it, just couldn't understand it for the life of me
12:34:22Araqwell it needs to replace stuff "in parallel" for this to work
12:34:31BlaXpiriti get it now
12:34:40Araqif you find a better name I will deprecate the old one asap
12:34:43BlaXpiriti said earlier that i reimplemented `re` based on `nre`
12:34:52AraqI've read it
12:34:58BlaXpiritso, what do you think?
12:35:23Araqif nre includes PCRE as a C code that an immediate "no way dude" ;-)
12:35:36Araqlinux packagers *hate* this
12:36:00BlaXpiritthat's not something to be concerned about
12:36:06Araqno?
12:36:36BlaXpiriti'm sure flaviu would agree to use pcre in the same way that `re` uses it
12:37:07BlaXpiritit is even supported, just not the default
12:38:02Araqno we shouldn't have the C code in the repo at all, it frightens packagers
12:38:34BlaXpiriteasy change
12:40:24*BitPuffin joined #nim
12:43:38novistnimsuggest.nim(13, 7) Error: cannot open 'options'
12:43:39novistnim c compiler/nimsuggest/nimsuggest.nim
12:43:43novistthat must be not right
12:44:37*Jehan_ joined #nim
12:45:11pigmejnovist: cd compiler/nimsuggest
12:45:31novistsame
12:49:32BlaXpirithttps://github.com/BlaXpirit/nim-re-compat/blob/master/re.nim
12:49:54Jehan_Also a problem with including the C source is license pollution.
12:50:46Araqnovist: it works if you use nim like it's supposed to be used. where nim is in 'bin' and relative to that there is a '../compiler' dir
12:51:50novistthat worked, thanks
12:51:55novisthidden knowledge heh
12:55:24*milosn quit (Ping timeout: 252 seconds)
13:08:48*milosn joined #nim
13:18:49*Jehan_ quit (Ping timeout: 265 seconds)
13:19:37*HakanD__ joined #nim
13:19:37*HakanD_ quit (Read error: Connection reset by peer)
13:23:27Joe-Thttps://docs.python.org/3/library/stdtypes.html#str.translate
13:24:11Joe-Tpython can take a mapping, and replace all of those simultaneously
13:31:55BlaXpiritnope
13:32:05BlaXpiritcan't do that example with this. it replaces single characters
13:35:18AraqBlaXpirit: maybe a better name is "multiReplace" though
13:35:57BlaXpirityeah..
13:36:04BlaXpiritfunny thing is, it could be made parallel
13:37:57*Jehan_ joined #nim
13:38:43BlaXpiritjust try a few regexes at a time
13:43:16*milosn quit (Ping timeout: 240 seconds)
13:45:11*endragor_ joined #nim
13:45:42*endragor_ quit (Remote host closed the connection)
13:48:40*endragor quit (Ping timeout: 272 seconds)
13:51:17*milosn joined #nim
13:53:49*jefus__ is now known as jefus
14:01:11*endragor joined #nim
14:05:17*endragor quit (Remote host closed the connection)
14:05:36*milosn quit (Ping timeout: 240 seconds)
14:19:24*milosn joined #nim
14:29:40flaviuAraq: I have C code for good reason, I cannot depend on the OS PCRE version to provide the features I want. Jehan_: PCRE is BSD licensed, so it's not too bad.
14:31:45flaviure. packagers - It's possible to use the shared library. Still haven't gotten around to testing it with older PCREs like Debian and Ubuntu's, but it's possible.
14:33:53Jehan_Lots of Debian packages are horribly outdated.
14:36:36Jehan_I mean, some are 4-5 years old.
14:40:08*darkf quit (Quit: Leaving)
14:40:51Araqflaviu: we should simply fix re and add to the docs that nre is a good alternative it its docs and leave at that for the upcoming release
14:41:29flaviuAraq: That's fine with me.
14:42:11Araqand eventually we can move 're' out of the stdlib
14:42:23Araqbbl
14:42:44*endragor joined #nim
14:44:24*milosn quit (Ping timeout: 256 seconds)
14:46:07*endragor quit (Remote host closed the connection)
14:53:32*jefus_ joined #nim
14:56:15*Jehan_ quit (Ping timeout: 252 seconds)
14:56:27*jefus quit (Ping timeout: 256 seconds)
14:58:50*bcinman joined #nim
14:58:54*Jehan_ joined #nim
14:59:49*endragor joined #nim
15:02:04*jefus_ is now known as jefus
15:02:16*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:02:38*endragor quit (Remote host closed the connection)
15:02:49*endragor joined #nim
15:03:20*bcinman quit (Read error: Connection reset by peer)
15:04:02*bcinman joined #nim
15:06:38*endragor quit (Remote host closed the connection)
15:10:01HakanD__is user defined type classes in a usable state?
15:10:38def-HakanD__: you can try it, but my tests didn't work yet
15:11:30HakanD__can't get it to do what i want, but not sure if they are buggy, or i'm doing it wrong(TM)
15:13:59HakanD__btw, I'm getting Warning: use 'concept' instead; 'generic' is deprecated [Deprecated], docs still shows it as 'generic'
15:16:00def-the docs are for the last release which is 0.10.2 and still has generic
15:16:15def-Would be nice to have online docs for devel branch though
15:32:15*jholland joined #nim
15:35:09*Sembei joined #nim
15:37:15flaviuCan verify that nre works fine dynamically linking with old PCRE libs.
15:37:48*endragor joined #nim
15:40:26BlaXpiritflaviu, so quit the douts and the stalling and embrace the opportunity
15:40:27*endragor quit (Remote host closed the connection)
15:41:27flaviuDoubts?
15:42:51BlaXpiritmissed a B there, yes
15:44:13flaviuI wasn't remarking on your grammar, so sorry if it looked that way. I don't understand what you're talking about.
15:44:49*irrequietus joined #nim
15:44:53BlaXpiritwe have an opportunity to fix `re`once and for all
15:45:11flaviuYes, and you said that you have a PR ready for that?
15:45:31flaviuKeeping API compatibility, right?
15:45:42BlaXpiriti have a lib ready, but it's not a PR yet because other things need to be done first
15:46:30BlaXpiritit has taken many bug reports and pull requests to "simply fix re" and many are yet to come
15:47:26BlaXpiritthis is the code i'm talking about. i've linked it earlier https://github.com/BlaXpirit/nim-re-compat/blob/master/re.nim
15:48:42*Arrrr joined #nim
15:48:55ArrrrHello Nimrod
15:49:42ArrrrIs anyone doing gamedev with nim ?
15:49:56flaviuArrrr: No longer Nimrod :)
15:50:31*Sembei quit (Max SendQ exceeded)
15:51:09coffeepoti'm doing gamedev
15:51:24ArrrrDo you have it on github?
15:51:35coffeepotnope, not even at that stage yet haha :)
15:51:50ArrrrWell, what are you doing anyway?
15:51:55coffeepotusing opengl with the wrapper from nimble, and basic3d
15:52:17coffeepot3d game using voxels
15:52:18*HakanD__ quit (Read error: Connection reset by peer)
15:52:54ArrrrAh, and how it is going on?
15:53:06flaviuBlaXpirit: Oh, I see. Your lib is a wrapper around nre.
15:53:11coffeepotpretty cool actually, i really enjoy coding in nim
15:53:25coffeepotnice performance even when not in release
15:53:59coffeepotwhat are you planning gamedev-wise?
15:54:20ArrrrNothing for now, just curious about the state of this programming language
15:55:18coffeepotin my experience, it's pretty good. Put it this way, I started in python and gave up due to performance. Prefer nim to python now :3
15:55:35ArrrrI can see that happening.
15:55:50ArrrrHow much time have you spent with nim?
15:56:14coffeepotum, hard to quantify, found out about the language a few months back and have been doing bits and bobs in it since
15:56:36*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:56:37coffeepotif I can sort out a native sql wrapper i'll start using it at work - it's just a really nice language to work in
15:57:13*milosn joined #nim
15:57:13Arrrrbtw what's the difference between nimble or nible and babel
15:57:46coffeepotwhen nim was renamed from nimrod, babel was renamed to nimble. Other than that nothing AFAIK?
15:58:19ArrrrI see, i thought it. Thanks
15:58:30coffeepotdom96 wrote nimble so he can tell you better :)
15:58:49ArrrrDo you know about Ultima Ratio Regnum? it is written in python
15:59:10Arrrr*being
15:59:58coffeepotI hadn't heard of it but it looks cool :)
16:00:42coffeepoti am being rather ambitious with my game and it'll have a lot of physics in 3d with thousands of particles flying about so I have to have the performance off the bat
16:01:35coffeepoti love mud style games tho, might give this a proper look later :)
16:01:51ArrrrDoes it take you more or less code lines?
16:01:56Arrrrin comparation to Python
16:02:04coffeepothmm, i'd say around the same
16:02:14coffeepoti prefer the nim syntax though
16:02:15ArrrrDo you miss something from Python?
16:02:24coffeepotnot yet!
16:02:27pigmejrepl ;P
16:02:47coffeepotisn't someone doing a repl library?
16:02:51ArrrrDoes nim use duck typing?
16:02:55pigmejyeah it 'wroks' :)
16:03:32*BitPuffin quit (Remote host closed the connection)
16:03:50flaviuArrrr: Sure. Generics are typechecked after expansion.
16:04:02*BitPuffin joined #nim
16:04:39ArrrrI dont understand that, could you expand it?
16:04:45flaviu.eval proc add[T](a, b: T): T = a + b; echo add(1, 2), ' ', add(1.0, 2.0)
16:04:46Mimbusflaviu: 3 3.0
16:05:22Arrrrlol, is that a bot?
16:05:34pigmej.eval echo "nope"
16:05:35Mimbuspigmej: nope
16:05:48flaviuyep, thanks to dtscode for writing it
16:06:04ArrrrAnd how efficient it is?
16:06:20pigmejit needs to compile your expression
16:06:26pigmejso it takes a while ;)
16:06:38flaviuThe generics? 0-overhead, they are specialized at compile time.
16:06:57coffeepotperformance is close enough to C
16:07:13flaviuie, add[T](a, b: T): int gets turned into something like addInt(a, b: int): int
16:07:15pigmejthe major difference is => python has dynamic types (let's say), nim has static
16:07:32ArrrrI understand. I want to learn this
16:07:39coffeepotalso nim has dead code elimination (is that on by default btw?) and really nice compile time expression
16:08:09ArrrrBut those 400+ issues give me the creeps
16:08:34pigmejArrrr: http://bugs.python.org/
16:08:48pigmej(4799) btw
16:08:51coffeepothonestly for general use I haven't noticed any bugs
16:08:58coffeepoti haven't got into macros yet tho
16:09:00*endragor joined #nim
16:09:26ArrrrI use mostly Java. Btw, are pragmas like java's annotations?
16:09:27flaviupython might also have lots of bugs, but they're obscure bugs.
16:09:39flaviuArrrr: Yep
16:10:30ArrrrFantastic.
16:10:40ArrrrAre you a contributor by a chance flaviu ?
16:11:13flaviuSmall contributor, I've mostly focused on my own libraries rather than the compiler.
16:11:23coffeepotwarning, when you get used to unified call syntax its hard to go back ;)
16:11:36coffeepot*unified function call syntax
16:11:57coffeepotmaybe it's just me but UFCS is just awesome :)
16:12:01ArrrrAnd what is that?
16:12:06pigmejcoffeepot: +1
16:12:23flaviuArrrr: foo.bar() == bar(foo)
16:12:36flaviu.eval 1.echo
16:12:38Mimbusflaviu: 1
16:12:46coffeepotit means you can extend any class or type with no effort
16:12:46ArrrrAh, i remember you could choose whatever style you liked
16:13:23pigmejcoffeepot: except you still need to write a function :P
16:13:51ldleworkHas anyone come up with a demo of deploying Nim to the web?
16:14:03pigmejArrrr: generally ufcs allows you to extend / change class / type behaviour without changing the class itself
16:14:04ArrrrAnd i remember vars in nim were case and underscore insensitive, like myBigVar == My_Big_Var
16:14:05coffeepotyeah it makes it much more readable IMHO. Sometimes it's nice to be able to go, say, float(a.b.c), sometimes you want a.b.c.float it's just nice :)
16:14:23pigmejin python / java you would need to inherit the class, patch it or something
16:14:32coffeepotarrr: yeah, nice with numbers: var a = 1_000_000
16:14:33pigmejin nim you just write a function where first arg is your 'object'
16:14:41flaviuArrrr: Not quite. Now the first letter is case sensitive.
16:14:51*johnsoft quit (Ping timeout: 250 seconds)
16:14:54flaviuPeople really like let foo: Foo apparently.
16:14:57pigmejArrrr: first is case sensitive the rest is 'whatever you wish'
16:15:05ArrrrI se
16:15:38pigmejwhich is also cool, because your code == your style :)
16:15:46Arrrrwith change classes you mean you can write an existing function and force the program to use it ?
16:15:56Arrrr*rewrite
16:15:58pigmejArrrr: not quite
16:16:18pigmejfunction has arguments, right?
16:16:29pigmejso nim calls correct function based on name AND types
16:16:40pigmejso, if you have a matching function it calls it
16:16:40pigmejthe end
16:16:41pigmej.
16:17:24pigmejand because there is nothing special like 'object functions' (yeah yeah I know...) you just write a function that you need and it works
16:17:31ldleworkGuess not.
16:18:21ArrrrAnd if im not mistaken, objects are not a thing here. Im not used to programming without objects.
16:18:32coffeepotalso distinct is another awesome feature. You can have two int types for example, and set them distinct so they are not 'compatible'. Hard to explain but for example useful for money types where you dont want to be able to go dollars=euros
16:18:34pigmejArrrr: there are object
16:18:36pigmejobjects*
16:18:43flaviuArrrr: What do you mean by objects?
16:19:01coffeepotyou can do full OOP in nim
16:19:42ArrrrYes, i wanted to say OOP
16:19:43pigmejArrrr: just write a function where first arg type is your object type.
16:19:57pigmejthen you can do object.my_function
16:20:19ArrrrSo, can i declare a type of var that consists in a group of vars?
16:20:41ArrrrLike a class
16:20:57flaviuArrrr: You do have inheritance and virtual methods.
16:21:11pigmejArrrr: yeah you can have object of any other objects / types
16:21:32pigmejhttp://nim-lang.org/tut2.html#object-oriented-programming
16:21:48ArrrrLast time i checked there were public and private methods with '*' symbol. Does this still exists?
16:21:48coffeepothome time for me, have fun guys :)
16:21:55pigmejcoffeepot: cu!
16:21:56Arrrrthanks pigmej
16:22:04Arrrrsee you coffe
16:22:10pigmej* are available outside
16:22:18pigmejwithout * are available only in this file
16:22:56pigmejso it's kind of public / private but not exactly
16:23:07ArrrrDo people program with many * functions?
16:23:30pigmejArrrr: probably 'depends'
16:23:48*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:24:41ArrrrDoesn't exist packages or namespaces like in c# ?
16:25:13pigmejmore like in python
16:25:37pigmejfile == module and you can import from it
16:25:55pigmej(or include if you with)
16:25:58pigmejwish*
16:26:18flaviuPlease don't use include though. It's confusing.
16:26:55pigmejflaviu: it works like C equivalent ?
16:27:06pigmejit inserts contents of file to another file, isn't it?
16:27:10flaviuYes.
16:27:27ArrrrOh, and is there a way to enforce immutability?
16:27:28flaviuBut it gets confusing when you read a file and can't figure out where things are defined.
16:27:58pigmejArrrr: what do you mean by immutability ?
16:28:04pigmejsomething like final in Jav?
16:28:22ArrrrInitialize a variable with certain value and dont allow its value to change
16:28:27Arrrryes
16:28:28flaviuSure, let.
16:28:45ArrrrDoes it work when defining a type?
16:29:14pigmejArrrr: for this you can use setter with "private" field
16:29:23flaviuLike a final field? No.
16:29:26pigmejafaik there is no 'final' for object field
16:29:47ArrrrWhy not?
16:29:54pigmejArrrr: why should it be?
16:30:39pigmejyou can make something like as I said, with "private" field and "public" setter
16:30:48ArrrrWell, it is usefull. If you dont want to make every field private and write an access
16:30:55flaviuI don't know for sure, but it might be because it's impossible to enforce.
16:31:13pigmejArrrr: it's C level
16:31:15*Tennis quit (Quit: Leaving)
16:31:18pigmejso you have memory access
16:31:35ArrrrAnd also, it is easier to catch certain errors. If you are working inside the same file where the type is declared, you could ignore that
16:31:38pigmejalso ptrs so... ;-)
16:32:10pigmejArrrr: emulate it then with setters
16:32:15pigmejif you really need them
16:32:23flaviuI wonder if a macro would work here.
16:32:46ArrrrYeah, well i suppose nim will give me a lot of alternatives. Just wanted to know if there were a reason to allow final vars and not final fields
16:33:08Arrrr*was
16:33:37pigmejwell, because final variable has to be initialized on start
16:33:49pigmejyou cannot define final variable and use it later
16:34:24pigmejwhich obviously is no go for OOP
16:35:00pigmejflaviu: what macro? inlined setters are already compact and no overhead, isn't it?
16:35:14ArrrrHow are objects constructed? Do constructors exists, or how does it work?
16:35:36pigmejArrrr: http://nim-lang.org/tut2.html#object-oriented-programming
16:35:36pigmej ;d
16:36:04Arrrrheh, i read a bit but
16:36:06pigmejin this section: http://nim-lang.org/tut2.html#objects
16:36:21pigmej" They provide inheritance and information hiding. Because objects encapsulate data, the T() object constructor should only be used internally and the programmer should provide a proc to initialize the object (this is called a constructor
16:36:21pigmej"
16:36:21ArrrrOnly saw this: "Student(name: "Anton", age: 5, id: 2)"
16:36:49ArrrrSo, what i wrote is actually a defined proc?
16:36:59Arrrror it just exists by default inside the file?
16:37:53pigmejnot at all, you just used object contructor, but you should provide newObject proc to initialize your object in hmm, friendly way
16:38:04flaviupigmej: A macro to generate the boilerplate.
16:38:17pigmejflaviu: ah :)
16:38:33ldleworkflaviu: did anything ever come of nimlets?
16:38:35pigmejI wondered if I miss something or so...
16:39:22flaviuldlework: It exists, and it works. I never came up with any snippets though.
16:42:55*Jehan_ quit (Quit: Leaving)
16:46:29ArrrrWell, i'll have a look at the tutorial, a shame there are no color syntax defined for nim in notepad++. Thank you flaviu and pigmej for your answers.
16:47:01pigmejArrrr: you can play with nim with aporia editor
16:47:10pigmejit understands nim
16:47:19pigmejmay be useful ;-)
16:47:20ldleworkflaviu: have you used asyncdispatch at all?
16:47:41flaviuArrrr: A few more links: https://nim-by-example.github.io/ https://howistart.org/posts/nim/1 http://goran.krampe.se/
16:47:44flaviuldlework: Nope.
16:47:45ArrrrHeh, i opened it, pressed to compile, it told me to select a compiler, i pressed to cancel and suddenly the ide crashed.
16:47:59flaviuldlework: nimlets is a static page generator.
16:48:04ArrrrI'll use plain notepad++. Thank you for those links flaviu
16:48:20ldleworkflaviu: it was a new unrelated question
16:48:46ldleworkflaviu: I'm wondering if Nim might grow any 'structured concurrency' in its asyncdispatch lib
16:48:58ldleworksomething like await { } or { }
16:49:25ldleworkand, await { } and { }
16:49:37pigmejldlework: 'unstable' afair
16:49:52ldleworkwhich treats the entire await block as blocking, only passing it with either block returns, or both, depending on what form you use
16:49:54pigmejdom96 is working on improvements also
16:50:54flaviuldlework: I'm the wrong person to ask, I haven't been keeping up with that stuff.
16:51:18dom96ldlework: not entirely sure what you want to achieve with that syntax
16:56:33ldleworkdom96: I'm trying to write an example but holy crap I've forgotten how to write any Nim at all
16:56:35ldleworklol
16:59:55ldleworkdom96: https://gist.github.com/dustinlacewell/98b49e21576ce4792042
17:01:17ldleworkIt will make both calls in parallel. The first block to finish, causes the other block to be canceled, and the whole await block is passed, reaching the final return
17:01:40ldleworkYou can imagine a looping version of this too
17:01:48ldleworkThat establishes multiple concurrent contexts
17:02:36dom96you can already do that
17:02:43dom96But you need to put the blocks in separate async procs
17:02:54ldleworkdom96: can you modify the example
17:03:03pigmejdom96: but parallel have something similar by default, isn't it?
17:03:17pigmejwaitAny or sth
17:04:46dom96https://gist.github.com/dom96/88e06687979c0883c9de
17:04:57dom96pigmej: I think so
17:05:01dom96I haven't used it yet
17:05:42*Menche joined #nim
17:06:04pigmejdom96: I think it would be cool to have something like awaitAny http://nim-lang.org/threadpool.html#awaitAny,openArray[FlowVarBase]
17:07:03dom96you could probably implement that easily with async's await.
17:07:12pigmejsure :)
17:07:22pigmejjust saying about having something like that by default
17:07:48pigmejdom96: anyway, do you still consider async things as beta ?
17:07:51dom96PRs welcome
17:08:11dom96yes, but you should use it, if it interests you.
17:08:21dom96the forum somehow manages to run on it
17:09:14pigmejcool
17:09:16*endragor quit (Remote host closed the connection)
17:12:21pigmejdom96: forum runs on jester + async?
17:12:39dom96yep
17:14:25pigmejcool
17:14:32pigmejanyway, cu
17:15:15ldleworkdom96: that's kind of gross tho :)
17:16:52*Matthias247 joined #nim
17:18:02ldleworkShouldn't the compiler be able to detect calls to async functions and treat them specially without 'await' ?
17:18:35ldlework"What color is your function? Red or Blue?"
17:18:44ldleworkdom96: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
17:19:07ldleworkReally nice article that made me very interested in E/Erlang/Monte
17:19:13EXetoCit's all in userland
17:20:48ldleworkEXetoC: right, I get that
17:21:00ldleworkBut it still makes Nim a language with polychromatic functions.
17:21:57ldleworkI recommend that article, its really good!
17:22:50ldleworkthis is also good, https://vimeo.com/103492194
17:26:55ldleworkthis is extra credit, I guess, http://joearms.github.io/2013/04/02/Red-and-Green-Callbacks.html
17:27:14EXetoC"Async functions don’t compose in expressions because of the callbacks, have different error-handling, and can’t be used with try/catch or inside a lot of other control flow statements." did we have a similar problem before? or maybe it was something else but I think it was just temporary
17:29:21ldleworkWell await takes care of that problem he's mentioning there.
17:29:37ldleworksince now you can call red functions from a blue function.
17:33:12Arrrr'The third and last way to write string literals are long string literals. They are written with three quotes: """ ... """'
17:33:35ArrrrWould be nice to have literals with l" ... " as rawstrings
17:35:03flaviuArrrr: Already exists. r" ... "
17:35:19ArrrrYea, but it is not the same (i think)
17:35:21Arrrrit is
17:35:21ldleworkflaviu: I think he means for long string literals
17:35:22Arrrr?
17:35:58flaviu.eval echo r"\n"
17:36:01Mimbusflaviu: \n
17:36:57ArrrrThe tutorial says "string literals" are written with """ blablabal """
17:37:24ArrrrSince rawstring uses r" ... ", why not l" ..." for literal strings
17:37:29*BitPuffin quit (Ping timeout: 276 seconds)
17:37:39ldleworkArrrr: the r is bad and annoying
17:37:43flaviuI don't understand what "literal strings" are supposed to be.
17:37:49ldleworkwhy would you want to extend its annoyance to normal strings?
17:38:00flaviuA small gotcha, btw:
17:38:01flaviu.eval echo """\n"""
17:38:02Mimbusflaviu: \n
17:38:09Arrrrbecause is more annoying to write 6 "
17:39:19flaviuArrrr: Use C, you'll learn to appreciate some verbosity :)
17:39:49ArrrrI have more than enough with java
17:40:04ldleworkArrrr: oh you mean, use the quote prefix instead of 3 quotes
17:40:23Arrrr6 quotes actually
17:40:37ldleworkI mean its not a terrible idea/observation
17:40:37Arrrror well, 6 chars for that matter
17:41:56flaviuArrrr: 3 if you have a decent editor.
17:42:04def-then your literal string can't contain "?
17:42:31ArrrrMost editors will auto close the first one.
17:48:34Arrrr"Note that declaring multiple variables with a single assignment which calls a procedure can have unexpected results: the compiler will unroll the assignments and end up calling the procedure several times." This is indeed dangerous
17:48:51*drewsrem joined #nim
17:54:32drewsremTrying to write a compile-time "proc" that takes an int and returns a new char-array with size of that int filled with some arbitrary char (e.g. X) - this doesn't work as a simple proc: http://ix.io/hM8 - at the same time, AFAIS I can't return values from templates or macros - any basic pointers?
17:57:46Joe-Tis there a reason opcWrArr ensures that regA is a rkNode?
17:58:24Joe-Thttps://github.com/Araq/Nim/issues/2473
17:58:58Joe-TopcWrDeref is putting into the reg at 0, rkNodeAddr
17:59:01ldleworkEXetoC: flaviu if you guys read that article I'd love to hear your opinons on it at some point
17:59:37Joe-Tthen a bit after that, opWrArr is called, where the register value has to be a rkNode
17:59:54Joe-Tbut it is actaully rkNodeAddr at that point in the test program in that issue
17:59:59*gsingh93 joined #nim
18:00:28Joe-Tit works if I remove the ensure(tkNode) (by removing the decodeBC)
18:00:39Araqldlework: I read it. want to hear my opinion? ;-)
18:00:48Joe-Tand then using regs[ra].regToNode..., but dunno if that would break anythign else or if
18:01:04Joe-Tthe bug is actually nothing to do with that block, but with whatever generate the instructions in that order
18:02:27ldleworkAraq: of course I do
18:02:47AraqJoe-T: opcWrArr only deals with nodes because an array is mapped to a node
18:03:29Araqldlework: it's essentially completely correct
18:03:36Joe-Tbut what about nkNodeAddr, and nkRegisterAddr
18:04:12AraqJoe-T: these should have been transformed to a node via some deref instruction
18:05:22Araqldlework: we doesn't go into the disadvantages of blurring the async/sync distinction but the commentors do
18:05:24*johnsoft joined #nim
18:05:38Araqso it's all good if you also read the comments ;-)
18:06:28Joe-Tso the bug is opcLdDeref should be called at some point?
18:06:49AraqJoe-T: you can modify the vmgen or vm.nim modules and run tests/testament/tester cat vm and see if you introduced any regressions
18:07:46AraqJoe-T: yes I think so, but this code is very complex because Nim's datatypes are very complex
18:07:48renesac|awayAraq: I'm doing the change to what is considered "arrow like"
18:07:53*renesac|away is now known as renesac
18:07:59Araqrenesac: excellent
18:08:03renesacif L > 1 and tok.ident.s[L-1] == '>' and
18:08:03renesac ('-' in tok.ident.s or '=' in tok.ident.s): return considerStrongSpaces(1)
18:08:19renesacthat way "-+>" would be arrow like
18:08:25renesacbut "+>" not
18:08:28*Sembei joined #nim
18:08:37Araqbut +-> would be too?
18:08:40renesacyes
18:09:01renesaci check if there is any = or - in the operator, as the code line above
18:09:05Araqtest tok.ident.s[0] in {'-', '='} instead
18:09:17Araqwe look at the first or last char in an operator
18:09:28renesacok
18:09:29Araqbut have no rule yet that says "and this and that *somewhere*"
18:09:51renesacthere is no test about arrow like operators yet, right?
18:11:51ArrrrWhy incrementing a var with '++' isn't supported? i get an "Error: invalid indentation"
18:12:02ArrrrDon't know if bug or made on purpouse
18:12:08renesacArrrr: you can create a proc like this
18:12:13renesacbut it isn't in stdlib (yet)
18:12:29renesacI created one in my bithacks library, but I haven't properly released it yet
18:12:34renesacuse "inc x"
18:12:38Arrrrthe tutorial says i can use inc(), but im curious to know the reason behind this
18:12:39renesacor "x.inc"
18:13:06Arrrrso, not being able to use ++ is not a bug.
18:13:10renesacArrrr: the reason is because Nim don't derive it's syntax from C
18:13:31*xet7 joined #nim
18:13:37renesacagain, you are free to define your own ++ operator
18:14:24ArrrrOk, thanks. Actually using inc x is not that bad.
18:14:45ArrrrBut well, is hard to get rid of the classic ++
18:14:45renesachttps://gist.github.com/ReneSac/37bce0429eb4fc5d1ac3
18:14:48renesacthere
18:15:18ArrrrOh, that's nice. Thank you renesac. What does {.discadable.} means?
18:15:20ArrrrWhat is doing?
18:15:36renesacthat you don't need to assign the return value of the proc to a variable
18:15:52renesacyou can do simply "++x", not "foo = ++x"
18:16:01ArrrrAh, so if you dont want to include a return, you need that
18:16:05ArrrrI recall this
18:16:14renesacno
18:16:47renesacthis is, if the proc returns something, and you don't want that return value where you call it, you have to write "discard bar()" to ignore the return value of bar
18:17:04renesacthe discardable pragma frees you from having to write that
18:17:52ArrrrSo ... is like x = result of proc?
18:17:55BlaXpiritin C if you call a function that returns int, you can just ignore that int. Nim makes you do something about it (if there is no .discardable.)
18:18:45ArrrrI see. Is this made to enforce a good practice ?
18:19:46renesacyeah
18:20:59renesachttp://nim-lang.org/tut1.html#discard-statement
18:21:00*Sembei quit (Ping timeout: 252 seconds)
18:21:09renesacI should have linked this from the start
18:21:36renesacby the way, I updated my gist
18:21:37ArrrrAnyway im following that tutorial, so i'll get there. Thanks for pointing this to me
18:21:54renesacit is now "SomeInteger", "TInteger" is deprecated
18:21:57*brson joined #nim
18:22:18*milosn quit (Ping timeout: 264 seconds)
18:22:36ArrrrSomeInteger? wtf
18:23:40renesacit is a concept that matches any type of integer
18:23:53renesacto make it a more generic function
18:24:19renesacyou could use simply T, but then it is a bit too generic
18:24:37renesacor simply "int", and it would probably suffice most of the time
18:25:00*milosn joined #nim
18:25:02ArrrrYeah, but is a funny name. It still gives me the wrong identation error
18:25:15Arrrrhttp://pastebin.com/ftf1Fp9w
18:25:40Arrrr'statement.nim(5, 4) Error: invalid indentation'
18:26:08BlaXpiritArrrr, maybe it's actually the first line
18:26:11BlaXpiritoh wait
18:26:18BlaXpiritno, it isnt
18:26:38BlaXpiritno postfix operators in nim
18:26:50ArrrrCan it be related to this? https://github.com/nim-lang/c2nim/issues/10
18:26:50*xcombelle joined #nim
18:27:04BlaXpiritno
18:27:11renesacit is a prefix operator
18:27:12flaviu.eval import macros; dumpLisp(i++)
18:27:13Mimbusflaviu: eval.nim(4, 13) Error: expression expected, but found ')'
18:27:18renesacno postfix operators in nim
18:27:31flaviusee? If it was valid synatx, that would have given a AST.
18:27:36flaviu.eval import macros; dumpLisp(++i)
18:27:38Mimbusflaviu: Prefix(Ident(!"++"), Ident(!"i"))
18:27:54renesacif you want the C's i++ behaviour, you can define a `+++` or something
18:28:18BlaXpiritproc `+++`*(x: var SomeInteger): SomeInteger {.discardable.} = result = x; inc x
18:30:05ArrrrWhat you mean by "no postfix", that i can only do this?: i ++
18:30:09Arrrrwith a separation
18:30:18flaviuArrrr: Let's see.
18:30:21flaviu.eval import macros; dumpLisp(i ++)
18:30:22Mimbusflaviu: eval.nim(4, 14) Error: expression expected, but found ')'
18:30:31*davidhq quit (Read error: Connection reset by peer)
18:30:32*davidhq_ joined #nim
18:30:57renesacBlaXpirit was faster than me, but the gist is updated again
18:31:43renesacArrrr: unary operators can only be placed in front their operand
18:31:57renesacand binary operators must be put between their operands
18:32:21ArrrrOk, now it works
18:32:32renesacops
18:32:40Arrrryes, you put dec two times
18:32:47renesacyeah, corrected
18:33:03ArrrrThanks
18:33:19*vendethiel joined #nim
18:33:45xcombellehi! I rediscoverd nim. Looks pretty neat (sadly more complex than python)
18:33:54*irrequietus quit ()
18:34:18drewsremhttp://ix.io/hMb - can someone provide me pointers why this doesn't work? (simple expression macro)
18:34:24renesacxcombelle: unfortunatedly a expressive static type system is more complex
18:35:00renesacand performance optimization also brings some complexity
18:35:11Arrrrdid you resolv your last problem drewsrem ? i was interested in
18:35:20Araqdrewsrem: the types downright lie :-) within a macro everything is a NimNode
18:35:29Arrrrthe one with the proc creating an array
18:35:57renesacAraq: there are no tests for arrow like operators?
18:36:11Araqrenesac: there are in ... macros iirc
18:36:34renesac./koch test c macros?
18:37:17renesacthe closure macro one
18:37:20renesacwell, all pass
18:37:33Araqexactly tclosuremacro is it
18:37:50drewsremArrrr, I'm on it
18:38:06Araqalso the future.nim module uses them and has tests it its main section
18:38:10drewsremAraq, I see
18:38:42Araqdrewsrem: you can extract the int value from a node but this is not guaranteed to work
18:39:05Araqyou need to use static[int] but this is so buggy I feel ashamed
18:39:22Araqbut I'm working on static[T] now, at last.
18:39:31drewsremAraq, not myint.intVal ?
18:40:00xcombellerenesac: but it's the neater C speed language I saw
18:41:17Arrrrmuh rust
18:41:21renesacAraq: \o/
18:41:48*renesac waits for the triunfant come back of semistatic (some day in the future)
18:41:52renesacXD
18:41:57drewsremArrrr, this seems to work superficially http://ix.io/hMf
18:42:16drewsremArrrr, so basically, using generics and then writing a macro wrapper
18:42:34renesacby the way, I'm tempted to remove {.discardable.} from the `+++`
18:43:03BlaXpiritthat's cool
18:43:11renesacoperator, as one should use the ++ one if he wants only the side effects anyway
18:43:28ArrrrSeems so hacky, but i dont know much about macros drewsrem
18:43:40ArrrrIt is fair renesac
18:43:52drewsremArrrr, so basically, calling fillX(23) is the same as calling fillXArray[array[23, char]]()
18:43:54drewsremArrrr, it is
18:44:24ArrrrDoes performance suffer ?
18:44:40drewsremArrrr, on my end?
18:44:51ArrrrUsing macros like that
18:44:56xcombelleoh ? the thread share nothing by default: good point
18:44:58drewsremArrrr, no, macros are compile time
18:47:45drewsremAraq, retrieving an intVal from a node can fail?
18:48:41Araqdrewsrem: of course!
18:49:05Araqvar x: int; thamacro(x)
18:49:25Araq<-- no value at compiletime
18:49:51drewsremAren't vars 0-initialized?
18:49:52*BitPuffin joined #nim
18:50:35*repax joined #nim
18:50:45*itPuffinB joined #nim
18:51:29Araqdrewsrem: not the point
18:51:31drewsremAraq, ah I see, thanks for the heads-up
18:52:15drewsremIt's fine for my requirements
18:52:26drewsremI think
18:53:39xcombelleis there some interpreter written in nim ?
18:53:45ldleworkbrainfuck
18:54:00renesacmal lisp one
18:54:00ldleworkhttps://github.com/def-/nim-brainfuck
18:54:13*BitPuffin quit (Ping timeout: 252 seconds)
18:54:22renesachttps://github.com/def-/mal
18:54:44Arrrrrenesac: i noticed your gist included var inside the definition of the ++ argument. Is the purpouse to make it mutable? Are arguments by default inmutable?
18:54:54renesacyes
18:55:11*itPuffinB quit (Ping timeout: 250 seconds)
18:55:12ArrrrOk, thanks.
18:57:16*user7181 joined #nim
18:59:13ArrrrOn the forum it is said a new version is about to be released. What has changed since the version used in the tutorial?
18:59:43BlaXpiritabout a million bugs fixed
18:59:53Arrrrhaha
19:00:24BlaXpirithttps://github.com/Araq/Nim/blob/devel/web/news.txt
19:01:30Arrrrconst objects, nice
19:07:18xcombelleuntil now the hardest thing about nim comparing to python is it's habit to automagically create variables
19:08:15*Sembei joined #nim
19:08:43Araqxcombelle: python had to introduce a nonlocal keyword because of this "feature"
19:11:13federico3xcombelle: only that?
19:11:15xcombelleAraq for example in the import which as far as I understand don't specify which names are imported
19:12:21renesacxcombelle:
19:12:24renesachttp://nim-lang.org/manual.html#import-statement
19:12:35renesacsee below for "From import statement"
19:13:39renesacxcombelle: consider editing this wiki page too: https://github.com/Araq/Nim/wiki/Nim-for-Python-Programmers
19:14:30xcombellerenesac I saw it but the problem is it is not the community way to do it so the examples looks like sort of magic for example https://github.com/dom96/jester
19:15:04renesacyeah, the downside is that it is a bit difficult to know from which module some function came from
19:15:09renesacjust by looking at the code
19:15:27renesachopefully we will have very intelligent nim IDEs soon, so that will be less of a problem
19:16:07federico3I'd love a Vim plugin to do Nim autocompletion
19:16:10renesacbut when you are programming, it works very well
19:16:12Araqit works with nimsuggest for me...
19:16:33xcombellerenesac I really love that in python we pretty know where a variable come in existence just by grepping the code
19:16:35renesacwhen you are reading someones code on github, that can be a problem
19:16:58xcombelleand I love grepping code by hand
19:17:03federico3don't this leads to name collisions?
19:17:20renesacfederico3: when there are collisions, you must disambiguate then
19:17:33renesaclike system.open, foo.open
19:17:35renesacbut just for that
19:17:54*Sembei quit (Max SendQ exceeded)
19:18:11renesacor you "from foo import nil" and it namespaces everything in that module like python default import
19:18:57renesacI do like the explictiness of python, but the Nim way works better for the method call syntax
19:18:58federico3wait a second: what if I'm using a 3rd party library that starts exposing "open" only from a certain version? Suppose my code is already written and deployed
19:19:37renesacthat probably will lead your code to not compile anymore
19:19:49federico3as I feared. urgh.
19:19:50renesac(so much for {.procvar}s
19:20:07renesac(so much for {.procvar.}s)
19:20:26EXetoCjust include the module name as often as you like then
19:20:51Arrrrcan you call procs like file.proc ?
19:20:57EXetoCyes
19:20:59*irrequietus joined #nim
19:21:02Arrrrfor example, Math.sum(1, 2)
19:21:06Araqfederico3: usually overloading resolution disambiguates then
19:21:19ArrrrSo, it seems like a good practice to always to this
19:21:24renesacArrrr: lower case on that Math
19:21:29federico3I suppose there's a good practice of using descriptive names
19:22:10renesacnim don't adopts the Zen of Python
19:22:22EXetoCit helps to introduce more types too
19:22:24renesacAraq don't seems to like it very much
19:22:56xcombellerenesac: as far as I understand it's quite necessary because thre is a lot of type and importing them would be boring
19:23:14BlaXpirittypes are actually the least of a problem
19:23:32BlaXpiritin python all the operations on a class reside inside the class
19:23:58BlaXpiritin nim if you import just the class, you can't even use the classes getter functions, can't use any operators
19:24:56*bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:25:06Arrrrlol
19:25:17Araqyou know, you can pretend the module is the class and then you get the same behaviour as in python
19:26:45EXetoChere we go again :p
19:27:36ldleworkoh gawd
19:27:44BlaXpiriti'm not even criticizing anything here
19:27:59renesacAraq: by the way, I changed minds again, and now I think I might like your version of '\n'
19:28:06EXetoCd(:)|<
19:28:37renesacjust needs better documentation and I still think an optional parameter for open() is desirable, when using \L for example
19:31:31flaviuxcombelle: Everyone forgot the Nim interpreter written in Nim!
19:32:03xcombelleeh eh flaviu
19:32:27*brson quit (Ping timeout: 250 seconds)
19:32:59xcombelleI tried to do nimble install aporia and get CustomStatusBar.nim(41, 24) Error: undeclared identifier: 'False' (after a lot of deprecated warnings)
19:33:19ArrrrAny experience with nim's GC? How does it perform?
19:33:42*elbow_jason joined #nim
19:33:53flaviuArrrr: Not nearly as good as hotspot, but allocation is much rarer in Nim.
19:34:33ArrrrAnd i see you can even control it. is this a good idea?
19:34:53flaviuFor games it's critical.
19:35:10flaviuBut I'm not too familiar with the GC, maybe some in here can chime in.
19:37:13dom96xcombelle: nimble install aporia@#hed
19:37:15Arrrr"Every variable, procedure, etc. needs to be declared before it can be used[...] Later versions of the language may get rid of the need for forward declarations." is this going to happen anytime soon? I recall asking this some time ago
19:37:15dom96*head
19:37:48flaviuArrrr: Unlikely to happen soon. Macros and code generation introduce major difficulties.
19:38:08Arrrrpff, and for 1.0 ?
19:40:16xcombelledom96 this time after a lot of GcUnsafe: utils.nim(454, 40) Error: undeclared identifier: '^'
19:41:05Araqrenesac: I still don't see a problem really. what is "text-mode"? does it deal with encodings, the UTF8-BOM, trailing whitespace, trailing newlines at the end of the file? text-mode drops dead.
19:41:28dom96xcombelle: You need the latest nim compiler
19:41:58*repax quit (Remote host closed the connection)
19:42:19Araqrenesac: I see no convenience in *only* transforming CR-LF to LF.
19:43:02AraqArrrr: nothing it planned for 1.0 in this respect.
19:43:07Araq*is
19:43:31renesacwell, python's open has a multitude of options
19:43:32Arrrr:(
19:43:36*BitPuffin joined #nim
19:44:01renesacthe line ending one is one of them
19:44:12renesacwell, I might do a pull request in the future
19:44:13Araqrenesac: yes but then we are talking about a real new module that supports these things, not about a flag that mimics C's broken idea of a "text mode"
19:44:33renesacyeah, I'm not asking for text mode
19:44:56renesacjust a optional parameter to make line end conversions on read/write, if desired
19:45:07renesacby default nothing is done
19:45:19*HakanD__ joined #nim
19:45:33Araqinteresting, so you don't make it part of 'open'?
19:46:15renesacwell, in the end it would be an parameter for open, I think
19:46:21*drewsrem quit (Quit: Leaving)
19:46:22renesacI'm not sure how the implementation will be made
19:46:43renesacI don't really know how C implements the text mode
19:46:48renesacI only know what it does
19:50:56ArrrrWell, i have to go. Thanks again to renesac and flaviu for their help. I suppose i'll come back tomorrow for more answers
19:50:59*Arrrr quit (Quit: Page closed)
19:59:37*irrequietus quit ()
20:00:18*UberLambda joined #nim
20:01:18*rkj-b joined #nim
20:01:35*UberLambda quit (Read error: Connection reset by peer)
20:01:51*UberLambda joined #nim
20:09:37xcombelledom96 with the devel nim branch and the head branch od aporia it's still fail with utils.nim(454, 40) Error: undeclared identifier: '^'
20:11:17dom96make sure you don't have two nim compilers in your PATH
20:11:22dom96I can compile it fine
20:14:17*Jehan_ joined #nim
20:14:19BlaXpiritxcombelle, yeah, u have an old compiler
20:14:44BlaXpiritit can be an old release or an outdated devel
20:15:08BlaXpiritthis stuff is FAQ-worthy
20:15:18BlaXpiritundeclared identifier: '^' in 99% cases means u need to update
20:18:28*bcinman joined #nim
20:18:54xcombelleBlaXpirit, update to what master or devel ?
20:19:06BlaXpiritxcombelle, master doesn't support ^ yet
20:19:13BlaXpirityou need to update to latest devel
20:19:32BlaXpirityou may have devel but not latest
20:19:46HakanD__hmm, the compiler just hangs without giving any errors, any tips on how i can find what is wrong?
20:20:39BlaXpirityesterday i thought the compiler hung but it actually took so long for nim js
20:20:58*Menche quit (Quit: Leaving)
20:23:26def-BlaXpirit: you bootstrap with ./koch boot -d:release?
20:23:37BlaXpiritdunno
20:24:27def-HakanD__: you could build a temporary compiler with --linedir:on --debuginfo and use GDB to check where it hangs
20:24:51def-or just disable parts of your code until you notice what makes it hang
20:25:35HakanD__I know what makes it hang, messing around with user defined type classes. I will try that tomorrow, should be fun
20:30:27def-maybe setting a higher verbosity for the compiler might help
20:31:51dtscodesomeone said my name?
20:32:23*bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:33:15xcombellethanks a lot BlaXpirit dom96 it works
20:33:29*xcombelle quit (Quit: Leaving)
20:34:56*bcinman joined #nim
20:45:15*irrequietus joined #nim
20:47:02*brson joined #nim
20:49:52*user7181 quit (Ping timeout: 252 seconds)
20:51:31*user7181 joined #nim
20:55:03*UberLambda quit (Quit: Leaving)
21:21:15AraqJehan_: do you think it's feasible to look at a different thread's stack to determine if it's waiting on a syscall?
21:22:55*BlaXpirit quit (Quit: Quit Konversation)
21:22:56Jehan_Araq: Umm, I'd see the bigger problem with the rather OS-specific parts of determining whether a syscall is in progress and if so, if it's actually blocking.
21:23:22*BlaXpirit joined #nim
21:23:25Jehan_Or what do you mean?
21:23:34Araq"thread in syscall" is good enough for me
21:24:06Araqwhether blocking or not is not that important
21:24:47Jehan_Even that is … umm, it depends on the OS and even the processor type. Ideally.
21:25:00Jehan_It's sort of the anti-thesis of something that can be done portably.
21:26:50Jehan_And I'm not even sure if it can even be done on all of types of operating systems and architectures.
21:30:13Jehan_Realistically, what I've been doing when needing that is to wrap syscalls (or anything that does syscalls and that I can't inject code into) in a begin … end structure.
21:30:47Jehan_And yes, obviously, if that's forgotten somewhere, then things just block.
21:31:35Araqyeah but the stack pointer should be in a completely different address range, right?
21:31:56Araqbecause of memory protection between process and OS
21:33:31Jehan_But can you see the stack pointer? As long as the processor is executing protected code, you cannot access its registers, either.
21:35:46Jehan_I know you can do thread_get_state() on OS X, but even that's not portable.
21:36:08Jehan_within OS X across different processor types, I mean.
21:36:47Jehan_Generally, under POSIX, as soon as a thread does a syscall, it becomes a black box.
21:38:29Jehan_What's the specific background for the question, by the way? Garbage collection?
21:41:16*bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…)
21:43:09AraqI'm thinking about how to detect "every worker threads is blocked, start a new thread"
21:43:10*HakanD__ quit (Quit: Be back later ...)
21:43:30Araqand yeah, the stack pointer is not available, true
21:44:19Jehan_My preferred solution has been to distinguish between computer and I/O threads in general.
21:44:22*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:45:04Jehan_If you have threads that are supposed to do computations doing blocking syscalls you run into all kinds of other problems, too.
21:47:00*bjz joined #nim
21:54:12*Menche joined #nim
21:55:59*vendethiel quit (Ping timeout: 244 seconds)
21:56:41*user7181 quit (Quit: leaving)
21:57:18renesachttps://github.com/Araq/Nim/pull/2503 <-- done
21:57:30renesacthere were no tests in futures.nim
21:59:44*brson quit (Quit: leaving)
21:59:57*brson joined #nim
22:00:29*TEttinger quit (Ping timeout: 252 seconds)
22:01:03*saml quit (Quit: Leaving)
22:03:20dom96renesac: they exist somewhere among all the tests in the tests dir
22:03:38renesacyeah, under macros
22:03:41BlaXpiritwhat is this
22:03:45BlaXpiritwhat about ~>
22:03:56BlaXpiritthis is wrong
22:03:56renesacsee the updated PR message
22:04:09renesac?
22:04:49renesacyou want ~ to be counted as arrow like too?
22:05:00BlaXpiritwhat exactly does this achieve?
22:05:23BlaXpiritthis is just a random purposeless pull request
22:05:53renesacfrees up things like |> to be used as an arithmetic operator
22:06:19renesacyou might disagree though, I don't really fell too strongly about that
22:06:25BlaXpiritthis is not an arithmetic operator
22:07:03renesacI might assign it to shl
22:07:16*gsingh93 quit (Ping timeout: 240 seconds)
22:07:42renesacif this arrow like operator change is refused, then maybe only do |>= as a shl assignment operator
22:07:52renesacas the |> will have wrong precedence anyway
22:07:55*davidhq_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:08:12Araqrenesac: ~ is like - I guess
22:08:28renesacyeah, I forgot about it
22:08:43BlaXpiritjust why
22:09:37renesacto free up higher precedence combinations
22:09:59renesacthere are still plenty of possible arrow like combinations even with this change
22:10:21BlaXpirityou may have explained the benefits to someone
22:10:30flaviuWhen treating a seq as a stack, is the best way of peek `mySeq[mySeq.high]`?
22:10:31BlaXpiritbut i don't see it. but your pull request is isolated
22:10:52Araqflaviu: mySeq[^1] in devel
22:10:57renesac^
22:11:04flaviuThanks!
22:11:10*Menche left #nim ("Leaving")
22:11:54BlaXpiritpull requests are usually treated like this:
22:11:55dom96better yet, write a proc called 'peek'
22:12:00renesacBlaXpirit: the original reason was to use something like `*>` or `|>` as an alternative shr operator
22:12:15BlaXpirita pull request solves a problem, which is described in detail in an issue
22:12:37BlaXpiritrenesac, and why would anyone do that?
22:12:38renesacyeah, sorry, we only discussed this in irc
22:12:48*Matthias247 quit (Read error: Connection reset by peer)
22:12:52BlaXpiritso u did discuss, sorry for being so harsh
22:12:54renesacanyway, we can still discuss it in the PR page
22:13:23*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:14:22renesacit would be nice to enter in this release, but it is better not to be too rash either
22:15:01renesacif there is disagreement let's discuss it
22:15:28renesacyou already brought an overlooked point, the '~'
22:16:11*bcinman joined #nim
22:16:21*devzerp joined #nim
22:16:21*no_name joined #nim
22:20:05BlaXpiritstrange that Arаq decided to use only first character
22:20:42renesacI'm neutral on this
22:21:20*vendethiel joined #nim
22:25:38AraqBlaXpirit: well it's a minor thing and if it keeps renesac making PRs, it's well worth it
22:26:05renesaclol
22:26:18renesacas I suspected, it was a bait
22:26:55*bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…)
22:27:00renesacdon't worry, I was even thinking on other alternative operators
22:27:12*bcinman joined #nim
22:27:15renesaclike .| and .^
22:27:29renesacbut dot don't looks right, and might be problematic with ranges
22:28:03BlaXpiriti couldn't find anything looking like an arrow
22:28:13BlaXpiritexcept maybe >>---> lol
22:28:14renesacshl and shr are in the right precedence level, so an alternative operator for them might be more confusing than worth
22:29:06renesacwell, -&> don't really looks like an arrow, but is still an arrow operator under my patch
22:29:23Araqyeah I'm thinking about this
22:29:25renesacwhile +-> is not
22:29:39BlaXpiritdon't forget the actual arrow. >>--->
22:29:44Araqmaybe - = or ~ should be *before* the >
22:30:13BlaXpiritseems to make more sense
22:30:15renesacor maybe they should just be in the operator, and let people choose?
22:30:26BlaXpiritthat seems best to me
22:30:29Araqhum?
22:30:48BlaXpiritAraq, your previous rationale was "we don't have any rules for characters in the middle"
22:31:00AraqBlaXpirit: yes
22:31:06BlaXpiritwell now you'
22:31:10BlaXpiritve dropped it
22:31:28Araqit's still not somewhere in the middle
22:31:49BlaXpirit<-> exactly in the middle
22:31:54BlaXpiritwhatever
22:31:58Araqbut op[^1] == '>' and op[^2] in {'=', '-', '~'}
22:32:18BlaXpiritfine by me
22:32:20Araqit's still no *search*
22:32:23BlaXpiritas if someone cares
22:32:28Araqlol
22:32:32renesacfine for me too
22:32:40renesacit indeed might make more sense
22:33:37renesacand there is no big search to make
22:33:49renesacoperators rarelly are more than 2 characters
22:34:05renesacand I never saw something bigger than 3 characters
22:34:08BlaXpiritpossibly change description to "ending with -> => or ~>"
22:34:21renesacyeah, that makes for a nicer description
22:34:52BlaXpiritthat's gonna be a lot of commits :s
22:35:10*BlaXpirit quit (Quit: Quit Konversation)
22:35:13renesacnah, I can make it in a single additional commit
22:36:03def-why not "containing -> => or ~>"? This still looks arrow-like: ->*
22:36:51renesacas this: -+>
22:37:15renesacwell, this rule is for changing precedence
22:37:51renesacthe point of my PR is that we still want some operators kinda arrow like, but with higher precedence
22:38:20renesaclike for shift right, that you want the arrow indicating the direction, but don't want the lower precedence that comes with it
22:39:26renesacso ideally we would have a rule that gives plenty of both and isn't too complicated
22:40:27renesacthe simplest not so invasive rule seems to be "ending with -> => or ~>"
22:40:48renesacnot sure if it is the most consistent with the language though
22:42:17*bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…)
22:48:48*rkj-b quit (Quit: ChatZilla 0.9.91.1 [Firefox 37.0.1/20150402191859])
22:52:21Jehan_How about just being able to set operator precedence explicitly? (And if you have multiple overloaded definitions with conflicting precedence, you'll just have to use parentheses.)
22:53:31renesacJehan_: it was the first thing I suggested when I saw nim operators IIRC
22:54:26renesacas I discovered nim after I saw a python-like dialect that also let the user define it's own custom operators
22:54:58*gsingh93 joined #nim
22:55:47renesacbut I fear that setting the operator precedence might raise even higher the cognitive load of those arcane incantations that some modules define
22:56:09renesacas you would have to remember it's function as well as it's precedence
22:56:14renesacone more thing to remember
22:56:43renesacthough it took quite a while for me to mostly internalize the entire nim precedence rules
22:57:17Jehan_renesac: I generally think that use of custom operators should be minimized.
22:57:23renesacthat are not that simple, but at least you only have to learn once (for each of my PRs XD)
22:57:54Jehan_They are useful for DSLs and stuff that you use an awful bloody lot, but writing out a procedure name makes code easier to read in the end.
22:58:16renesacJehan_: yeah, the command syntax makes calling functions easier
22:58:44Jehan_You can also use it for an operator-like syntax.
22:58:52Jehan_E.g: let a = 1 .op 2
22:59:02Jehan_(At least I think it's fixed now so that you can.)
22:59:20flaviuMy favorite operator is the -| operator.
22:59:40flaviu/s, in case it wasn't obvious.
23:00:16Jehan_flaviu: I was about to say ...
23:01:34Jehan_I'd honestly make that a candidate for deprecation.
23:08:16*jefus_ joined #nim
23:09:56*vendethiel quit (Ping timeout: 252 seconds)
23:11:49*jefus quit (Ping timeout: 248 seconds)
23:21:16reactormonkAraq, interesting, the bug where I get a segfault with the GC, shared libs and threads seems to have disappeared
23:25:05*bcinman joined #nim
23:48:13*saml_ joined #nim
23:51:46*bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…)
23:53:16*a5i quit (Quit: Connection closed for inactivity)
23:54:57*Jehan_ quit (Quit: Leaving)
23:59:26*Jehan_ joined #nim
23:59:35*Demon_Fox joined #nim