<< 03-04-2015 >>

00:03:50flaviuI patched the compiler a while ago and it worked, but I vaguely remember noticing a potential bug.
00:04:42filwityeah I worked through most of them, I'm re-running some of my old tests with the backed-up compiler to see what was wrong
00:09:58*hellonico joined #nim
00:11:57Araqa "Potential bug"? your patch was all wrong!
00:12:16Araqbut I don't remember the details either :P
00:17:43filwithmm.. as var as I can tell my code was working well actually, I just never finished distinguishing between a call with a single parameter and a type-conversion
00:19:47filwitI think I read about 'destroy' and thought that might be a more painless and correct way implementing constructors as well
00:20:45filwitfor one, having a proc name be the same as a type means `module.Foo` is ambiguous without a context (which is doable, but perhaps not ideal)
00:21:18flaviufilwit: You could remove type conversions from the compiler completely.
00:21:21*Sembei joined #nim
00:21:34*Varriount_ joined #nim
00:22:46filwitflaviu: I'm actually not opposed to that, for other reasons, but I still think making a `proc create(f:var Foo) = ...` is the best syntax for construction to some degree
00:23:33filwitit also feels similar to `destroy`, and considering they're both related to a variables memory behavior, that feels right to me
00:23:40*Varriount quit (Ping timeout: 256 seconds)
00:23:46Araqremove type conversions from the compiler completely? o.O
00:23:56Araqhow do you bootstrap then?
00:24:15Araqor expect your "patch" to be ever merged?
00:24:45filwiti was thinking about converters, not type conversion in it's entirety... but I also said that without much thought
00:25:01flaviuPut type conversions in system
00:26:57filwitwait what am I talking about... i *use* converters in my math libs...
00:28:13*TEttinger joined #nim
00:29:21filwitand I like converters, and I like the type-conversion syntax as it is (i think it's simple and makes sense)... there isn't even a problem in with type-conversion syntax and constructors the way I had done it before, I just didn't complete it, and I think `create` makes more sense
00:30:07flaviuCreate has a disadvantage though, you can't call it Foo and return a Bar.
00:30:19flaviuie, proc Foo(): Bar
00:30:38flaviuor perhaps proc Foo(): BarTypeclass
00:30:45flaviuerr, FooTypeclass
00:31:44filwitthat's could easily be considered not an advantage.. and in my original post on the forums I address this: for factories you want associated with a type, just make the proc take in the type as a first param, eg:
00:31:59filwitproc cached(t:type Foo, ...): Bar =
00:32:14filwitvar b = Foo.cached(..)
00:32:24filwitvar f = Foo()
00:32:42onionhammeralso you can still create a Foo without using the constructor
00:33:00Araqthe point of the "factory" argument is that things usually don't start as a factory but might evolve into one. not sure if that's solved here
00:33:29onionhammerAraq just make it so module authors can prevent instantiation of types outside the module ;)
00:35:04filwitAraq: that doesn't seem like much of a point really? I mean, what scenerio do you want to do that in and not be able to also update the use-case code to use the named factory instead?
00:35:27filwiter.. that was confusingly written, sorry
00:36:19Araqfilwit: all the time.
00:36:38Araqbecause I don't want to break client code
00:37:32Araqonionhammer: so how does that work in practice? is seq[Foo] still allowed? can I setLen a sequence?
00:37:51filwitI'm not saying I know there isn't any scenario where that happens, I'm just not aware of any. "It would break the clients code" doesn't make a ton of sense really, cause by changing the return type you'd either have to conform the existing interface, or you'd break their code anyways.
00:38:14flaviuhmm, create:TypeclassFoo would still work, and I'd be able to return a concrete type.
00:40:10filwitflaviu: you mean `proc create(f:SomeFoo) = ...` which gets called for anything matching the type-class? That would be cool.. but I'm not sure what it would mean checking every type-class for every object construction..
00:40:34flaviuno, proc create(...): TypeclassFoo = FooImpl(123)
00:41:02filwitthat's not really how I was proposing 'create' work
00:41:18filwit'create' doesn't return anything, it works with a var parameter
00:42:51filwitthe reason is, by default (although you can prevent it with a pragma), the 'create' proc gets called after allocation (so the constructor doesn't need to deal with it)
00:44:47flaviuIMO adding extra knobs is bad design. Things should be designed for maximum flexibility from the start.
00:45:19flaviuknob <=> pragma
00:47:15onionhammerAraq yeah, you can still allocate sizeof(Foo)
00:47:34*reem joined #nim
00:48:12filwitwell the argument here is that currently constructors are already available to every type, and they allocate depending on type-info (stack or heap).. so we just extend that behavior, and make a needed override pragma to control specific types who's "default" allocation we want to override
00:48:20filwitflaviu ^
00:49:56filwitwe honestly need an extra "something" to control how constructors in there current form work right now.. sometimes a type doesn't want a default constructor as an option, and others want to allocate outside of the default
00:50:08filwitmy proposal address all that
00:50:31flaviufilwit: Do you have some document typed up with it?
00:50:36filwitbut it does so in a way that keeps the convenience
00:52:03flaviuI suppose I might be arguing for the language I want, not for what's consistent with the rest of Nim.
00:52:06filwitflaviu: I wrote on the forums a bunch starting on this page: http://forum.nim-lang.org/t/703/6
00:52:41filwitflaviu: Araq asked me to make a NEC, but I'm thinking I'm going to play around with code first, then make one with a more concrete understanding of how to do it
00:53:19Araqit's called a NEP, but yes
00:53:28filwitright
00:54:15flaviuminor style concern: 'proc create(f: var Foo, bar: int)' -> 'proc create(self: var Foo, bar: int)', For consistency with typical parameter naming.
00:54:53filwitflaviu: that's your choice, it's up to the author there
00:55:40filwitpersonally I've always favored 'this' but recently 'me' is starting to grow on me :)
00:57:30*hellonico quit (Remote host closed the connection)
00:57:39flaviufilwit: I don't care about a specific name, but my goal here is to get the reader to think in a certain way.
00:58:15filwitflaviu: oh you mean for my NEP, I understand. Sure, will use 'self' then.
00:58:22filwitgoing to eat. bbl
00:59:51*xxx quit (Ping timeout: 250 seconds)
01:00:32*hellonico joined #nim
01:01:22Araqgood night
01:01:26*hellonico quit (Remote host closed the connection)
01:02:01*rektide quit (Ping timeout: 250 seconds)
01:03:02*rektide joined #nim
01:06:10*xxx joined #nim
01:12:53renesacI thought things like "len" on non-intialized seqs was safe now
01:14:37renesacthere isn't anything like python defaultdict in nim, right?
01:18:25def-renesac: i also thought so, maybe it was reverted?
01:19:01*brson joined #nim
01:19:32renesacwith "cDict[cur].len == 0" I get a SIGSEGV, but with "cDict.hasKey(cur)" it executes correctly
01:20:02def-yes, i tried and len definitely doesn't work on nil seqs
01:20:09renesacthe latter is better anyway
01:20:19renesacfor this case
01:21:36renesac*there is a "not" before the last example
01:22:00fowlmouthi tried to make add/len work for nil strings and seqs, i ran into problems for what order they are in
01:22:30renesacorder?
01:22:52fowlmouthorder defined in system.nim
01:25:08renesacI don't fully understand, but ok if it is unsolvable....
01:25:21renesacI don't know what order has to do with the lenght of something
01:26:12renesacand I don't find the definition of order in system.nim
01:33:05*Trixar_za joined #nim
01:35:49*saml_ joined #nim
01:36:53*BitPuffin quit (Ping timeout: 248 seconds)
01:43:56*hellonico joined #nim
01:46:39*Trixar_za quit (Quit: Leaving)
01:59:35*mwbrown joined #nim
02:00:27renesacthere is no sort() defined for strings in nim stdlib...
02:02:56*untitaker quit (Ping timeout: 250 seconds)
02:04:06fowlmouthrenesac, sort takes a function and there is a special system.cmp for strings
02:04:30fowlmouth.eval echo cmp("a","b")
02:04:32Mimbusfowlmouth: -1
02:04:51renesacthe cmp should be for chars
02:05:04fowlmouththe generic cmp works fine for chars
02:05:05renesacbut yeah, I forgot to give the cmp argument
02:05:23fowlmouth.eval echo cmp('a','b')
02:05:25Mimbusfowlmouth: -1
02:07:12renesacaand there is no join for 'openarray[char]'
02:07:20renesaclet's go back to the string
02:07:42renesacI just hope it don't put the '/0' at the front
02:08:44renesacI will make some pull requests when I finish this
02:09:18*untitaker joined #nim
02:11:49*reem quit (Remote host closed the connection)
02:12:04renesacstrings don't seem to fit in openarray[T]
02:12:16renesacas I suspected
02:12:38*reem joined #nim
02:14:48*reem quit (Remote host closed the connection)
02:15:01*jholland quit (Quit: Connection closed for inactivity)
02:16:21*ChrisMAN quit (Ping timeout: 248 seconds)
02:19:26renesachow can I cast a slice of a string as an seq?
02:19:35renesacor is this impossible?
02:22:03fowlmouthrenesac, when you take a slice of a seq it allocates a new seq
02:22:18renesac:/
02:22:53renesacso the in place slice didn't went anywhere
02:23:12renesacin this time I was away
02:23:22fowlmouthnot sure what you mean
02:23:58renesaca slice like D slices, but with an extra pointer to not confuse the GC
02:25:07fowlmouthno that isnt a thing
02:25:25*wb quit (Ping timeout: 248 seconds)
02:26:44renesacso no way to use openarray[T] procs for strings...
02:27:05renesacor actually, the /0 is beyond the end of the string
02:27:11renesacso I shouldn't need the slice
02:27:26renesacjust a way to cast it to a seq[char]
02:27:34fowlmouthrenesac, why dont you just use seq[char]
02:27:51renesacbecause I need a string at the end
02:28:40renesacand I tried to use it but there is no join() defined for that, so I have to implement some missing proc anyway
02:29:03renesacand doing it directly with strings avoids one superfulous allocation
02:29:24*darkf joined #nim
02:31:11fowlmouthok
02:32:08renesacso, nim won't let me cast to seq[char]
02:32:46renesacoh
02:32:48renesacnow I got it
02:33:00fowlmouthyou did?
02:33:47renesacError: type mismatch: got (seq[char], proc (char, char): int{.gcsafe, locks: 0.})
02:33:47renesacbut expected one of:
02:33:47renesacalgorithm.sort(a: var openarray[T], cmp: proc (T, T): int{.closure.}, order: SortOrder)
02:34:09renesacnot a closure?
02:34:34fowlmouththis is sort in-place
02:34:40fowlmouthit requires a mutable seq/array
02:34:54renesacs is mutable
02:35:04renesacmaybe because I used cast?
02:35:33fowlmouthdo you pass a sort order
02:35:50renesacnope, it should have a default argument..
02:36:06fowlmouthrenesac, yea using cast there would be incorrect
02:36:41renesacwhy?
02:36:53renesacok, because cast don't return a var T
02:37:01fowlmouthcast[int](s) # s is an R value
02:37:07fowlmouther the int resulting is an R value
02:37:51renesaccan a mcast[]() be made?
02:38:43*saml_ quit (Read error: Connection reset by peer)
02:38:47renesacthe result of that cast is a pointer right?
02:39:02fowlmouthwhat cast?
02:39:28fowlmouthcast[int](s) # result is int
02:39:57fowlmouthi feel like if i help you with this it will give me negative karma
02:40:52fowlmouthbut oh well
02:41:32fowlmouth.eval var s = "Hello"; (cast[var seq[string]](addr s))[1] = 'E'; echo s
02:41:33Mimbusfowlmouth: eval.nim(4, 37) Error: type mismatch: got (char) but expected 'string'
02:41:42fowlmouth.eval var s = "Hello"; (cast[var seq[char]](addr s))[1] = 'E'; echo s
02:41:44Mimbusfowlmouth: HEllo
02:41:52EXetoCand sequences have a header
02:41:58fowlmouthrenesac, ^
02:42:18renesacstrings don't have the same header?
02:42:34fowlmouththey do
02:43:24EXetoCum yeah
02:44:53renesacSIGSIEGV somewhere now
02:45:09renesacXD
02:45:59renesacwell, w/o the sort line, it enters a infinite loop
02:46:04fowlmouthyou are asking for segfaults with what you're doing
02:46:24fowlmouthlol
02:46:28*hellonico quit (Remote host closed the connection)
02:47:00renesacif there was a pre-made alternative I would use it
02:47:01renesac:P
02:47:44*saml_ joined #nim
02:47:48fowlmouththe solution is simple renesac
02:47:53fowlmouthwork with seq[string], return a string
02:48:10fowlmouther seq[char] or whatever
02:48:28renesacI'm doing that because python started being too slow
02:48:37renesac*that in nim
02:49:11renesacseq[string] would work smoothly, but OMG the superfulous allocations
02:49:38renesacas I said, I would need to implement a join() for seq[char] (pretty trivial)
02:50:12renesacbut the solution would have one extra allocation
02:50:28renesacand I didn't tought adapting the sort would be so difficult
02:50:35fowlmouthwhat are you doing anyways
02:51:44renesacfiguring out how to represent words unambiously using the minimal number of characters from it
02:52:07renesacI could also define a new type and a cmp() for that
02:52:14renesacinstead of sorting
02:52:37renesacbut I don't thing it would be better
02:52:41renesac*think
02:52:55fowlmouthwell better to get it working then optimize it later
02:53:02fowlmouthimo
02:53:09renesacit is already working in python
02:53:12renesac^^'
02:53:26renesacbut yeah, I also wanted that
02:53:36renesacthat is why I tried using seq[char]
02:54:08renesacI will see what is my infinite loop
02:54:18renesacthen see if the sort() is really doomed
02:54:42renesacif so, or I do some insertion sort or I implement the join()
02:55:08renesacbut ideally I could use sorting for seqs on strings...
02:56:49*fowlmouth quit (Quit: Leaving)
02:57:17*fowl joined #nim
03:01:17*MagusOTB joined #nim
03:16:40*mwbrown quit (Ping timeout: 244 seconds)
03:40:01*reem joined #nim
03:42:28*hellonico joined #nim
04:01:14*Infathome joined #nim
04:04:20*Infathome left #nim ("Leaving")
04:08:28*darkf_ joined #nim
04:11:37*darkf quit (Ping timeout: 265 seconds)
04:17:42*gsingh93 quit (Ping timeout: 250 seconds)
04:20:29*brson quit (Quit: leaving)
04:20:50*brson joined #nim
04:24:28*reem quit (Remote host closed the connection)
04:26:12*johnsoft quit (Ping timeout: 256 seconds)
04:27:20*johnsoft joined #nim
04:28:43*reem joined #nim
04:33:24*BlaXpirit joined #nim
04:34:39*darkf_ is now known as darkf
04:42:32*gsingh93 joined #nim
04:46:12*eventualbuddha quit (Read error: Connection reset by peer)
04:46:14*DecoPerson quit (Read error: Connection reset by peer)
04:46:36*mikolalysenko quit (Ping timeout: 272 seconds)
04:47:21*DecoPerson joined #nim
04:47:21*eventualbuddha joined #nim
04:47:38*CARAM__ quit (Ping timeout: 252 seconds)
04:49:03*mikolalysenko joined #nim
04:49:26*CARAM__ joined #nim
04:54:50*johnsoft quit (Ping timeout: 272 seconds)
04:56:12*johnsoft joined #nim
05:06:44*saml_ quit (Remote host closed the connection)
05:07:26*reem_ joined #nim
05:11:17*reem quit (Ping timeout: 248 seconds)
05:21:34*wb joined #nim
05:35:15*HakanD____ joined #nim
05:42:56*HakanD____ is now known as HakanD
05:45:41*reem_ quit (Ping timeout: 256 seconds)
05:47:57*Omnivore joined #nim
05:50:27Omnivorejust dropping in to comment in re wikipedia article deletion; seems to me its more of a question of wikipedia's relevance than nim's notability - they're caught it the cracks of a paradigm shift
05:50:45Omnivoreanyhow, looking forward to 1.0 and will check back then, good luck all
05:51:35*Omnivore left #nim (#nim)
05:59:03*wink-s quit (Quit: Page closed)
06:00:27*nande quit (Remote host closed the connection)
06:06:59*brson quit (Quit: leaving)
06:11:03*HakanD_ joined #nim
06:14:57*HakanD quit (Ping timeout: 264 seconds)
06:41:13*BlaXpirit quit (Ping timeout: 256 seconds)
07:07:46*BlaXpirit joined #nim
07:11:09*Ven joined #nim
07:25:06*reem joined #nim
07:34:24*johnsoft quit (Ping timeout: 245 seconds)
07:38:30*yglukhov_ joined #nim
07:42:51*yglukhov_ quit (Ping timeout: 250 seconds)
07:52:52*BlaXpirit quit (Quit: Quit Konversation)
07:55:06*gsingh93 quit (Ping timeout: 246 seconds)
07:55:58*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:11:23*Ven joined #nim
08:15:30*reem quit (Remote host closed the connection)
08:17:29*davidhq joined #nim
08:28:04*dewdrop joined #nim
08:35:37*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:38:42*davidhq joined #nim
08:39:21*davidhq quit (Client Quit)
08:40:02*davidhq joined #nim
08:43:04*yglukhov_ joined #nim
08:44:37*davidhq quit (Ping timeout: 248 seconds)
08:53:01*meeeee joined #nim
08:53:37meeeeedo i have to download iup lib / where?
08:53:48meeeeeError: cannot open 'lib/niup'
08:54:25meeeeeand is iup recom for gui?
08:58:09meeeeei want to make a window with a gridlist, with two icons in each row, and a few buttons, checkboxes. create transparent png icons with gradients, rotated text... possible?
08:59:11meeeeeits half done (doing its job), but i would like to use the opportunity to write it in nim
09:01:01meeeeeunless im stuck .. because i can do it very quickly in another lang and dont like to be stuck ..
09:01:09meeeeeanyone?
09:02:05meeeeenimble?
09:10:32meeeeejesus
09:10:34meeeeeim out
09:10:48meeeeenimble up and running but no iup
09:10:54meeeeesearch iup no
09:10:58meeeeeinstall iup no
09:13:00meeeeeanyone?
09:13:16meeeeelast minute before quitting nim
09:13:30*milosn quit (Ping timeout: 256 seconds)
09:14:48meeeeesend mail to [email protected] if you want me to code in nim. will check once in a few hours. good bye and good luck
09:14:54*meeeee quit (Quit: meeeee)
09:17:42pigmejlol?
09:23:05*reem joined #nim
09:24:41*hellonico quit (Remote host closed the connection)
09:25:08filwitlol wtf...
09:25:09*hellonico joined #nim
09:27:40*reem quit (Ping timeout: 256 seconds)
09:27:49*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:29:42*hellonico quit (Ping timeout: 272 seconds)
09:35:25*johnsoft joined #nim
09:43:54federico3note to self: never give whiskey to meeeee anymore
10:00:33*Kingsquee quit (Quit: Konversation terminated!)
10:07:55*HakanD_ quit (Quit: Be back later ...)
10:12:47*milosn joined #nim
10:17:29*HakanD_ joined #nim
10:21:43*Trustable joined #nim
10:25:18*milosn quit (Read error: Connection reset by peer)
10:26:10*milosn joined #nim
10:32:18dom96lol
10:33:11pigmejshall we recommend snickers for him ?
10:44:23*HakanD_ quit (Read error: Connection reset by peer)
10:44:36*HakanD_ joined #nim
10:50:01*milosn quit (Read error: Connection reset by peer)
10:52:09*MyMind joined #nim
10:52:58federico3or sticking to php and nodejs
10:53:04pigmej;D
10:53:26dtscodeew
10:53:46*wan quit (Ping timeout: 250 seconds)
11:01:24federico3unrelated: seqdiag and blockdiag are nice http://blockdiag.com/en/index.html (but currently in Python only)
11:02:05*Ven joined #nim
11:05:21*polde quit (Ping timeout: 265 seconds)
11:07:35*wan joined #nim
11:07:44dtscodei like this
11:08:24*milosn joined #nim
11:15:06federico3there are adaptors for Sphinx to put small diagrams in code documentation
11:16:28HakanD_that was interesting (:
11:23:13*a5i quit (Quit: Connection closed for inactivity)
11:27:49*TEttinger quit (Ping timeout: 248 seconds)
11:32:33*polde joined #nim
11:46:29*milosn quit (Ping timeout: 248 seconds)
11:56:04*Ven quit (Ping timeout: 255 seconds)
12:01:49*Ven joined #nim
12:20:33*BlaXpirit joined #nim
12:34:07*milosn joined #nim
12:41:39*gokr joined #nim
12:46:48*gokr quit (Read error: Connection reset by peer)
12:47:47*milosn quit (Ping timeout: 252 seconds)
12:52:29*milosn joined #nim
12:54:52*gokr joined #nim
12:56:01*a5i joined #nim
12:59:13*coopernurse joined #nim
12:59:13*gokr quit (Read error: Connection reset by peer)
13:00:25*Varriount_ quit (Ping timeout: 264 seconds)
13:01:43coopernurseHi folks. I'm building a nim docker image and want to slim it down. After building Nim do I need to keep the Nim/csources, compiler, lib, or tests directories?
13:01:53*BitPuffin joined #nim
13:01:59coopernurseI know some of those directories (lib?) are required for the nim compiler right?
13:03:43*mpthrapp joined #nim
13:05:12*gokr joined #nim
13:05:24dom96coopernurse: You don't need csources or the tests.
13:05:38dom96Some projects may depend on the compiler files.
13:05:53dom96I would keep it
13:05:59coopernursegreat, thanks. csources is the big one. that will save 172MB
13:07:20*gokr quit (Read error: Connection reset by peer)
13:24:32*filwit quit (Quit: Leaving)
13:26:11*pafmaf joined #nim
13:36:22coopernurseOk, docker image is available if anyone wants to use it. https://github.com/coopernurse/docker-nim
13:48:37*milosn quit (Ping timeout: 248 seconds)
13:50:26*banister joined #nim
13:51:18*banister is now known as banisterfiend
13:55:28*Matthias247 joined #nim
14:13:26*polde quit (Ping timeout: 272 seconds)
14:14:55*polde joined #nim
14:23:44arnetheduckAraq, https://github.com/Araq/Nim/pull/2428 rebased & ready
14:24:17Araq+1 for poking me :-)
14:25:32dtscodecoopernurse, awesome :D
14:27:53Araqarnetheduck: newStringOfCap(int(s.len.toFloat * 1.1) + 1) good guess? measure somehow?
14:27:58Araq*measured?
14:32:36arnetheduckno. gut feeling.. has worked well for me in other similar situations.. splitting it into 64-byte parts gets you 67 for every 64 bytes, plus a little more.. +2 would maybe work better for small strings, now that I think about it, not sure if nsoc has a min allocation size?
14:35:32Araq"nsoc"?
14:35:43arnetheducknewStringOfCAp
14:36:12Araqso ... your new equals file doesn't compute the CRC at all anymore?
14:36:13arnetheducktoo used to those smart search boxes :)
14:36:36*wan quit (Ping timeout: 244 seconds)
14:37:20arnetheduckno.. you still have to make full passes over both file & rope data, so I'd say it makes more sense comparing it than computing two values and then comparing them
14:38:04Araqyeah but I had my reasons for using a CRC here.
14:38:29arnetheduckyou didn't document them, and I couldn't think of one :)
14:39:16Araqwell it should be somewhat faster for the common case where they are equal
14:39:32arnetheduckwhat, crc or compare?
14:39:37Araqcrc
14:39:53arnetheduckwhy?
14:40:09Araqstreaming works better
14:40:19*wb quit (Ping timeout: 255 seconds)
14:41:20arnetheduckfor a fragmented rope?
14:43:40Araqwhen you don't have to compare a rope against a file buffer there is more space left in the caches
14:43:57Araqbut I never did any measurements
14:44:01Araq;-)
14:45:19Araqif (i >= length) or frmt[i] notin {'0'..'9'}: # fine with me, but not required
14:45:48Araqif i == length then frmt[i] == '\0' and so it's not in '0'..'9'
14:46:23*Araq likes the terminating zero
14:50:00*wan joined #nim
14:50:01arnetheduckoh, so accessing string[string.len] is ok?
14:50:24Araqyes
14:51:04*BitPuffin quit (Ping timeout: 265 seconds)
14:52:34arnetheduckooh. unusual
14:53:50arnetheduckI'll remove it then
15:00:27arnetheduckoriginal code, if I add 1000 comparisons (crc): Hint: operation successful (83336 lines compiled; 107.462 sec total; 241.247MB; Release Build) [SuccessX]
15:00:51arnetheduckmine (direct compare): Hint: operation successful (83373 lines compiled; 69.485 sec total; 237.243MB; Release Build) [SuccessX]
15:02:34def-arnetheduck: did you clean the nimcache and make sure disk cache is cleared before?
15:03:26arnetheduckI'm using the second stage of koch boot, so both results are with full nimcache, without cc phase
15:03:51def-that's a nice speedup then
15:04:21arnetheduckno, it's not noticable - we only compare once, not 1000 times as I did for the benchmark :)
15:05:58*wan quit (Ping timeout: 256 seconds)
15:06:18*wan joined #nim
15:09:11arnetheduckhttp://pastebin.com/4AXry9cS
15:12:09*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:13:30arnetheduckit's also possible that the files are so small that file and rope fragments comfortably fit in some cache, and therefore the streaming effect doesn't matter..
15:13:43*darkf quit (Quit: Leaving)
15:14:19Araqhey don't quote me on that. "streaming effect" might not be a thing that exists
15:18:41renesacthe regular comparison is still streaming two pieces of data, isnt't it?
15:19:06renesacinstead of one a time in the CRC case
15:19:32*mpthrapp quit (Read error: Connection reset by peer)
15:20:47Araqdom96: is it too late to remove the dot for nimble on windows?
15:21:22Araqin fact, I would remove it on unix too. that thing should not be hidden
15:21:58arnetheduckthere, length check removed
15:22:28dom96Araq: it's configurable
15:22:44dom96IMO it should be hidden
15:22:47def-Araq: i believe on unix it should be hidden, just because it's common to do so (not that I find that very reasonable)
15:23:10pigmej+1 for hidden
15:23:21arnetheduckoh, there's few more
15:24:59*wink-s joined #nim
15:27:01*mpthrapp joined #nim
15:27:13Araqdom96: so how can I override it?
15:28:45*wan quit (Ping timeout: 252 seconds)
15:30:09*wan joined #nim
15:31:11arnetheduckthere, all extra length checks removed, I think
15:32:03AraqI already merged :P
15:32:50*Demos joined #nim
15:32:52federico3I have an async procedure that should keep a "status" of some sort. I tried creating an object and passing it to the proc as a var argument but it triggers an illegal capture. How should I implement this?
15:33:16federico3(I need #nim-noobs)
15:33:31EXetoCdef-: it is since few apps relies on .config
15:35:26def-EXetoC: well, .config sounds weird for storing nimble packages
15:36:25renesacso, " proc foo(s: var string) = echo cast[var seq[char]](s) " fails
15:36:33renesacI thought strings were more compatible with seqs
15:38:13EXetoCdef-: I guess. there are only two conventions though
15:38:48renesacok, w/o the "var" it works, but I need to pass a "var seq[char]"
15:39:34*MagusOTB quit (Ping timeout: 264 seconds)
15:40:33*Ven joined #nim
15:40:38EXetoCwhy not just extend the interface?
15:41:36renesacI'm trying to use algorithm.sort()
15:41:42renesacwell, maybe I should edit it
15:41:59renesacI was going for a simple insertion sort though... for my use case it is plenty
15:44:06arnetheduckbtw, if, in the ropes.~ template, I replace ropef with rope (which makes more sense, imo), I get lots of compile fails in the generated c code... any ideas?
15:44:54def-renesac: i think concepts would really help in making the standard library more general, I've also written a bit here: https://github.com/Araq/Nim/pull/2449
15:45:54renesacdef-: have you read about D ranges?
15:45:58Demosdef-: in general I think that concepts should not be needed to make anything more general. As far as I can tell they just improve error messages
15:46:34arnetheduckin fact, so many that koch hangs.. it looks like gcc gets blocked because it's stuck and not doing anything... compiler call in nim reads buffers while calling compiler, or just one big read at the end? intuitively it's blocked because it's run out of pipe buffer
15:47:37EXetoCDemos: sounds like a good reason to me. also, it makes it easier to reason about the interface
15:47:56Demosyeah it does
15:48:03renesacInputRange: requires the empty, front and popFront() member functions
15:48:03renesac ForwardRange: additionally requires the save member function
15:48:03renesac BidirectionalRange: additionally requires the back and popBack() member functions
15:48:03renesac RandomAccessRange: additionally requires the [] operator (and another property depending on whether the range is finite or infinite)
15:48:17renesac<-- types of D ranges
15:48:18Demosand you get to prune off types that work but don't do what you expect
15:48:43Demoswrt to pairs though I think you are gunna need a different impl for hash maps and sequences
15:48:48renesacI think it makes a lot of sense to use concepts to make algorithms more general
15:48:57renesachttp://ddili.org/ders/d.en/ranges.html
15:49:00*milosn joined #nim
15:49:33EXetoCrenesac: it would get ugly because of the inability to declare a constant in an object
15:50:11renesaca constant should be part of it's type signature
15:50:18EXetoCanyway, the error messages would still not be as good as they could be
15:50:21renesacwhat people do with fixed size matrixes. etc?
15:50:32Demosrenesac: those look like they are essentially c++ iterator concepts
15:50:38Demosrenesac: they don't
15:50:45EXetoCrenesac: you can query that outside the type definition?
15:50:48Demoslike you need static[T] to do that well
15:50:54Demosand static[T] does not work
15:51:07renesac:/
15:51:17Demosso we do what everyone except C++ does and just have specific named functions or use dynamic size most of the time
15:51:29renesacDemos: yeah, it is based on C++ iterators, but a bit more organized
15:51:35Demoswell yeah
15:51:58renesacso a function can require a RandomAccessRange
15:52:00renesacI think
15:52:14renesac(it's been sometime since I last programmed in D)
15:53:15*ChrisMAN joined #nim
15:58:04renesacaparently they only require a range, and compilation fails if some of the procs required are not present
15:58:25renesacthey specify what type of range is needed in the docs
15:58:38renesacnim could do better
15:58:47renesacwith concepts
15:59:03renesacopenarray is already a concept
15:59:11renesaconly a bit restrictive
16:00:39EXetoCyes: "void foo(R)(R range) if (isInputRange!R) { .. }
16:00:44*wb joined #nim
16:00:50DemosI thought openarrays were a real type
16:00:59EXetoCit's only for parameters
16:01:07Demosor do you mean opearray is a concept for openarray[T] for all T
16:01:26DemosRight, but I am pretty sure they have a size
16:01:29EXetoCit's alright. it's just that if the check is wrong in any way then you might have errors in the body for particular instantiations
16:02:06Demosand so long as you put a type in procs using openarrays will generate code
16:02:21Demosor can, without there being any callsites
16:06:14*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:06:43*Ven joined #nim
16:09:18*yglukhov_ quit (Ping timeout: 246 seconds)
16:14:56renesacwhat having a size has to do if they are a real type or not?
16:16:19*HakanD_ quit (Quit: Be back later ...)
16:16:55renesacby the way, if I try to put an "| var string" on sort() I get type missmatch in the procs expecting the old sort
16:17:11renesaclib/packages/docutils/rstgen.nim(516, 6) Error: type mismatch: got (seq[TIndexEntry], proc (TIndexEntry, TIndexEntry): int{.gcsafe, locks: 0.} | proc (T, T): int | proc (string, string): int{.noSideEffect, gcsafe, locks: 0.})
16:17:11renesacbut expected one of:
16:17:11renesacalgorithm.sort(a: var openarray[T] or string, cmp: proc (T, T): int{.closure.}, order: SortOrder)
16:17:27renesacis this a bug?
16:23:55Araqrenesac: dunno.
16:24:08Araqhow can it infer T when it's a string though?
16:24:19renesacoh
16:24:33Araqand do you really want to cmp single characters?
16:24:43renesacyep
16:26:31renesacanyway, I already gave up on algorithm.sort(0
16:26:41renesacdoing my own insertion sort is better
16:26:42renesac:P
16:26:50renesacand works
16:29:49*arnetheduck quit (Ping timeout: 264 seconds)
16:30:16*jholland joined #nim
16:30:32*rational joined #nim
16:33:01*BitPuffin joined #nim
16:34:05AraqIMHO we should simply export some templates that implement sorting. getting the type signature right for all possible combinations is too much effort
16:34:34Araqsame for linked list handling
16:34:51Araqand "draw circle"
16:43:17*a5i quit (Quit: Connection closed for inactivity)
16:43:41renesacwell, ideally we would have working concepts and sufficient compile time type introspection
16:44:09*pregressive joined #nim
16:44:36renesacso we can define sort(a : container, system.cmp[containedType(a))]) or something like that
16:45:12renesacmaybe I'm too ambitious
16:46:07renesacby the way, is there some proc of the type "hasPointer()", to see if an object has some type of indirection
16:46:17EXetoCa temporary solution is fine
16:47:03renesacso that I could use it in a hash table, for example, to decide if I should store the hash alongside the value
16:47:21renesacit would return false for 'int' and true for 'string', for example
16:47:32def-renesac: maybe isOnStack
16:48:56renesacisOnStack receives a pointer
16:49:04renesacI can't give an "int" to it
16:49:21renesacI want to know if I have a pointer thingy in the first place
16:51:23renesachttp://nim-build.nim-lang.org/system.html#isOnStack,pointer <-- I can't see the diference between the two isOnStack()
16:51:37renesac(look 4 procs down for the second one)
16:51:38Araqrenesac: these should not be exported
16:51:54renesacand the 'see source' don't works for them
16:52:06Araqrenesac: I'm well aware of "sort(a : container, system.cmp[containedType(a))]) or something like that"
16:52:44Araqand oh look, even that specifies it takes a 'cmp' proc pointer
16:52:48renesacwell, they aparently are exported
16:53:03Araqwhich is not what I want for 'int'
16:53:27renesacwhy you don't want that for 'int'?
16:53:37Araqindirect calls are slow
16:54:01renesacI would imagine it being inlined by the compiler
16:54:15Araqdon't count on it
16:54:46Araqand in general algorithms are stable, interfaces/signatures are not.
16:54:46renesacthen the cmp for everything is slow
16:55:11Araqthe cost can amortize when 'cmp' does quite some work
16:56:24renesacI would think that the more work larger would become the difference between inlined and not
16:56:48renesacas the overhead of the call sort itself is amortized
16:56:53renesac*sort call
16:58:16DemosC++ does it with a template argument, this gets inlined /sometimes/
16:58:31renesacwell, you could define a sort() proc that don't receive the comparison function
16:58:37renesacand simply uses > < =
16:58:41renesacinside
16:58:54renesacthen it probably will get inlined?
17:01:30Demosand as you do more work in the cmp function you spend more time there, so the indirect call matters less
17:02:07renesacoh, right
17:04:10*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:04:25DemosAs long as lambdas passed to cmp get inlined it is not a huge problem. In C++ the version with the cmp argument can be inlined when the target of the function can not change (true for inline lambdas and functors)
17:06:25ggVGcI'm a lambda, you're a lambda, and another little lambda, lambda lambda lambda lambda, lambda lambda, DUCK!
17:06:32ggVGcthat's all I have to say for now
17:07:37Demossince a function pointer of a given type (like bool (*cmp)(int, int)) can point of any actual function you like these are unlikely to be inlined as compare functions
17:08:33DemosEssentially want I am saying is that the type of the cmp function passed to sort should be something like static[proc(T,T): bool]
17:09:01renesacright
17:12:09*Senketsu joined #nim
17:14:51DemosI can't wait until static works for everything
17:14:54Demossuch a cool feature
17:17:19renesacyeah
17:18:11*Ven joined #nim
17:30:54*yglukhov_ joined #nim
17:33:07*wink-s quit (Ping timeout: 246 seconds)
17:37:09*MyMind quit (Ping timeout: 246 seconds)
17:38:20AraqDemos: well fortunately fixing static[T] fixes quite some other problems in the compiler as well :-)
17:39:13*gsingh93 joined #nim
17:40:53*irrequietus joined #nim
17:43:25*reem joined #nim
17:45:58*banisterfiend quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:52:47*reem quit (Remote host closed the connection)
18:00:20*rational quit (Ping timeout: 252 seconds)
18:02:03*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:02:36*Strikecarl joined #nim
18:02:47StrikecarlWoopsie.
18:02:50StrikecarlNeed help again <.<
18:02:53Strikecarl"invalid character constant"
18:03:02Strikecarlvar source = "E:\keys.txt"
18:04:09Araqvar source = r"E:\keys.txt"
18:04:19vbtt_Strikecarl:backslash escapes
18:04:23StrikecarlOh.
18:04:26StrikecarlThanks!
18:05:03vbtt_http://nim-lang.org/manual.html#string-literals
18:05:12vbtt_double backslash should work too
18:07:10*gsingh93 quit (Ping timeout: 264 seconds)
18:07:40Strikecarlvbtt_ Thanks!
18:07:56Araq"although how it interferes with them, he still hasn't explained" omg no. I explained it 5000 times and the manual explains it too
18:08:40Araqbut I don't care, I give up, let's kill .procvar.
18:09:41vbtt_Araq: context?
18:09:43Araqstill I wish I'd understand why people cannot understand .procvar
18:10:07vbtt_nm, found the forum
18:16:01vbtt_because nim reminds one of very high level languages (python etc.) - ppl might assume all procs are automatically first class objects
18:17:02vbtt_will removing .procvar. mean that all procs are automatically procvars?
18:19:39*BlaXpirit quit (Remote host closed the connection)
18:21:24*BlaXpirit joined #nim
18:25:43*mwbrown joined #nim
18:26:48def-vbtt_: that would be the idea
18:27:14renesacAraq: where is the explanation?
18:27:40renesacI subscribed to that bug report waiting for your answer to Varriount...
18:28:20Demosll I wish I'd understand why people cannot understand .procvar
18:28:20Demos14:10 < vbtt_> nm, found the forum
18:28:25StrikecarlDoes anyone know how to use --app:gui in Aporia without any compile errors?
18:28:28renesacI don't like the idea of being unable to add optional parameters to procs w/o breaking the interface
18:29:17*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
18:29:45*Strikecarl joined #nim
18:30:21vbtt_Demos:my answer was to myself - regarding 'context?'
18:30:59vbtt_I see the recent thread in the forum, not araq's explanation. http://forum.nim-lang.org/t/1099
18:31:00Demosyeah, accedently copy pasted your message
18:31:04Demosbecause unix
18:31:49DemosI think it is because adding default parameters needs changes at the callsite
18:33:10*irrequietus quit ()
18:33:12DemosNot sure how this could ever cause problems except for {.exportc.}'d procs
18:33:57def-Strikecarl: from what I've heard the mingw version nim ships on windows can't do --app:gui, you need a full one
18:34:08vbtt_Demos: a recompile should fix the callsite, no/
18:34:12vbtt_no?
18:34:16*gsingh93 joined #nim
18:34:30Demosrihgt, but not with {.exportc.}. It would be an ABI change
18:35:07vbtt_I see. I dont know much about compilation units in nim.
18:35:25vbtt_I thought it takes *all* the source, even for all modules, and then compiles it down.
18:35:26Demoslike if nim supported seperate compilation then it could cause a problem
18:35:29Demosand in theory it odes
18:35:31Demos*does
18:36:26vbtt_How does {.procvar.} fix this?
18:38:31Strikecarlkk.
18:38:32*reem joined #nim
18:38:34StrikecarlThanks def-
18:39:47*banister joined #nim
18:41:48Strikecarldef- i installed the newest version of MingW and replaced it with the one nim gave me
18:41:57Strikecarlif i dont use --app:gui it works fine
18:42:01Strikecarlbut with app gui i get
18:42:06StrikecarlError: execution of an external program failed
18:42:19Strikecarlam i missing something? $findExe(nimrod) c --app:gui $#
18:44:55*reem quit (Remote host closed the connection)
18:47:12def-you can try adding --parallelBuild:1 to see if it says sth more
18:47:33def-Maybe someone with Windows knows how to solve this
18:49:03StrikecarlNow it works :)
18:49:04StrikecarlThanks!
18:50:02*pregressive quit (Remote host closed the connection)
18:50:15Strikecarli think
18:50:22Strikecarlnope.
18:50:27StrikecarlError: execution of an external program failed
18:50:27Strikecarl> Process terminated with exit code 1
18:51:59cazovyou could try using dependency walker to find out if its some missing dll
18:52:22renesacstrange that compiling a Debug build in Nim is 3 times slower than a Release build
18:52:34renesacin C it is the opposite, because the optimizations
18:54:48def-renesac: for me debug builds are faster in nim
18:55:48renesacHint: operation successful (21666 lines compiled; 1.018 sec total; 37.378MB; Debug Build) [SuccessX]
18:55:48renesacHint: operation successful (21666 lines compiled; 0.290 sec total; 27.281MB; Release Build) [SuccessX]
18:55:54renesacthe same program
18:56:21def-Maybe you didn't reset the nimcache
18:56:59def-or is it something special about your code?
18:57:01renesacok, compiling again
18:57:06renesacHint: operation successful (21666 lines compiled; 0.325 sec total; 37.378MB; Debug Build) [SuccessX]
18:57:25renesacand yeah, I'm not reseting the cache
18:58:00def-then do the debug build after not resetting the cache either?
18:58:03renesacHint: operation successful (21666 lines compiled; 1.752 sec total; 27.281MB; Release Build) [SuccessX] <-- release with cold cache
18:58:26renesacso, the two are abou the same speed, but the release one is still a bit faster
18:58:57*Jehan_ joined #nim
18:59:07renesacwhen recompiling with the cache
18:59:13renesacbut slower with cold cache
18:59:26def-i guess that makes sense
18:59:40def-with a debug build you generate much more C code than with release
18:59:52Jehan_Debug builds generate additional code (such as linenumber and file information) and may import additional modules.
18:59:58renesacright
19:00:28renesacyeah, it was the nimcache effect that generated that big difference I initially was surprised
19:00:29def-but usually the C compiler's optimizations are the slowest part
19:00:38*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
19:02:22renesacand in debug mode the program runs slower than the python version, but in release mode it is 3 times faster than pypy
19:02:54*irrequietus joined #nim
19:03:09renesacof course because python has tons of optimized libraries that a non-optimized build can't touch
19:03:26renesac*can't compete
19:06:54Jehan_You can selectively turn off a few things that you don't really need.
19:07:10Jehan_Plus, you can turn on optimization in debug mode.
19:07:24Jehan_This makes compilation slower, but the program runs faster.
19:07:46Jehan_Personally, with clang, I pretty much always run with optimization on even in debug mode.
19:08:26Jehan_Unless I have to debug with gdb (because then optimization may interfere with debugging).
19:11:00*rational joined #nim
19:26:06*Strikecarl joined #nim
19:26:45StrikecarlHow do i read a REG_SZ value and make it to a string?
19:51:37*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:52:52dtscodeMimbus, echo $1
19:53:16EXetoC.eval echo $1
19:53:17MimbusEXetoC: eval.nim(3, 5) Error: type mismatch: got (proc (varargs[expr]){.gcsafe, locks: 0.}, int literal(1))
19:55:28StrikecarlHow do i read a REG_SZ value and make it to a string?
19:56:42*polde quit (Ping timeout: 272 seconds)
19:58:47*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
20:00:31*polde joined #nim
20:20:36*Matthias247 quit (Read error: Connection reset by peer)
20:26:58*gsingh93 quit (Ping timeout: 264 seconds)
20:38:30*polde quit (Ping timeout: 272 seconds)
20:41:13*polde joined #nim
20:43:35*mpthrapp quit (Remote host closed the connection)
20:49:06Araqrenesac: thanks to .procvar taking the address of a proc usually doesn't work to begin with, so we can add default parameters to stdlib procs and not break anything.
20:49:40Araqthat's the reason for its existance.
20:50:34Araqin a lang without procvar, we cannot add a default parameter and ensure we didn't break somebody's code.
20:50:42renesac[15:35:45] <Demos> like if nim supported seperate compilation then it could cause a problem
20:50:42renesac[15:35:48] <Demos> and in theory it odes
20:50:43renesac[15:36:45] <vbtt_> How does {.procvar.} fix this?
20:51:04Araqseperate compilation or ABIs etc have *nothing* to do with this.
20:52:08Araqalso note that templates do not have an address you could take to begin with. .procvar actually make the whole language more consistent
20:52:38renesacwhat other languages with default arguments do?
20:52:41Araqand of course system.`+` is mapped to a CPU instruction, so again, you cannot take its address
20:53:55Araqwhat you can do is to *generate* stubs in these cases to strengthen the abstractions
20:54:01renesacsemistatic[] for proc parameters would fix this?
20:54:13renesac*when receiving procs as parameters
20:54:57AraqI don't see how.
20:55:22vbtt_consider the example in the forum:var lineNums = input.split(",").map(proc (x:string): string = x.strip()).map(proc (x:string): int = parseInt(x))
20:55:34vbtt_how does that not break when you add default parameters?
20:55:45vbtt_so people will use workarounds, and be broken either way?
20:56:14Araqvbtt_: x.strip() is a call. not taking its address
20:56:27Araqso strip continues to work if we add more parameters
20:56:44vbtt_ah I see
20:57:28vbtt_maybe the solution is to just have a simple macro to auto-wrap these non-procvared functions?
20:57:31Jehan_Except that things currently sort of breaks because of strip having default parameters (but that could be fixed).
20:58:36vbtt_or just auto-wrap non-procvarred procs
20:58:49Araqthat's what Jehan_ proposes, yes
20:58:52vbtt_(that's how people expect it to work anyway)
20:59:09Jehan_vbtt_: Basically, yeah, you can turn everything into a closure, can't turn everything into a procvar.
20:59:51vbtt_right - well only if you use a proc like that it will create that closure?
21:00:12renesacwhat is the problem with Jehan_ proposal?
21:00:24renesacbesides __effort__?
21:00:27Jehan_I'm honestly not sure where procvars enter into the whole problem to begin with. The code doesn't compile for other reasons.
21:00:44Araqargh
21:00:59Araqnobody understands .procvar
21:01:18AraqJehan_: parseInt is a good example. We promise .procvar for that
21:01:45Araqso I cannot modify it to proc parseInt(s: string; start = 0): int
21:01:52Araqas that would break code
21:02:11Araqbut without the .procvar I *could* do that
21:02:24Araqas you cannot take its address then
21:02:31Jehan_Araq: Yeah, but you can also make a proc a {.closure.} and it would work with map.
21:02:33vbtt_Ah
21:02:42vbtt_so procvar says 'this proc signature cannot be modified' ?
21:02:55Jehan_map's argument has to be a closure, can turn a procvar into a closure, but not vice versa.
21:03:01vbtt_it should be called 'frozen-api' or something
21:03:03Araqyes. it's a promise
21:04:17renesacso, why a frozen proc signature is needed for map()?
21:04:18AraqJehan_: toplevel .closures are a mistake and we need to kill them. ;-)
21:04:33Jehan_*blink*
21:04:39*renesac is still lost at a more basic level
21:05:13renesacand what other languages with default arguments do?
21:05:44*polde quit (Ping timeout: 272 seconds)
21:05:44Jehan_renesac: In other languages with higher-order functions, everything is a closure (sort of).
21:06:14vbtt_well...
21:08:59renesacso in D everything is a closure?
21:09:14renesacit supports default values, and things like map()
21:09:49Jehan_No, D has both delegates (= closures) and function pointers.
21:09:59renesacI don't remember ithaving some {.procvar.} problem
21:10:17renesachow is that different from nim?
21:10:54*polde joined #nim
21:11:43vbtt_What I don't get is why promising unchanging signature is important. Nim will always recompile with all the source code, so it will always pick up the latest version of the function, no?
21:13:02BlaXpiritvbtt_, think about serious real world stuff
21:13:06Jehan_renesac: You don't have a procvar problem in Nim, either. At least what we've been discussing on the forum has nothing to do with strip not being a procvar. The code doesn't compile because there's a type mismatch because of optional parameters, but that type mismatch occurs regardless of whether strip is a procvar or closure.
21:13:22BlaXpiritlike, programs compiled, maybe in linux distros
21:13:28BlaXpiritlibraries made in nim
21:13:34BlaXpiritgotta keep binary compatibility and stuff
21:13:47vbtt_BlaXpirit:right, I understand the use of procvar for binary compatibility
21:13:59vbtt_(not sure I buy it, but I get the point)
21:14:30flaviuDoes Nim even allow dynamically linking nim libraries?
21:14:43Araqflaviu: yes it does.
21:14:44vbtt_however, Araq said it has nothing to with ABI or separate compilation
21:14:52Araqbut this all besides the point
21:15:11renesacJehan_: are you sure you didn't solve the problem simply because you declared the mystrip() in your compilation unit?
21:15:17flaviuAraq: Without having to go through bunch of trouble with exportc?
21:15:51Araqflaviu: the stdlib uses the .rtl pragma for it
21:15:57Jehan_renesac: Sort of, yeah.
21:16:32Araqvbtt_: so you write program A against the stdlib.
21:16:45Araqwe update the stdlib and add a default param to proc foo which you use.
21:16:59renesacAssigning/passing a procedure to a procedural variable is only allowed if one of the following conditions hold:
21:16:59Araqwith .procvar we don't have to announce this as a breaking change.
21:16:59renesac The procedure that is accessed resides in the current module.
21:16:59renesac The procedure is marked with the procvar pragma (see procvar pragma).
21:16:59renesac The procedure has a calling convention that differs from nimcall.
21:16:59renesac The procedure is anonymous.
21:17:11AraqI mean with .procvar *in the language*
21:17:20*banister joined #nim
21:17:37renesacJehan_: you automatically filled the first condition declaring mystrip()
21:17:43Araqwithout .procvar in the language it IS a breaking change.
21:18:03Araqunless we do some gymnastics and generate closures under the hood for you.
21:18:11Araqwhich we don't.
21:18:51Araqno ABIs, no DLLs no nothing involved in this problem.
21:19:39vbtt_Araq: so - all procvar does it auto-generate the closure for me?
21:19:46Araqno,no,no
21:20:04vbtt_if you add a default parameter to foo, which I use, it's a breaking change
21:20:06Araqprocvar is a promise we won't add default params and so taking its address is allowed
21:20:12vbtt_ah
21:20:24vbtt_so basically, you can't add default params to procvar procs
21:20:30Araqexactly
21:20:31vbtt_meh
21:20:33renesacwhy is it bad to take the address if the parameters change?
21:20:45renesaca list of reasons
21:20:55Araqrenesac: because it's not a compatible type then anymore
21:21:41renesaccan't the compatibility check see that those are optional parameters?
21:21:48renesacgive an example why it breaks
21:21:55renesacI think it would make things clear for me
21:22:10Araq var foo: proc (s: string) = parseInt
21:22:21Araq --> stdlib's parseInt grows a param
21:22:31vbtt_Araq:how does it matter if it's a 'breaking change' or not. are you saying I dont need to recompile when you update the stdlib?
21:22:35Araq--> your code with 'foo' doesn't compile anymore
21:23:14Araqvbtt_: you have to recompile but you cannot recompile because it breaks your code ffs
21:23:14vbtt_So I'll recompile, see the error and fix my code.
21:23:41vbtt_I mean, unless I use only procvar procs, I'm going to have to fix my code for such changes anyway
21:23:56Araqno, you don't.
21:24:23Araqbecause you were forced to write proc () = cannotTakeAddrFromthis(a, b) to begin with!
21:24:36Demosto be honest procvar is nice for other reasons, you get to specifically say what parts of your library need ABI compat (yes I understand ABI is not the reason for the stdlib)
21:25:10Jehan_renesac: What I was getting at that you can declare things as {.closure.} and then they work, too. Except that for some reason Araq doesn't seem to like them. :)
21:25:46AraqJehan_: toplevel .closure *barely* works and caused a combinatorial explosion in the codegen to deal with
21:25:59Jehan_Araq: Gotcha.
21:26:38reactormonkI'd say the correct way to handle parsing stuff would be a sum return type - I mean we already have case objects
21:26:47vbtt_Araq: sorry still dont get it but i'll think about it. what i don't get is why is taking an address different from a call. does the type of the function not travel with the address?
21:27:15Araqtaking an address is *very* different.
21:27:28Araqfor a start, the address has to exist. ;-)
21:27:38vbtt_right, i get that about '+'
21:27:46Araqtemplates have no address as these are compile-time only things
21:28:17reactormonkAraq, the address always exists, but you can't guarantee it?
21:28:58vbtt_I can accept that I can't pass around a template as a first class object during runtime.
21:29:13*mwbrown quit (Ping timeout: 264 seconds)
21:29:40vbtt_but procs are available at runtime. most have addresses, no?
21:29:54Araqok, so what if we like to transform proc foo to template foo in the stdlib? (doesn't happen very often but still)
21:30:02renesacwell, the missing link is understanding how a call is made from a function pointer
21:30:12renesacnim uses fastcall
21:30:16vbtt_right that's the breaking change.
21:30:18Araqagain with .procvar in the language, not a breaking change
21:30:33vbtt_well, with prorvar in the language, not possible
21:30:33Araqwithout .procvar in the language, it becomes a breaking change
21:30:44vbtt_well is it even possible with procvar?
21:30:52renesacif you call the proc expecting a smaller number of arguments
21:30:57renesacit won't clear all the registers?
21:31:17flaviuIsn't it possible just to disallow taking the address of a proc?
21:31:23renesacor it will give an error accessing things that should have been on the call stack?
21:31:32Araqflaviu: that's what we do.
21:31:39Araqwell I give up.
21:31:50renesaclol
21:31:59AraqI still don't get why .procvar is so hard to understand
21:32:00vbtt_wait
21:32:04vbtt_i think i get it
21:32:25renesacwell, at least I understand what procvar does
21:32:28vbtt_basically procvar says "we are not going to change this proc in ways which make taking an address impossible, so you can take the address of this proc"
21:32:40AraqYES!
21:32:43renesacwhat I still don't fully understand is why it is needed, and possible alternatives to it
21:33:48flaviuAnother option might be to generate a new proc each time someone asks for the address of the proc.
21:33:56Demosit is breaking w/o procvar in that someone may be calling the function vai a pointer
21:33:59vbtt_well you made a static, systems language that looks like a high level language, of course people are confused when not everything is addressable ;-)
21:34:45renesacyeah, and what happens when you call a function via a pointer using less arguments than it takes?
21:34:57renesacat the low level?
21:34:57Demosor may be trying to take a pointer and you want to make the function generic
21:35:05Demosrenesac: you don
21:35:08Demosdon't do that
21:35:21Araqrenesac: the type system prevents this
21:35:25Demoslike in C this happens if you screw up calls to vararg functions
21:35:25Araqbut when you 'cast' around it
21:35:40Araqit often works ;-)
21:35:43renesacyeah, that is what I'm thinking
21:35:45Araqand often it doesn't
21:35:47Demosit is bad
21:35:56Demosand when it does not anything can happen
21:35:59renesacwhat makes it not work?
21:36:06renesacjust wanted to understand that
21:36:25Demosso when you call a function you have to push args onto the stack
21:36:40vbtt_Araq:in any case, auto-generating closures for wrapping non-procvar procs is probably a very useful feature.
21:36:44Demosif you were to push too few than the callee would pop off the stack an extra time
21:36:47vbtt_because it meets expectations.
21:36:54Araqyes, I agree
21:37:06renesacok, it is what I suspected
21:37:24Demosvbtt_: I am not so sure, I don't really expect a closure when I take an address
21:37:33renesacso what does D do to make this transparent?
21:37:43renesacit creates a closure for you when calling map()?
21:37:58Araqrenesac: I think adding a default param is simply a breaking change in D.
21:38:06renesachum
21:38:29Araqthat's what the other languages do. they don't care about the hole :P
21:39:55vbtt_I get why chaning proc to a template prevents taking the address. But why does adding a default param prevent taking the address?
21:40:09vbtt_I mean, it's still a proc with an address
21:40:13Demosright
21:40:24Demosbut you need to do something like the following to call
21:40:35Demossave registers
21:40:38Demospush p1
21:40:40Demospush p2
21:40:44Demospush newparam
21:40:47Demoscall addr
21:40:54vbtt_Demos:nim compiles to C, so yo udont do all that.
21:41:11Demosright, but the c compiler totally does
21:41:21vbtt_yes.
21:41:27Demosoh
21:41:28Demosright
21:41:34Demosin addition
21:41:51Demosthe type changes, so if you write out var f: proc(int,int) = somefunc
21:41:56Demosand somebody adds a default param
21:42:01Demosthe code does not compile
21:42:19Demosthe /reason/ the type changes is because of how the stack works
21:42:51vbtt_understood
21:43:09qwrhm, can't you work around it using overloading?
21:43:09Araqno, that's not the reason. the reason is type safety.
21:44:09Araqa type system usually doesn't reflect low level implementation details
21:44:48*ggVGc is now known as walt
21:47:07qwrimho you could default params simply by generating overloading function without the param that calls the one with the param, giving the correct value
21:47:26Araqqwr: yes that works, but causes some code bloat
21:47:47Araqin fact, it causes a combinatorial explosion
21:48:01qwryes, with multiple default arguments
21:48:09vbtt_java people do this by hand :)
21:48:25flaviuAraq: It's much cheaper if done on-demand.
21:48:41Araqflaviu: we discussed this.
21:49:01Araqit's possible and only Demos doesn't like it, but we don't have it.
21:49:53renesacthere is some measurement on how much bloat it would generates on average?
21:50:02renesacor because it is impossible there is no such code to test?
21:50:13renesac*it is currently impossible
21:51:29renesacand most of the time the function pointer is statically known
21:51:42renesacthe name of the proc is passed directly at the map() call site
21:52:26Araqrenesac: procs with lots of default parameters are not that uncommon
21:52:31renesacthe compiler could then adapt it to call the proper function with default parameters
21:52:42Araqwe don't have to measure it, it's bad :P
21:53:05qwryou can calculate how bad it is, no need to measure
21:53:08renesacAraq: yes, but if done on demand you will only need one more version of it most of the time
21:53:19renesacand the original version might not even be needed
21:53:29renesaclike in the case of split() in that program from the forum
21:53:35Araqrenesac: we already agreed the on demand solution is nice.
21:53:39renesaconly a split(s:string) is needed
21:53:56renesacI though Demos didn't
21:54:52Araqwell ok, not everybody agreed.
21:54:59Araqbig deal :P
21:56:37renesachis rejection is on phylosophical grounds or that he is afraid of the average bloat?
21:57:11renesacbut yeah, in a langauge like nim with templates, static[], etc, this solution is the most fitting IMHO
21:57:30Araqhe's simply smart enough not to expect the programming language solving every single problem for him :P
21:58:13renesacok, so it was anti-feature-creep, or a desire to keep what nim does behind the scenes understandable (like C)?
21:59:08renesacI like things working seamless, but also to know how and when magic occurs
22:01:23Araqthe desire here was "ugh, no way, we have other things to do"
22:01:53Araqusually features start in the "not implemented" state.
22:02:04renesacok, so put it on TODO and point people to it from now on
22:02:31renesac:)
22:02:58Sembeiwe have release dates for nim 1.0 ?
22:03:26renesacI don't really care when that is done, I agree that there are more important things
22:04:58renesaclike foward declarations, people are a little annoyed to discover Nim requires that, but "we havent gone around doing it yet, but we will do it" prevents undue anger
22:05:00renesac;)
22:05:25AraqSembei: we had december 2014. then we had march 2015.
22:05:46Araqwe haven't even managed to release 0.10.4
22:06:12renesacoriginally, there wouldn't be 0.10.x at all
22:06:13Sembeinot even a pre alpha?
22:06:38Araq"pre alpha" is meaningless to me
22:06:38renesacSembei: the universal answer works here: when it is done
22:06:50renesacSembei: you can have your pre-alpha
22:06:56renesacjust compile from github devel HEAD
22:07:06SembeiI know
22:07:21Araqit's hardly pre-alpha when people use it in production
22:08:03Sembeiat some point should be beta then
22:08:36flaviuOr maybe those people are just masochists
22:08:52*saml quit (Quit: Leaving)
22:14:08*polde quit (Ping timeout: 272 seconds)
22:14:33*renesac quit (Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/)
22:14:47AraqSembei: we wil have "release candidates" before 1.0
22:14:59*renesac joined #nim
22:15:18*polde joined #nim
22:15:35Araqwe could call the first release candidate "beta" I guess?
22:15:37DemosI mostly had a problem with generateing closures on the fly
22:16:17Demoswhich is what java does now that I think about it
22:17:25*wan quit (Ping timeout: 248 seconds)
22:17:45Demosalso, it is rare to have functions that you want to take the address of without knowing you will beforehand
22:17:56EXetoC< 2016? :p
22:18:26renesacDemos: but it isn't rare to use stdlib procs in functional programming
22:19:10renesacfor people who like the style
22:19:58Araqrenesac: exactly. FP makes this problem quite severe these days
22:23:27federico3are there non-homogeneous arrays?
22:24:37*pafmaf quit (Quit: This computer has gone to sleep)
22:24:52renesacfederico3: for what you need them?
22:24:56Araqfederico3: the Json module provides such a thing as a side-effect?
22:25:19federico3just trying to learn - I'm so confused by the whole language
22:25:32renesacnim is a typed language, it is a bit difficult to work with non-homogeneous arrays
22:25:49renesacfederico3: are you comming from python?
22:25:53federico3yep
22:26:09renesacany experience in a typed/staticaly compiled language?
22:27:28federico3not much. I was trying creating: seq[ParentObjectType] = @[]
22:27:43federico3and then adding two objects inheriting from ParentObjectType
22:27:48def-federico3: oh, that works
22:27:57federico3it doesn't here :)
22:27:57def-federico3: but make sure you are inheriting with refs
22:28:02federico3aha!
22:28:19renesacyeah, otherwise the object sizes are different
22:28:28def-otherwise even "var x: ParentObjectType = someChild" will cut off parts of the object
22:28:33renesacbut a ref to that object is constant size
22:28:53renesacpython always works with refs
22:29:47federico3is there a best practice of always using refs in Nim [unless there are very specific performance reasons]?
22:30:27AraqI guess you can say that, yes. esp for people coming from python.
22:30:40vbtt_agree - if you're from python, start with using refs
22:30:46walt^ slightly condescending :)
22:31:07reactormonkalthough value types have their advantages are certain points
22:31:09vbtt_why? it matches what python does
22:31:27*wan joined #nim
22:31:39federico3I've been using C, I'll have to get used to think ptrs/refs again
22:32:06vbtt_well if you're comfortable with c then not using refs is fine too ;-)
22:32:39*Kingsquee joined #nim
22:32:43vbtt_you can't create an array of disparate structs in c
22:32:54renesachttps://github.com/Araq/Nim/wiki/Nim-for-C-programmers <-- We need a "Nim for Python programmers"
22:33:04flaviufederico3: Inheritance -> always use ref. Small simple data object -> don't use ref.
22:33:05federico3yes!
22:33:13reactormonkrenesac, go team up with federico3 and write one
22:33:15federico3thanks flaviu !
22:33:27federico3thank you guys!
22:33:46renesacI personally like generic programming instead of inheritance
22:34:06reactormonkwhat's the difference betwen method and multi-methods?
22:34:27reactormonkrenesac, yup, inheritance in nim tends to be annoying.
22:35:35vbtt_reactormonk: they're the same in nim, I believe
22:36:21vbtt_reactormonk:In general methods only dispatch based on the target object, aka the first parameter. but mulit-methods dispatch based on one or more arguments.
22:36:31reactormonkvbtt_, kk
22:42:59*BlaXpirit quit (Quit: Quit Konversation)
22:44:00vbtt_z[5] = 5 # Error: Cannot assign to z < - in Nim-for-C-programmers - confusing line - should not be both out-of-bounds and non-var
22:58:36def-vbtt_: it's a wiki, you can fix it
22:58:44renesachttps://github.com/Araq/Nim/wiki/Nim-for-Python-Programmers <-- here a first draft
22:59:06renesacfederico3: help out writting the code snippets on what you did
22:59:23federico3oopsie
22:59:40renesac?
22:59:41federico3I was saving the same page right now!
22:59:46renesacoh
22:59:51reactormonkrenesac, neat
23:00:11renesacsorry, I should have warned that I started doing it
23:00:18federico3same here
23:00:30renesacyeap :P
23:00:47federico3renesac: I just pasted some chunks from the page about C
23:01:04pigmejhmm
23:01:23pigmejwhy I can't get addr of my object ?
23:01:27federico3the cheat sheet is unmanageable unless you have some better editor
23:01:35pigmej"Expression has no address"
23:01:36def-pigmej: it has to be a var
23:01:52pigmejdef-: I can't get addr of proc argument?
23:02:01def-pigmej: right
23:02:06pigmejhmm
23:02:28pigmejbut assigning to var makes copy, right?
23:02:56federico3renesac: I'll just remove the cheat sheet, ok?
23:03:07renesacfederico3: yeah, it is better
23:03:44renesacI don't think one needs to warn about unsigned on this page
23:03:53renesacas python don't have anything like that
23:04:47*irrequietus quit ()
23:04:57def-pigmej: right
23:05:03federico3saved. Yep, but rather a notice: your ints are going to be ints, not infinite size
23:05:11renesacyeah
23:05:32pigmejdef-: hmm, how can I avoid that ? pass ref already to proc?
23:05:42def-pigmej: what do you need the address for?
23:06:08pigmejcurently I'm playing with nim, so probably nothing serious
23:06:16def-pigmej: also see this forum thread: http://forum.nim-lang.org/t/851
23:06:16pigmejbut I wanted to have addr to write it to a file :)
23:06:41def-especially the explanations by Jehan
23:06:41pigmej(I know it's not portable etc) but it's mmap file so let's say I don't care about potability / os things etc
23:06:42renesacmaybe "bigints: Yes (transparently) - Yes (via nimble package)"
23:06:55Jehan_proc foo(x: int) = var x = x; do_something_with(addr(x))
23:06:59renesacI will edit it
23:07:35*jefus__ joined #nim
23:07:35dom96Araq: The docs tell you how to do it.
23:07:48pigmejJehan_: yeah I just wanted to avoid that copy ;-)
23:08:10federico3(stupid wiki with no locking mechanism)
23:08:45renesacoh
23:08:47def-federico3: the wiki is a git repo, you can use it as that
23:08:51renesacthen I wont edit
23:08:53*Trustable quit (Remote host closed the connection)
23:08:54def-federico3: then you can merge and stuff
23:09:01Jehan_pigmej: The compiler will optimize it out if possible.
23:09:12renesacbetter
23:09:29renesaccommit your changes, tell it here, then I do mine
23:09:37federico3def-: afaik you can fetch it from git, but maybe merging it requires sending a PR to Araq?
23:09:49federico3renesac: go on go on
23:10:04pigmejJehan_: hm, but isn't it awkward ? I have an obj, it's still living obj, why I can't get addr to dump it?
23:10:12pigmejI mean, it's awkward for me as nim n00b
23:10:46def-federico3: pretty sure you can push directly
23:10:51Jehan_pigmej: The argument may not even have an address, say, because it lives in a register.
23:10:52*jefus_ quit (Ping timeout: 250 seconds)
23:11:00federico3def-: thanks
23:11:07Jehan_What gcc does when you do &a is to actually create a copy on the stack.
23:11:17renesacdone
23:11:19Jehan_Assuming a is an argument.
23:11:48Jehan_Which makes the compiler more complicated without providing any actual benefit.
23:12:45reactormonkfederico3, might be some branch of the main repo
23:12:49pigmejJehan_: hmm, ok, I quite understand it then ;)
23:12:53flaviupigmej: You want to write the proc address to a file? I think that'll be unusable between program invocations.
23:13:08pigmejflaviu: not proc address
23:13:18reactormonkrenesac, mind if I slap it on https://github.com/Araq/Nim/wiki ?
23:13:23pigmejan address of proc argument (which is object in fact there)
23:13:43reactormonkpigmej, that sounds terrible. What are you trying to do?
23:13:54flaviuBut the lifetime of that address expires when the proc returns.
23:14:10pigmejflaviu: and fine ;-) I just need to store it :D
23:14:10renesacreactormonk: ok, but it is still in a pretty bad shape
23:14:39pigmejreactormonk: I have some python (sic!) code which uses struct to save objects and hmm
23:14:50pigmejit lack performance, I'm trying to experiment with nim
23:14:50renesacthe wiki needs to be more organized, with a proper hierarchy and more wiki links
23:14:57reactormonkrenesac, ok, you do it when you choose to then ;-)
23:15:14*banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:15:23reactormonkpigmej, so you're serializing stuff?
23:15:28pigmejreactormonk: yeah
23:15:29renesacthe "pages" box on the right is starting to be really inadequate
23:15:31pigmejbut fixed size needed
23:15:35renesacwith "show 10 more pages"
23:15:41pigmejwith as small overhead as possibl
23:15:44pigmejpossible*
23:15:55pigmejthe data is very very structured.
23:16:12reactormonkpigmej, so you have a serialization format given?
23:16:31pigmejreactormonk: no, I just know what comes in
23:16:43pigmejI wrap it with obj then I wanted to store it in file
23:16:52pigmejmmap file if that matters
23:17:04pigmejand later, obviously read it back ;-)
23:17:08pigmejthe problem => fixed size need
23:17:10pigmejneeded*
23:17:16renesacreactormonk: bah, I think it is better now than forgetting about adding it
23:17:25reactormonkno C libraries out there that do what you want?
23:17:27renesacI'm adding it
23:17:30reactormonkkk
23:17:49pigmejreactormonk: I have no idea ;-)
23:18:13vbtt_pigmej:where do you get this data from?
23:18:19pigmejnetwork ;-)
23:18:28pigmejnanomsg in fact but it doesn't matter at all
23:18:34pigmej(I think)
23:18:38vbtt_pigmej:so why not just dump the byte array directly into mmap or file?
23:18:43vbtt_you dont' need the address
23:19:39pigmejvbtt_: data processing is obviously needed )
23:19:40pigmej;-)
23:20:04pigmejdata comes to me via nanomsg with msgpack / protobuf format
23:21:11pigmejin fact I thought that's the easiest way :) if there is other way then awesome, but what is it ;D
23:21:38vbtt_pigmej: not sure how getting the address to an object helps you.
23:21:55pigmejwriteBuffer(f, obj.addr, obj.sizeof)
23:22:07vbtt_bah
23:22:16vbtt_what is this, C? ;-)
23:22:26vbtt_don't you already have a byte array?
23:22:36vbtt_(not sure what type of object you have)
23:22:42Araqpigmej: you can pass 'obj' via 'var' and then its address is available
23:24:14pigmejAraq: yeah I know this already ( Jehan_ + def- mentioned that)
23:24:29pigmejI just wondered why, then Jehan_ quite explained :)
23:24:44Araqok
23:25:57renesachttps://rolandwarmerdam.co.nz/github-wiki-sidebars/ <-- it seems one can have quite a bit of fun with github wiki
23:26:33renesacI was just looking to ways of hiding some entries, like the GSOC ones from the sidebar
23:26:44renesacleaving a manageable number of quick links there
23:28:21pigmejbut it's still awkward to me ;)
23:30:08pigmejbut also what's more important, Nim is really cool :)
23:30:49*yglukhov_ quit (Quit: Be back later ...)
23:31:51renesachttps://github.com/Netflix/Hystrix/wiki <-- something like this sidebar style
23:31:54*yglukhov_ joined #nim
23:32:03renesacthe Pages is hidden by default, and there is a table of contents instead
23:32:40renesachttps://github.com/Netflix/Lipstick/wiki <-- better yet
23:33:36renesacugh, git clone failed
23:33:37pigmejrenesac: wiki/_Sidebar/_edit
23:33:39flaviuhttps://help.github.com/articles/creating-a-sidebar/
23:33:45*Jehan_ quit (Quit: Leaving)
23:34:29pigmejafair there was also a way with Sidebar.md
23:34:36renesacok, someone with admin status must do it, aparently
23:34:36pigmejor something ;-)
23:34:45renesacat least from the graphical interface
23:35:39pigmejrenesac: add _Sidebar.md in folders
23:36:02federico3bye o/
23:36:11*yglukhov_ quit (Ping timeout: 250 seconds)
23:36:12pigmejhttps://github.com/gollum/gollum/blob/6fc3b4be75211957ee11725ff690e74d51bec1b2/test/test_app.rb#L594
23:37:32renesacI never touched that
23:52:02*vbtt_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)