<< 19-07-2014 >>

00:07:19Araqgood night
00:18:26*cariboo quit (Quit: Leaving)
00:18:46*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
00:28:04*Jehan_ quit (Quit: Leaving)
00:51:41*johnsoft joined #nimrod
00:53:46*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
01:02:10*bjz joined #nimrod
01:02:41*bjz quit (Client Quit)
01:23:03*johnsoft quit (Ping timeout: 240 seconds)
01:23:27*johnsoft joined #nimrod
01:39:56*bjz joined #nimrod
01:42:29*brson quit (Quit: leaving)
01:59:25*shodan45 quit (Quit: Konversation terminated!)
02:02:26*mwbrown joined #nimrod
02:02:41*mwbrown quit (Remote host closed the connection)
02:10:22*q66 quit (Quit: Leaving)
02:11:39*mwbrown joined #nimrod
02:15:05*bjz_ joined #nimrod
02:16:11*bjz quit (Ping timeout: 264 seconds)
02:20:38*gsingh93 joined #nimrod
02:21:36*bjz joined #nimrod
02:22:05*johnsoft quit (Ping timeout: 250 seconds)
02:22:11*bjz_ quit (Ping timeout: 255 seconds)
02:22:56*johnsoft joined #nimrod
02:23:57*saml_ joined #nimrod
02:26:01*kemet joined #nimrod
02:28:01*kemet quit (Client Quit)
02:34:13*bjz_ joined #nimrod
02:37:35*bjz quit (Ping timeout: 256 seconds)
02:49:47*Fx00F quit (Quit: leaving)
02:54:53Skrylarso now that the siphash stuff is a babel package, should i sent in the PR? (i babelized it on github a while back)
02:57:49flaviuSkrylar: Link please?
03:04:20flaviuI can't find siphash in babel, does it have another name?
03:06:52flaviuSkrylar: Ok, found it. I don't know about anyone else, but I'd like mixing and finalization separated out into their own steps so that its composable
03:28:25Skrylari'd have to go look at it again
03:28:42SkrylarIIRC i ported it from the reference implementation, so if it doesn't do it then the original doesn't either
03:58:57flaviuSkrylar: The paper describes the individual steps, but the implementation puts all the steps together
04:03:41*Skrylar shrugs
04:22:07*flaviu quit (Ping timeout: 240 seconds)
04:26:23*brson joined #nimrod
04:26:34*brson quit (Client Quit)
04:33:18Skrylaryup. just hijacking siphash as an RNG would have taken less time than me trying to figure out how multiply w/ carry works :/
04:41:19Skrylarwell thats new
04:41:26Skrylari didn't know nimrod did under/overflow checking for ints
04:45:36*flaviu joined #nimrod
05:01:59*bjz_ quit (Ping timeout: 250 seconds)
05:03:40*ARCADIVS joined #nimrod
05:05:23*saml_ quit (Quit: Leaving)
05:15:42*bjz joined #nimrod
05:16:35*Fx00F joined #nimrod
05:22:03Fx00Fnimrod-by-example.github.io, the example in the main page: Error: undeclared identifier: 'newCountTable'
05:25:30Fx00Fwhat's the new identifier for hash tables?
05:31:01*flaviu quit (Ping timeout: 250 seconds)
05:36:23Fx00Ffound it, it's initCountTable
05:53:17*Fx00F quit (Quit: leaving)
06:03:15*Demos quit (Read error: Connection reset by peer)
06:08:12SkrylaroO
06:08:26SkrylarAren't PRNGs supposed to have uniform histograms
06:11:33adoniscikby default
06:13:21SkrylarI implemented a multiply-with-carry generator and used mod(10)+1 to simulate rolling d10; I think I did this incorrectly, because according to R the distributions are crazy
06:13:39Skrylari think it probably needs to be scaled to a float and raised back up
06:18:41*mwbrown quit (Ping timeout: 250 seconds)
06:19:36*gsingh93 quit (Quit: Connection closed for inactivity)
06:20:26Skrylaryeah thats WAY more uniform
06:23:26adoniscikis there an easy way to define commutative procs: proc (a: T, b: S) = proc(b: S, a:T)?
06:23:38adoniscikwithout repeating the declaration, of course
06:24:09Skrylarthat could be done with a template/macro, likely
06:25:50*Skrylar ponders how exactly that would be done
06:26:58Skrylaradoniscik: if you don't mind the extra typing, "template blah(b: S; a: T): return = blah(a, b)" would do it for 'free' in that template expansion would just flip it around
06:27:19Skrylars/return/R
06:29:48SkrylarI think there would be a way to make it so all you'd have to do is just type commutative(function_name), but I do not recall if the macro system would be able to eyeball the parameter types for that
06:31:46*Mooneye joined #nimrod
06:32:00adoniscikgood idea
06:34:42adoniscikshould you declare all side effect-free proc arguments var ?
06:35:08Skrylarprocvar?
06:35:19adoniscikproc foo(x : var T)
06:35:36*gsingh93 joined #nimrod
06:35:38Skrylarok, what noSideEffects does is make it so anything which isn't directly passed in to the function is taboo
06:35:51adoniscikoh right that pragma
06:35:51Skrylarso you are allowed to change x.bar within that function, ONLY if it was passed in through a var parameter
06:36:08Skrylaryou are not allowed to change globals, for instance
06:36:19Skrylarits basically a good behavior enforcer, but there are occasional times not to use it
06:36:40adoniscikwhat's the var keyword with arguments for?
06:36:53Skrylarmeans they are pass-by-ref and modifiable
06:36:58Skrylarif i have a non-pointer (a: X)
06:37:05Skrylara.foo = 22 # not allowed
06:37:11Skrylarif (a: var X)
06:37:15Skrylara.foo = 22 # allowed
06:37:31adoniscikso it's completely the opposite of what I wanted :)
06:37:45Skrylaryes, leave 'var' off if you want it immutable
06:37:50Skrylarnote that this goes out the window for pointers
06:38:02Skrylarif you have (a: pointer), you can still dereference a and modify it
06:38:07Skrylaryou just can't change the /pointer/
06:38:10adoniscikbut if immutability is the default, what does noSideEffect do again?
06:38:21MooneyeSkrylar: will (a: X) do expensive copying? or is it just immutability that it specifies?
06:38:27Skrylaradoniscik: it enforces no side effects
06:38:39Skrylaradoniscik: for instance you can modify a global, but not if noSideEffects is set
06:38:54Skrylarit also bans a lot of unsafe pointer code
06:39:11SkrylarMooneye: IIRC it will still pass-by-ref objects, but they are not mutable
06:39:14Skrylarthe compiler will moan
06:39:31MooneyeSkrylar: sick. Nimrod looks so awesome.
06:39:36SkrylarIt is.
06:39:44SkrylarIts like a good version of pascal lol
06:40:00Mooneyenever used it.
06:40:08Skrylarwell its like a weird python then
06:40:17Mooneyenever used python, either.
06:40:22*Skrylar crawls underneath a mushroom
06:40:28Mooneye:P I was messing with you
06:40:31MooneyeI've used Python haha
06:40:44adoniscikhehehe
06:40:58Skrylarthe macro system looks a little lispy on the inside though
06:41:03Skrylarwhich is good, i like lisp
06:41:10MooneyeI've used scheme
06:41:12Mooneyewasn't a fan
06:41:39Skrylarhonestly i wouldn't mind a lisp microkernel
06:41:58Skrylari can think of a few ways to map a lot of programming languages to s-expressions that people don't actually touch
06:42:13MooneyeSkrylar: Greenspun's 10th
06:42:31SkrylarMooneye: Yup.
06:42:51SkrylarNow imagine if instead of Java, you had a microlisp built to be compiled so you had actual CLOS instead xD
06:43:17Mooneyeyou lost me. what's CLOS? what's microlisp?
06:43:31SkrylarOh. Common Lisp Object System
06:43:32Mooneyenevermind googled it
06:43:33Mooneyehaha
06:43:38SkrylarThats one of the parts of greenspun's 10th :P
06:43:47SkrylarEventually in a big enough OO system, they reinvent CLOS in C
06:43:47Mooneyeis it?
06:43:52Mooneyeoh okay
06:43:56MooneyeI never read that part
06:43:59Mooneyemust've been an amendment
06:44:49SkrylarDreaming of a lisp microkernel is a pipe dream sadly :(
06:45:06SkrylarEven if its so much better of an idea than a million JVM clones
06:45:52MooneyeSkrylar: That's where Greenspun's rule comes in.
06:46:18MooneyeA modularly functional C kernel is basically what you're talking about
06:46:22Mooneyeunless I'm totally ignorant
06:47:42Skrylarsomething like that
06:48:27Skrylari was thinking about how a lot of C/C++/Java/Nimrod/et all code could be easily structured similarly in lisp form
06:48:45Skrylarwhich would make the need for millions of compilers and IDE tools go away, as you just need to understand the lisp
06:51:28Mooneyemaybe I should do more lisp programming.
06:58:24Skrylari don't recommend it unless you have a lot of free time; the free lisps are bad at making redistributables
07:06:55MooneyeSkrylar: Too many languages are bad at making redistributables.
07:17:26*io2 joined #nimrod
07:35:37SkrylarMooneye: nimrod is good at it
07:35:43SkrylarIIRC there are zero dependencies
07:36:06Skrylarsince a lot of stdlib is just brought in from C, and the parts that aren't C have dead code elimination across all modules (e.g. delphi smartlink)
07:40:03MooneyeNimrod compiles to C, right?
08:01:36adoniscikwhat's wrong with the following code? http://pastebin.com/cCJDWrhQ
08:02:11adoniscikI get a type mismatch error on the proc's last line by the *=
08:11:35adoniscikhow can you define an argument to be one of several types?
08:11:50adonisciklike a generic, but more specific
08:17:19*Matthias247 joined #nimrod
08:19:09*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
08:19:46*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:25:11*Trustable joined #nimrod
08:42:06adoniscikI'm closer. I defined a type T using the or operator. However, when it comes time to use it in a generic proc, it wants all arguments of type T to be identical, whereas I want them to be any of the constituent types of T. How can I solve this?
08:56:07*adoniscik quit (Ping timeout: 256 seconds)
09:29:15*ARCADIVS quit (Quit: WeeChat 0.4.3)
09:30:32*Mooneye quit (Quit: Leaving)
09:39:36*gsingh93 quit (Quit: Connection closed for inactivity)
10:09:25dom96hi
10:26:33*BitPuffin quit (Ping timeout: 250 seconds)
10:28:29*Francisco quit (Ping timeout: 256 seconds)
10:32:31Araqhi dom96
10:33:09dom96hey Araq. Sup?
10:34:31AraqI'm going through the github issues ...
10:41:03*Fr4n joined #nimrod
10:44:47dom96Araq: Settled on an idea on how to fix the corruption yet?
10:46:21Araqyes
10:46:37Araqafter 'yield' I'll create another potential closure creation point
10:46:49Araqthis should fix it without introducing new regressions
10:47:01Araqbut it doesn't improve efficiency
10:49:14NimBotAraq/Nimrod devel 78b56bf Simon Jakobi [+0 ±1 -0]: sequtils: Complete mapIt documentation example
10:49:14NimBotAraq/Nimrod devel aeddc6f Andreas Rumpf [+0 ±1 -0]: Merge pull request #1378 from sjakobi/patch-2... 2 more lines
10:49:32NimBotAraq/Nimrod devel 4c4ebc9 Simon Jakobi [+0 ±1 -0]: sequtils: Correct documentation for keepIf proc
10:49:32NimBotAraq/Nimrod devel 188df67 Andreas Rumpf [+0 ±1 -0]: Merge pull request #1377 from sjakobi/patch-1... 2 more lines
10:49:42*q66 joined #nimrod
10:50:17Araqdom96: or should we do it the efficient way and see what breaks?
10:50:50Araqshould only effect edge cases
10:51:00Araqand I think I have tests for it
10:52:06dom96well this corruption was easy to find, the next may not be so easy...
10:52:28dom96although I guess you'll know where to look
10:53:19dom96I'd prefer if it just worked though
10:53:28dom96So that I could make sure everything else works
10:57:49Araqwell the resulting speed increase should be welcome
10:58:13Araqand as I said, pretty much every language except C# gets it wrong too and people don't notice
11:07:05dom96it's fast enough for now
11:08:56Araqmaybe but where does the next speedup will come from?
11:09:10Araqwe're running out of ideas already, right?
11:09:37dom96lol nope
11:10:06dom96well, there is plenty of micro-optimisations we can do I think
11:10:45dom96the profiler does mention newObj as being used heavily, but that's due to the amount of futures created I think
11:11:59*Matthias247 quit (Read error: Connection reset by peer)
11:12:59Araqer ... yes? like in a loop?
11:13:13Araqwhich my patch will transform out of the loop
11:14:23Araqwe should really do it this way
11:14:37dom96hrm. I think I get it.
11:14:56dom96So your patch won't only affect the newObj for the env?
11:15:18Araqit will pull it out of the loop
11:15:23Araqwell hrm
11:15:34Araqthat should help much ... damn
11:15:57dom96iterator fooIter(): PFutureBase =
11:16:02dom96 var retFuture = newFuture()
11:16:08dom96no wait
11:16:16dom96that retFuture is outside the iterator already
11:16:26dom96so it won't be affected by your patch
11:16:34Araqyes
11:17:03Araq*that should not help much
11:17:13dom96ahh
11:17:18dom96well there you go :P
11:17:33Araqunless I do it differently :P
11:17:53Araqargh
11:18:02Araqtoo hard to think about it, need to try it
11:18:17Araqperhaps it then merges the closures and then we win
11:19:21dom96I would prefer if you would fix the corruption and then worry about optimizations
11:20:11*Machielo joined #nimrod
11:21:18Machielomorning
11:23:02dom96hello Machielo!
11:24:09Araqdom96: that DOES fix the corruption
11:24:29Araqbut I've got some nice GC optimizations in the works too ...
11:24:57Araqhi Machielo welcome
11:25:07*BitPuffin joined #nimrod
11:25:47dom96Araq: I know. But maybe there are easier ways to fix it.
11:25:59Araqdom96: in fact this fix is much more bullet proof than the alternative
11:26:53Araqthe alternative is more fragile and I don't know if it covers all cases
11:28:34Machielothanks Araq :)
11:35:44gooblesPOOP
11:36:17Machielosorry to interrupt guys, but I'm new so what's the preferred method of issuing a feature request/offer help in nimrod? shorta like pep proposals in python?
11:36:24Machielothe forum? this channel?
11:37:11Machielois there a mailing list? sorry for the ton of questions :)
11:41:59Araqwe have a single NEP somewhere in the wiki
11:42:09Araqusually the bug tracker is used for feature requests
11:43:11AraqI don't really like this but now we can easily filter so it'll stay this way
11:43:32Machielook good :)
11:43:38Machieloand the github issues page?
11:43:52Araqthat's what I mean with "bug tracker"
11:44:22Araqin general people don't offer help but make PRs instead ;-)
11:44:54Araqwell ... they offer help here via IRC
11:45:40Araqin general IRC is my preferred method, answering on the forum takes more time and I can't rant on the forum ;-)
11:46:33Machielogood thanks! just to know how it works :)
11:47:00MachieloI guess I'll have to re-learn how to use irc :D
11:48:09Fr4nMachielo, just join the channel 0 and you're done
11:50:41*Machielo left #nimrod (#nimrod)
11:50:51*Machielo joined #nimrod
11:50:57MachieloI did join channel 0 :D
11:54:41Araqyes, this is the right channel
11:55:30*Fr4n quit (Ping timeout: 250 seconds)
11:59:02Araqhi goobles
11:59:21Araqnice that you're around but POOP is a somewhat strange greeting
11:59:53dom96Maybe it's an unfortunate acronym
12:00:55*Machielo left #nimrod (#nimrod)
12:08:34*Fr4n joined #nimrod
12:17:13Araqbbl
12:27:41*darkf quit (Quit: Leaving)
12:32:42*untitaker quit (Ping timeout: 245 seconds)
12:37:25*q66 quit (Quit: Leaving)
12:37:39*Ven joined #nimrod
12:39:20*untitaker joined #nimrod
12:39:56*q66 joined #nimrod
12:47:29*q66 quit (Remote host closed the connection)
12:48:32*kemet joined #nimrod
12:51:22*q66 joined #nimrod
12:54:06*saml_ joined #nimrod
13:08:57*Machielo joined #nimrod
13:12:50*flaviu joined #nimrod
13:15:27flaviuSkrylar: Still not correct thouth :P
13:15:55flaviuYou have to discard randomness to get a truly uniform distribution
13:16:23flaviugoing to a float leads to all sorts of difficult to understand and subtle baises
13:20:33*q66 quit (Quit: Leaving)
13:29:59*kemet quit (Quit: Instantbird 1.5 -- http://www.instantbird.com)
13:29:59*Machielo quit (Read error: Connection reset by peer)
13:30:55*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:31:10*Machielo joined #nimrod
13:40:06*Ven joined #nimrod
13:48:57*q66 joined #nimrod
13:49:50flaviudom96: Thanks for fixing that
13:50:55dom96np
13:56:03Machielohi, newbie question: would a syntax like `finished(iterator, variable): bool` where it returns true/false and sets the iterator's returned value on var make sense? i realize it's just syntactic sugar, just wondering
13:56:25*io2 joined #nimrod
13:56:40*io2 quit (Client Quit)
13:56:59Machielowould make it easier to type things like `let x = iterator; if finished(iterator): break; use x`
13:58:12def-Machielo: why not just this?: for x in iterator: use x
13:58:36Machieloyeah of course, but this is for when you don't for-through the iterator, for more complex stuff
13:58:50Machielobut I get it's not as common
13:59:07def-Machielo: but yes, i guess you could make a proc finished[T](iterator; x: var T): bool
13:59:58Machieloyeah, do you think it makes sense? or it's just clutter?
14:00:24def-I would have to see the code where you want to use it. not sure like this
14:00:32*q66 quit (Remote host closed the connection)
14:01:05Machielohmm not real code I'm afraid, just playing with the language and snippets
14:01:46*io2 joined #nimrod
14:01:56Machielolike http://nimrod-lang.org/manual.html#first-class-iterators
14:02:04Machielothe finished(x) example
14:03:02Machielobut I guess that's even more flexible and this doesn't solve that one so it's clutter :)
14:03:24def-Still always fun to implement ideas just to see how it would be done
14:03:42Machieloyeah! I'm gonna keep on playing
14:03:45Machielothanks!
14:04:00*q66 joined #nimrod
14:14:16*zling_ joined #nimrod
14:30:02dom96hello zling_, welcome
14:30:02*Machielo quit (Read error: Connection reset by peer)
14:30:37*Machielo joined #nimrod
14:48:21*flaviu quit (Remote host closed the connection)
14:52:23*flaviu joined #nimrod
15:05:01*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:10:37*saml_ quit (Ping timeout: 245 seconds)
15:15:36*Ven joined #nimrod
15:18:57*Demos joined #nimrod
15:27:32flaviuI can't convert https://gist.github.com/1ff3407e6aecd3526a8a with c2nim, even though it looks simple. There seems to be an error on the DOUBLE_ROUND define
15:28:05dom96flaviu: Try s/define/def/
15:29:36flaviuThanks, that works, but now it says its missing a semicolon at the end of an invocation of the macro
15:29:51fowlflaviu, those multi-line macros will never translate correctly
15:30:10fowljust comment them out and write them in nimrod later
15:31:56*fowl quit (Quit: goodbye, cruel server)
15:33:18*mwbrown joined #nimrod
15:36:10*fowl joined #nimrod
15:36:26flaviufowl: I don't see why they won't work, but that sort of works.
15:36:54flaviuFinal question hopefully: How do I translate those defineds into nimrod?
15:37:05flaviu__ is illegal in identifiers
15:37:49mwbrownflaviu: doesn't it ignore capitalization and underscores?
15:37:57mwbrownmaybe you could use just one underscore instead
15:38:40fowlflaviu, HALF_ROUND and DOUBLE_ROUND could be templates or functions, your choice
15:39:22flaviuInline functions probably, but my problems are with the when defineds, since they use underscores
15:39:34fowlirt the __ idents, they'll have to be fixed by hand
15:39:54flaviuJust get rid of the extra underscores?
15:40:10fowlflaviu, i'd take out all that endian crap, theres a constant in system.nim that has your endianness and endians.nim has functions to swap endianness
15:41:06flaviuOk, thanks
15:41:33fowllooks like _le64toh() can be replaced with bigEndian64()
15:42:17mwbrownfowl: wouldn't that break on a little-endian system?
15:43:52mwbrownsomething like le64toh would need a conditional on system.cpuEndian
15:43:52*Machielo quit (Read error: Connection reset by peer)
15:44:27flaviumwbrown: https://github.com/Araq/Nimrod/blob/188df67677912189438226b96e765ee034b2ff9f/lib/pure/endians.nim#L57
15:44:52mwbrownRight. When you call le64toh on a little-endian system, it is supposed to be a no-op
15:44:59*Machielo joined #nimrod
15:45:11fowlright
15:45:19flaviuYes, it is. Just a copymem, with no side effects
15:45:20fowlyou want littleEndian64() i think
15:45:30mwbrownyes
15:45:50flaviuDon't worry about it, unless you want to. I'll figure this all out eventually
15:46:05mwbrownmeh. on IRC and bored, might as well help out haha
15:46:43flaviuAnyway, I think I'll translate by hand instead. C2Nim is ugly
15:46:49flaviuand wrong, I think
15:47:16flaviuIt emited a case statement instead of a series of fallthrough ifs
16:03:58*bjz joined #nimrod
16:24:23*wan quit (Quit: WeeChat 0.4.3)
16:25:10*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:31:10*bjz quit (Read error: Connection reset by peer)
16:31:10*Machielo quit (Read error: Connection reset by peer)
16:32:11*Machielo joined #nimrod
16:33:56*Fr4n quit (Ping timeout: 260 seconds)
16:35:13*Varriount_ joined #nimrod
16:36:38*Varriount quit (Ping timeout: 240 seconds)
16:42:53*Ven joined #nimrod
16:42:53*Machielo quit (Read error: Connection reset by peer)
16:43:23*Machielo joined #nimrod
16:45:18*BitPuffin quit (Ping timeout: 255 seconds)
16:46:25*Fr4n joined #nimrod
16:46:43*Matthias247 joined #nimrod
16:57:02*q66 quit (Remote host closed the connection)
16:58:18*q66 joined #nimrod
16:59:28*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:04:11*Ven joined #nimrod
17:38:59*springbok quit (Ping timeout: 264 seconds)
17:40:23*Machielo quit (Quit: WeeChat 0.4.3)
17:42:24Varriount_Hello people!
17:42:35*Varriount_ is now known as Varriount
17:42:45def-hi Varriount!
17:59:16*ics joined #nimrod
18:09:10*adoniscik joined #nimrod
18:14:23*Machielo joined #nimrod
18:16:01*Machielo quit (Client Quit)
18:17:47*Machielo joined #nimrod
18:22:28*boydgreenfield joined #nimrod
18:25:28*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
18:25:37boydgreenfieldIs there a community consensus on prefixes for type names in packages (i.e., TMytype)? I seem to remember someone saying folks were moving away from this, but can’t remember. (Context: About to open up a Bitarray implementation and am wondering if I should leave the type as TBitarray or rename it BitArray). Thanks!
18:26:40Araqthe consensus is to remove the T/P
18:27:44boydgreenfieldAraq: Thanks. Got it. For P* types, is there an emerging convention around noting that’s it’s a reference in some way?
18:27:44*Machielo quit (Read error: Connection reset by peer)
18:28:26Varriountboydgreenfield: Styleguide answers all -> https://github.com/Araq/Nimrod/wiki/NEP-1-:-Style-Guide-for-Nimrod-Code
18:28:27boydgreenfield(And is EMytype still desired for Exceptions or are folks moving towards MyTypeException?)
18:28:42boydgreenfieldVarriount: Ah — was looking and had troulbe finding that on nimrod-lang.org. Thanks!
18:28:59*Machielo joined #nimrod
18:29:00Araqboydgreenfield: MytypeError
18:29:17Varriountboydgreenfield: I really need to publish that in the repo or something, and host it on the Website directly, along with all the other docs.
18:31:24boydgreenfieldVarriount: Not a problem, just wasn’t sure where to find it. How should one plan for the switch to the standard library? E.g., `BitarrayError* = object of EBase` will become what exactly? (Or perhaps items such as TSlice are better examples)
18:31:24*Machielo quit (Read error: Connection reset by peer)
18:32:03Varriountboydgreenfield: I've no idea. dom96 still uses prefixes in his additions to the stdlib, I don't.
18:32:11*Machielo joined #nimrod
18:32:20Araqdon't bother, nimrod pretty will fix it automatically
18:32:29VarriountHi Machielo
18:32:41boydgreenfieldAraq: Great. Thx.
18:33:11OrionPKUse of extra whitespace for alignment is discouraged
18:33:15OrionPK ^ boo
18:33:18OrionPKdefinitely boo.
18:33:18MachieloHi Varriount! :)
18:33:20OrionPKdisagree
18:33:26*ics joined #nimrod
18:33:56VarriountOrionPK: It messes with diffs, not everyone has an editor that supports auto-alignment, it's tedius to hand-align.
18:34:21VarriountOrionPK: But remember, that's only for the stdlib. You do what you want with your own private projects.
18:35:08OrionPKhand align
18:35:21OrionPKjust do hand alignment if it makes the code more readable
18:38:11*BitPuffin joined #nimrod
18:39:09VarriountOrionPK: "It's tedius to hand-align"
18:40:02OrionPKif it takes you 5 seconds to hand align something and it makes it 5 times more readable, then it's worth it
18:41:44VarriountOrionPK: Give me a community consensus.
18:42:20OrionPKgive me a community consensus the other way around
18:42:52Machielostupid question: how does "hand alignment" differ from "use of extra whitespace for alignment" ?
18:43:13Machieloin that there's no specified rule like "4 spaces per indent block"?
18:43:55VarriountMachielo: Not that kind of alignment
18:45:29DemosI don't think code alignment can make anything 5x more readable
18:46:10Machieloah like the alignment of data in type declarations and so on?
18:46:12OrionPKit definitely can
18:46:15Machielonot code indentation
18:46:17Machielogot it
18:46:25OrionPKit can be indentation Machielo
18:46:44VarriountMachielo: https://gist.github.com/Varriount/14c0234e5f9a5c9ef1d3
18:47:21OrionPKhttps://gist.github.com/onionhammer/cdcda4a7370b258fbe66
18:47:25Machielothanks got it!
18:51:53AraqVarriount: er ... the style guide is nice but
18:51:56flaviuOrionPK: Also messes up diffs
18:52:16Araqlacks the essential questions of what to do with FooObj vs FooRef
18:52:30OrionPKflaviu how is that?
18:52:46OrionPKwhose tool is going to change people's spacing automatically?
18:52:53flaviuIf you add a variable that has a longer name, you'll have to realign everything
18:53:34flaviuRegardless, I do use alignment in places where it helps make obvious the structure of the program.
18:55:23flaviuLike https://gist.github.com/a7f98a4fd63b4b3866bd
19:00:10VarriountAraq: Ok, what do we do about FooObj vs FooRef?
19:00:50AraqVarriount: Foo for the "primary" usage, FooRef/FooObj for the other
19:01:07Araqif there is no primary usage, it should be Foo and FooRef
19:01:23Araq(and FooPtr of course)
19:01:45flaviuin .net, there doesn't seem to be any convention differentiating structs and classes
19:01:52VarriountAraq: So a plain name for whatever version of the object will be used the most, and an Obj/Ref suffix for the less used version?
19:02:03Araqexactly
19:02:17VarriountSounds sensible.
19:02:24Araqflaviu: yeah and I don't really like that, but *shrug*
19:03:02flaviuI don't really like the idea of providing a `FooRef` object, `ref Foo` is just as good
19:03:22AraqVarriount: also mention the T/P/E/F convention and that -while deprecated- there still is lots of code around using this convention
19:03:32Araqflaviu: but it isn't
19:03:46Araqtype FooRef = ref Foo not nil # for instance
19:04:06Araq(ref Foo)(x: 1) is uglier than FooRef(x: 1)
19:04:09Araqetc.
19:04:26flaviuAraq: You already know my thoughts on (ref Foo)(x:1)
19:04:29flaviuBut those conventions do sound perfectly reasonable, I can put up with them without problem
19:04:41flaviuThe not nil is a good point
19:06:41dom96Varriount: what kind of extra whitespace for alignment are you talking about in the NEP?
19:06:42*Machielo quit (Read error: Connection reset by peer)
19:06:53flaviudom96: https://gist.github.com/Varriount/14c0234e5f9a5c9ef1d3
19:06:55dom96Isn't aligning the proc params basically that?
19:07:06dom96oh
19:07:14flaviudom96: Nope, you can change the length of parameter names without realignment
19:07:17dom96He may want to clarify that in the wiki
19:07:23*Machielo joined #nimrod
19:07:42VarriountAraq: Is there a term for the way enum members can be referenced without mention of the actual enum name?
19:07:52flaviuHungarian notation?
19:07:54dom96flaviu: you can?
19:08:22dom96flaviu: oh wait. I'm thinking of proc names.
19:08:56flaviuI think its worth that hassle there too, as proc names don't change too often.
19:09:26flaviuAnd its a bit of "punishment" for having a proc that takes too many params
19:09:29dom96well I disagree with the multi-procedure call style
19:09:36dom96the latter should be used all the time IMO
19:10:14flaviudom96: I think it'd get too cluttered
19:11:00*kunev joined #nimrod
19:11:01flaviuand with named parameters especially, version 1 is best because its easy to make out each parameter
19:11:59*Fx00F joined #nimrod
19:18:24*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
19:19:28boydgreenfielddom96: FYI, just added a package for you :)
19:21:02NimBotnimrod-code/packages master 778230e Nick Greenfield [+0 ±1 -0]: Add bitarray to packages.json
19:21:02NimBotnimrod-code/packages master d8cedd2 Dominik Picheta [+0 ±1 -0]: Merge pull request #70 from refgenomics/master... 2 more lines
19:21:05dom96boydgreenfield: thanks
19:23:34boydgreenfielddom96: To you as well.
19:23:52*BitPuffin quit (Ping timeout: 240 seconds)
19:24:26VarriountAraq: How should exceptions be named?
19:24:57AraqVarriount: FooError
19:25:18*kunev quit (Ping timeout: 250 seconds)
19:28:00fowlgoing to define my favorite errors
19:28:33fowlUnspecifiedError, UnknownError, UndeterminsticError
19:28:37flaviuWhile the renaming is going on, can someone sneak in an InvalidArgumentError?
19:34:03adoniscikwhat's the easiest way to define a proc whose arguments can be one of several types? If I define a new type T = T1 or T2 etc. I find that compiler only accepts parameters that are uniformly equal to the same subtype Ti of T, while I want them all to be allowed to be different, so long as they are in T.
19:34:03*Machielo quit (Read error: Connection reset by peer)
19:34:20*BitPuffin joined #nimrod
19:34:35*Machielo joined #nimrod
19:35:09flaviuadoniscik: How about proc foo[T]? when something isn't what you want, it will give a undefined symbol error
19:35:48adoniscikwhen you use T won't all arguments of type T have to be equal
19:36:00flaviuOh, I see what you mean
19:36:18def-adoniscik: foo[T1,T2] ?
19:36:23adoniscikthat doesn't scale well
19:36:25flaviuI'm not sure thats possible though, since I have that exact same issue when using unsigned types
19:36:58adoniscikdid you discuss this with the crew?
19:37:49adoniscikI want to be able to allow certain numerical types for which certain operations like addition and multiplication are defined. I don't care if it's an int or a float, for example.
19:38:03adoniscikso I say T = int or float
19:38:21adoniscikbut I want to be able to freely mix ints and floats, not just ints or just floats, which is what I get with T = int or float
19:38:30def-adoniscik: T1, T2 = int or float?
19:39:18adoniscikI guess, but you have to define as many Ts as you have arguments. It seems somewhat hackish to me, don't you think?
19:39:49def-also it's "T: int or float" I think
19:39:54flaviuYou also have to convert to homogeneous types to actually do the operations
19:41:59*pafmaf joined #nimrod
19:43:14def-adoniscik: actually you even need proc x[T1: int or float, T2: int or float](a: T1, b: T2)
19:43:20def-which really isn't all that nice, hm
19:43:36adoniscikI'm trynig sometihngh like that right now and it's not wokring
19:43:47Fx00Fzcant you have a macro do that for you?
19:43:55def-adoniscik: working for me
19:44:10adoniscikI think a template not macro is called for, Fx00F ?
19:44:17Fx00Fprobably
19:44:36Fx00FI'm not that familiar with nimrod
19:44:54adoniscikme neither :)
19:45:49adoniscikdef-, I get a type mismatch when I try to call it
19:46:11adoniscikwait a sec
19:48:06adoniscikall right, please look at http://pastebin.com/cPeufNbY
19:48:16adoniscikthe *= operation fails
19:49:39def-float(c) in line 3
19:49:57def-or no
19:50:01def-T2(c)
19:50:20adoniscikgood one
19:50:27def-and also, you can't echo an array
19:50:31adoniscikI thought float <-> int would be automatic
19:50:33def-because $ is not defined
19:50:45adoniscikthanks, I took care of that elsewhere but forgot to include the code for you
19:50:50def-ok
19:51:03adoniscikso float <> int is not handled automatically?
19:51:30def-only int constants are automatically seen as floats when it's a float parameter I think
19:52:46def-apart from that no
19:52:46*Machielo quit (Read error: Connection reset by peer)
19:53:58*Machielo joined #nimrod
19:55:04Varriountadoniscik, Fx00F: FYI, you can use repr() on most things to get a string representation of an otherwise non-stringifiable type.
19:55:09adoniscikIf I want to define a shorthand for float or int so I can shorten foo[T1: int or float, T2: int or float, ...] what are my options?
19:55:56Varriountadoniscik: type Number = float or int
19:56:10def-Varriount: which unexpectedly doesn't work. I'm currently filing a bug
19:56:14VarriountI think.
19:56:14adoniscikdidn't work for me, Varriount
19:56:16VarriountOdd.
19:56:28adoniscikfirst thing I tried :)
19:56:29flaviuDon't type parameters also have shorthand as [T1, T2: int or float]?
19:56:36Varriountflaviu: Yeah.
19:56:42def-flaviu: but then both are the same type
19:56:51def-flaviu: always both int or both float
19:57:08flaviuReally? That seems unexpected
19:57:23Varriountadoniscik: You could try a hack and use a template filter
19:57:58adoniscikI'm just learning templates, please can you show how?
20:00:09Varriounthttps://gist.github.com/Varriount/7459eee0a7197cb71140
20:00:12Araqadoniscik: ignoring the compiler's bugs, what you want to achieve is called a C++ism
20:00:28Araqlots of complexity for nothing ;-)
20:00:59Araqso ... uh I can't mix numeric types and pretend types don't matter? who cares
20:01:16VarriountAraq: I think adoniscik cares. :/
20:01:54Fx00FAraq: you hate math so deeply
20:02:03adoniscikwell, Araq, for the purposes of the algorithm it doesn't. If I define multiplication between ints and floats, I sholdn't have to spell out all four permutations
20:02:32adoniscikand that's with just two arguments
20:02:39Araqyeah well and I thought you can only multiply 2 floats anyway
20:03:09Araqint*float makes no sense
20:03:12Araqat all.
20:03:18AraqFx00F: in math.
20:03:38flaviuadoniscik: A converter from int to float maybe?
20:03:38adoniscikyou can upgrade the int to a float then
20:03:47Fx00FI guess it depends on what * means
20:03:48adoniscikbut if both arguments are ints, you shold stick to insts
20:04:08*ARCADIVS joined #nimrod
20:04:23Varriountadoniscik: Then you can do what flaviu suggested...
20:04:27*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:05:19flaviuadoniscik: You can get that. proc foo[T: int or float], and converter int2Float(i: int): float =...
20:05:54Varriount"Nimrod: Have one obvious way of doing things, and multiple fallbacks"
20:07:29VarriountAnyone know of a way I could shorten a heading "Conventions for multi-line statements and expressions"?
20:07:49adoniscikdelete the first two words?
20:09:44Araqbtw you can do: type Number = distinct int|float
20:09:50Araqproc foo(a, b: Number)
20:09:56Araqfoo(3, 2.0)
20:10:02Araqiirc
20:10:07*bjz joined #nimrod
20:10:14adoniscikoh that's intersting, let me give it a try
20:10:33VarriountAraq: But then he loses all the operators.
20:10:41def-Araq: no
20:10:49Araqno?
20:11:01def-Araq: doesn't work, just seems to work, because the 3 argument is automatically made a float
20:11:29Araqno ... how would that work?
20:11:48Araqlooking at the 2nd argument before the first to widen it to float?
20:11:54def-sorry, other way around
20:12:01def-with 3, 2.0 it doesn't work at all
20:12:11def-with 2.0, 3 it seems to work, but it's just 2 floats
20:12:31Araqah ok, well try:
20:12:39Araqproc foo(a: Number, b: Number)
20:12:49def-doesn't work
20:13:04def-bugreport here btw: https://github.com/Araq/Nimrod/issues/1385
20:14:25Fx00Fdef-: hi, I found another case where the usual/normal nimbrod code is slower than optimized c
20:14:42Fx00Fthis time with hash tables
20:15:04def-Fx00F: hi
20:15:39AraqFx00F: hash tables are crap for benchmarks unless you use the same hashing algorithms
20:16:04flaviuFx00F: TBH, nimrod's hash tables and hash algorithms aren't very good
20:16:17Araqyou might as well compare it to a binary tree otherwise
20:16:17Fx00Fthen nimrod is probably using a slow algorithm
20:16:22Araqand yes
20:16:30Araqwe never optimized hashing
20:17:17flaviuFx00F: I think the main issue is that the bits in the hash function aren't randomly distributed.
20:17:32Fx00Fand newSeq's insertions? I found that to be slower than c(using a library for dynamic vectors)
20:18:04VarriountFx00F: Did you compile using -d:release?
20:18:28Fx00FVarriount: yes
20:18:46VarriountFx00F: What C library were you using?
20:18:49flaviugist the nimrod version of the benchmark please?
20:19:11Fx00Fhttps://github.com/attractivechaos/klib
20:20:57*ehaliewicz joined #nimrod
20:21:12dom96Araq: Is there a way I can force the use of the general `$` for objects when I have a specific `$` defined for the object?
20:21:35Araqsystem.`$`
20:21:42Fx00Fflaviu: is hastebin ok?
20:21:58flaviuFx00F: Sure, I use gist because I have a terminal app to do it for me
20:22:02flaviuWhatever is convienet
20:22:19Fx00Fwhat terminal app? and do I need a gist account?
20:22:25dom96Araq: thanks
20:22:32*brson joined #nimrod
20:22:36dom96Araq: How's the bug fixing going?
20:22:48*dom96 is going through bugs too
20:22:55flaviuFx00F: gist is part of your github account, but don't worry about it unless you want to
20:23:13flaviuI use https://github.com/defunkt/gist
20:24:11Varriountdom96: What bugs are you working on?
20:25:02dom96Currently https://github.com/Araq/Nimrod/issues/1065
20:25:42Fx00Fflaviu: will take me some time, but I think it's better in the long run
20:26:55Araqwait what?! parseUrl("http://localhost/") / parseUrl("foo") / parseUrl("bar") == "http://localhost/bar" ?!
20:27:22Araqand we should implement this insane RFC? why?
20:27:22*Machielo quit (Read error: Connection reset by peer)
20:27:23dom96Araq: I know right?
20:27:32dom96Araq: Not to worry, I am implementing it sanely :P
20:27:35Araqwith a bit of luck this RFC is dead already
20:27:48dom96We'll have `&` and `/`
20:27:57dom96for URLs
20:27:58Araqseriously ... people who can't code are writing these "specs"
20:28:14*Machielo joined #nimrod
20:28:20flaviuAraq: How is the spec specifying that?
20:28:48flaviuNM, I see
20:28:50AraqRFC 3986, apparently
20:29:33dom96http://tools.ietf.org/html/rfc3986#section-5.2.2
20:29:44dom96There is the algorithm
20:31:40*Ven joined #nimrod
20:31:41*Machielo quit (Read error: Connection reset by peer)
20:32:17flaviuI don't see where he got that example, it is obviously wrong
20:32:26*Machielo joined #nimrod
20:32:30flaviuparseUrl("http://localhost/") / parseUrl("foo") / parseUrl("/bar") == "http://localhost/bar" is correct
20:33:07Araqwell that's hardly better
20:33:25flaviuActually, he's right, and it makes sense
20:33:40dom96In practice it's annoying.
20:33:51Araqit's error prone, flaviu
20:33:54flaviufoo is a file name, you can't go deeper. When going to bar, you are navigating to a file named bar
20:33:55dom96In order to get it right you must ensure that you have your leading/trailing slashes right
20:33:58dom96Which is a huge PITA
20:34:13flaviuNo other way to ensure lack of ambiguity
20:34:52VarriountI ran into a similar problem setting up an apache proxy the other day.
20:35:21AraqDO NOT IMPLEMENT THIS, or else give a name like correctByTheSpecButBraindeadCombine
20:35:47flaviuIt isn't braindead, its the correct way, if you understand what the url actually means
20:36:24flaviuHow can you navigate a file? It isn't a directory
20:36:40Araqwhy should "foo" be a file?
20:36:47Araqit's simply a name
20:36:55flaviuBy omitting the trailing slash, that's what you're saying
20:37:00VarriountSpeaking of a long procedure name, what should the the style rule dictate when a procedure declaration has both a really long name and a really long list of arguments, such that the normal style of starting the arguments on a new line at the column of the opening brace doesn't work?
20:37:26AraqVarriount: indent 2 spaces after the (
20:37:38*Machielo quit (Quit: WeeChat 0.4.3)
20:37:51dom96Araq: I'm thinking `&` vs. `/`. I guess you won't like that.
20:38:00Araqyup.
20:38:03flaviugenerically constructing hashes is hard :(
20:38:35flaviuEspecially how to decide the key size
20:38:43VarriountWhat kind of hash do python's dictionaries use?
20:38:57flaviuVarriount: I'm not looking for that
20:39:00AraqVarriount: ask Jehan when he's around
20:39:09flaviuVarriount: SipHash I think
20:39:16Araqhe wrote python's dict implementation, I think
20:39:27flaviuYep, siphash
20:39:39dom96Araq: What do you suggest then?
20:39:50VarriountAraq: Do you mean, he wrote python's dict implementation in Nimrod, or that he wrote the original python implementation of dictionaries?
20:39:51flaviuVarriount: http://legacy.python.org/dev/peps/pep-0456/
20:40:02Araqdom96: '/' vs obscureCombine
20:40:22AraqVarriount: the python version
20:40:40dom96Araq: i'll name it 'combine'
20:40:45flaviuI think that implementing the spec is first priority. Otherwise, things are unexpected
20:41:09VarriountAraq: You don't like specifications?
20:41:19Araqthe spec itself is unexpected and nobody reads it, flaviu
20:41:28dom96Yeah, look at stackoverflow for proof
20:41:38AraqVarriount: I like specs that make sense
20:41:39dom96Plenty of questions confused by this behaviour
20:41:45Araqthese are hard to come by though
20:43:02Araqalso I don't believe in specs. Is MacOS X compatible with Posix? ha, ha, ha
20:43:19*Machielo joined #nimrod
20:43:33Araqand if so with which version of Posix?
20:43:44AraqPosix is a moving target
20:45:08flaviudom96: I can't find any relevant questions
20:45:34VarriountAraq: Option one or option two -> https://gist.github.com/Varriount/1bd3f5da3e4b4907c72b
20:45:55dom96http://stackoverflow.com/questions/1795917/path-part-gets-overwritten-when-merging-two-uris
20:46:40flaviuVarriount: https://gist.github.com/flaviut/9d239aca007a036dbde8
20:47:14Araqdom96: I would really name it obscureCombine
20:47:14Varriountflaviu: Or that. But how will the procedure body look?
20:47:17flaviudom96: All I have to say there is that I don't know what he expected
20:47:28Machielognight everyone!
20:47:34VarriountGood night.
20:47:35*Machielo left #nimrod (#nimrod)
20:47:35AraqMachielo: bye
20:47:39flaviuThere is no way that url could be interpreted in any other way
20:48:38*Fx00F quit (Ping timeout: 240 seconds)
20:48:39Araqdom96: in fact, I wouldn't implement it all. Can't see a useful use case
20:48:39flaviuAnd there were only two people who weren't shaking their heads while navigating away.
20:49:06dom96Araq: Too bad. I already spent my time doing it.
20:50:37Varriountflaviu: I don't know, they guy's assumptions make sense - that's what I would assume.
20:50:45*Fx00F joined #nimrod
20:50:47AraqI think our HTML parser should yell if the DOCTYPE is wrong/missing and then stop parsing
20:51:04Araqthat will teach people to write correct HTML
20:51:26flaviuVarriount: A relative url starting with `/foo` is relative to the hostname, always.
20:51:59Araqhmm "a relative URL starting with /"
20:52:04dom96flaviu: The point is that when I am building a URL I really don't care about this stuff.
20:52:05Araqspot the error
20:52:38dom96And then programmers are forced to use string concat.
20:52:48flaviuAraq: I don't see it
20:52:51dom96and hope that they don't end up with no slashes or two slashes
20:53:57flaviuI can't really believe I'm arguing about `/foo`, even wordpress plugin devs know about that stuff.
20:54:22Araqflaviu: that itself is not what people expect from Unix paths
20:54:45flaviuAraq: Of course it is. Unix paths have no hostname
20:54:54*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:54:55Araq /foo is an absolute path
20:55:26flaviuAraq: file:///foo is an absolute path
20:55:43flaviuFor URIs, the scheme is non-optional
20:55:47AraqI'm pretty sure that came later
20:56:28flaviuIt did, but we're arguing about URLs, not path specifiers
20:56:40Araqbut /foo is not what we're arguing about
20:56:47Varriountdom96: The other option is to have one procedure that takes a parameter dictating behavior
20:57:02Araq"foo" without slash is what we're arguing about
20:57:26Varriountproc combine(a, b: string, op = Relaxed): string
20:57:29*Fx00F quit (Ping timeout: 256 seconds)
20:57:30dom96http://example.org/foo/ vs. http://example.org/foo
20:57:42Araqmeh ... I don't want to argue anymore
20:58:01dom96That's gotta be one of the most annoying things.
20:58:06dom96That stupid trailing slash.
20:58:25Araqyou can either care about human beings or about the spec
20:58:33Araqpick your poison
20:58:34dom96and that affects relative URLs
20:58:47flaviuFinal argument then: The spec should be met, even when it isn't intuitive for the beginner
20:58:49dom96Varriount: That hides the issue IMO
20:58:58*Fx00F joined #nimrod
20:59:11dom96flaviu: It will be met.
20:59:14*Ven joined #nimrod
20:59:38flaviuAraq: Basically the same argument as your math rant: Experienced users don't care, new users have no influence over things
20:59:39Varriountdom96: But it puts the responsibility of decision with the user, not the designer.
20:59:40dom96If I can stop watching TI
20:59:52dom96Varriount: huh>
20:59:53dom96*?
21:00:04Fx00Fflaviu: it's 7 files, should I use gist anyway?
21:00:04dom96Varriount: If you have separate functions the user decides too no?
21:00:11Varriountdom96: Yep.
21:00:25flaviuFx00F: Sure, I think that `gist *.nim` works
21:00:26Varriountdom96: But then you end up with naming weirdness.
21:00:48dom96a default argument is too implicit
21:01:21flaviudom96: I think that & is a reasonable compromise.
21:01:39Fx00Fhttps://gist.github.com/4eb265c3d05787d56ecb
21:01:40flaviuor even &/
21:01:42dom96flaviu: Well, Araq wants 'obscureCombine'
21:02:00Fx00FI included 2 files from that library
21:02:02dom96I will name it 'combine'
21:03:03Araqflaviu: the whole point of computers is to assist human beings, not transform human beings into thinking like a computer
21:03:19Araqprogrammers usually have to do the latter
21:03:30Araqbut that's nothing that you celebrate
21:05:00Araqnow go tell Google that they generate invalid HTML ... 'cause they care ...
21:07:00flaviuI'm sure google has made the page to use as few bytes as possible or something
21:07:21flaviuWhich is in my book good reason to break the spec
21:07:51VarriountFx00F: What happens when you put the code in the sequence benchmark in a main() procedure?
21:08:27VarriountFx00F: Globals reside in shared memory, thus there's a penalty for accessing them.
21:08:56Araqflaviu: yes, everybody has good reasons. Except me, of course.
21:09:06*ics joined #nimrod
21:09:20*Varriount just had a feeling of deja-vu
21:09:23flaviuNoob convenience is not a good reason
21:09:26Fx00FVarriount: in resize.c? what do you mean? it's all in main
21:09:44flaviuFx00F: What should I be benchmarking? resize.nim?
21:09:46VarriountFx00F: No, in resize.nim
21:10:11Fx00FI see no main() in resize.nim
21:10:33VarriountFx00F: Exactly. There should be one, if you're benchmarking.
21:10:40def-Fx00F: it's still a 32 bit int in nimrod and a 64 bit int in C
21:10:45Araqflaviu: *convenience* is a good reason.
21:10:48def-eh, other way around *
21:11:07Araqit's one of the best reasons there is
21:11:27VarriountDemos: ping
21:11:37flaviuWhen you are designing the spec, yes. When you are writing a library that advertises to be by the spec, no.
21:11:53Araqwe don't advertise to adhere to the spec
21:12:02Araqwe advertise to be useful and friendly
21:12:18DemosVarriount, pong
21:13:24flaviuFair enough, I value convention much more highly than you do then
21:13:46VarriountDemos: Do you remember what snippet you used to benchmark a windows program's total execution time?
21:14:02VarriountDemos: It invoked powershell through the command prompt, IIRC
21:14:23*Fx00F quit (Ping timeout: 250 seconds)
21:14:53Demosuse the Measure-Command commandlet
21:15:05VarriountDemos: Ah, thanks.
21:15:05Demosso like @powershell Measure-Command ... I think
21:15:23Varriountpowershell -command
21:15:41flaviuLol, the bottleneck for seqs is in an if statement
21:15:42flaviuhttps://github.com/Araq/Nimrod/blob/ed226eba6dab432ba47f3bb6e4a6b3b1dea64330/lib/system/sysstr.nim#L191
21:16:27*Fx00F joined #nimrod
21:16:44flaviuFx00F: Found the bottleneck I think: https://github.com/Araq/Nimrod/blob/ed226eba6dab432ba47f3bb6e4a6b3b1dea64330/lib/system/sysstr.nim#L191
21:16:47Fx00Fthose time outs... how do I add main to nimrod?
21:17:00def-Fx00F: proc main() = ...
21:17:12def-Fx00F: and then: when isMainModule: main()
21:17:18def-but i tried and got no speedup
21:17:43Varriountflaviu: So what is the C vector implementation doing differently?
21:17:50Araqit doubles the memory
21:17:53flaviuI dunno, I haven't looked there
21:17:54Araqnimrod's doesn't
21:18:14Araqnimrod's does * 1.5
21:18:37VarriountBut shouldn't that result in less time?
21:18:50flaviuAraq: That's taking practiclly no time at all
21:19:09def-Araq: when i make it double the seq it's only 10% faster, but the C one is still 5 times as fast
21:19:15Varriountflaviu: How did you find the bottlenck?
21:19:24Araqdef-: what?
21:19:32flaviuhttp://i.imgur.com/rRx3Qvt.png
21:20:00flaviuVarriount: callgrind profiler and kcachegrind GUI
21:20:15VarriountAww.. No Windows solution for me.. T_T
21:20:48def-Araq: i just changed resize() in sysstr.nim to double instead of * 1.5
21:20:53def-to check if that's it
21:20:56flaviugrowobject is also taking a while, make it inline?
21:21:14flaviuThe call is taking a while, not the proc
21:21:37Araqflaviu: that's the GC cleaning up old seqs then
21:21:56Araqperhaps
21:22:10Fx00Fand btw, the 2nd number in the benchmark in makefile is memory usage
21:22:22def-is it maybe because the C one uses realloc instead of a new alloc?
21:22:50def-(I don't know if realloc does any magic)
21:23:00flaviuThat wouldn't be a 5x improvement
21:23:09flaviu3x, maybe
21:23:18*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:23:22flaviu15% of the time is spent copying
21:23:48flaviuhttp://i.imgur.com/9nPARY3.png
21:24:43Araqwell realloc can expand the heap, we can't do the same
21:25:09Araqbut that only affects benchmarks, in the real world you rarely have only a single growing array
21:25:54*q66 quit (Remote host closed the connection)
21:26:20VarriountWait, so deallocation of old seqs is taking up time?
21:26:24def-the C one only calls memcpy once?
21:26:37*ehaliewicz quit (Remote host closed the connection)
21:26:48flaviuVarriount: deallocation is free pretty much
21:27:01flaviu0% of the time taken
21:27:30*q66 joined #nimrod
21:27:51Araqflaviu: so the CPU can't predict result.len >= result.space ?
21:28:11AraqI surely can predict that one...
21:29:54Fx00Falso, the nimbrod version is taking 2x as much ram (probably the grouth schedule)
21:30:12flaviuI think its getting predicted correctly, but its just really hot, so its taking a while
21:30:43flaviu34 or something true out of 10,000,000 false should be easy to predict
21:32:16def-For me it seems like this is entirely thanks to realloc
21:32:30def-when I make the C example use malloc instead it is exactly as fast as Nimrod
21:32:58AraqFx00F: well you have a seq[int] which can be a seq[int64] depending on your cpu
21:33:10Araqfor C you use int32
21:34:01Fx00FAraq: I changed it to uint64_t in the c version
21:34:48flaviulol, I've inlined literally every function in the program, and it seems to be slower!
21:35:08Araqdef-: grow 2 seqs in both benchmarks and realloc's advantage should vanish
21:35:16Araqwell "should"
21:35:33def-Araq: nice idea, i'll try
21:35:47Araqthese micro benchmarks are always weird
21:35:51Fx00Fin nimrod, int and int64 take the same memory, and int32 doesnt seem to exist
21:35:58def-Fx00F: sure exists
21:36:50Fx00Fok, exists, doesnt compile: resize.nim(4, 5) Error: type mismatch: got (seq[int32], int)
21:37:03flaviuThe range variable is an int
21:37:05def-Araq: nope, no difference
21:37:13flaviutry 1'i32..1000000'i32
21:37:47Araqdef-: well find out why realloc is so fast then :P
21:37:55def-magic!
21:37:56Araqso that we can perhaps learn from it
21:38:51*BitPuffin quit (Ping timeout: 256 seconds)
21:40:02def-oh wait, i think I just tested the wrong executable. these files shouldn't both be named resize =/
21:40:22Fx00Fdef-: are you not using the makefile?
21:40:56Araqflaviu: it makes no sense unless you have a cache miss in the 'if'
21:41:26flaviuIts just executed a lot. This isn't going to be representitive of real code
21:42:05flaviuI don't have a fancy i7 with its pipeline, it might make a bigger difference for me than others
21:42:36Fx00Fflaviu: me neither
21:42:46Araqwell but a[i] = x is executed as often as the 'if'
21:43:06Araqit's as "hot" and yet it doesn't show up
21:45:07Fx00Fwe chould use the same grouth schedule in both
21:45:53dom96Varriount: Use cygwin
21:46:27AraqFx00F: well iirc we claim a good performance vs speed of development ratio and not that GC'ed nimrod code runs as fast as C
21:46:29flaviuAraq: I can't even find the line that does the assignment
21:47:36Fx00FAraq: maybe you dont caim that, but others definiely do
21:47:57*BitPuffin joined #nimrod
21:48:06Fx00Feg https://nimrod-by-example.github.io
21:49:04OrionPKthat says c++ not c
21:49:07*Trustable quit (Quit: Leaving)
21:49:22Fx00Fthat c code probably runs in a c++ compiler
21:49:23flaviuOnly because I was too lazy to type out more words
21:50:46flaviuAraq: And the assignment is about as slow
21:51:21flaviuI see a bunch of movs in the assembler, I think that's it
21:52:02AraqFx00F: well obviously you can import realloc from C and get the same times :P
21:52:18Araqor rather import that C library that you use
21:53:02Fx00Fbut is that "easy"? that library uses macros extensively
21:53:06Araqor to make the point more fair: reimplement it in Nimrod and get the same speed
21:53:15flaviuAraq: BTW, I'm not blaming you for not caring about performance in this case.
21:54:41AraqFx00F: what's your point? it's not "easy" to use in C either. nothing is.
21:54:44flaviuAnd you have a couple good excuses: "Its a microbenchmark, irrelevant since real workloads do more work than an increment", and "Nimrod isn't fully mature, performance may not yet be ideal"
21:56:08Araqflaviu: hey, I do care about this benchmark
21:56:40flaviuI guess you have to use the second excuse then
21:56:45flaviu:P
21:57:18Araqwhere do we say "idiomatic Nimrod code always performs the same as C"?
21:58:18Araqand what does that mean anyway? btw Ada is often faster than C
21:58:31Fx00FAraq: calling an external c functio from nimrod is easy, but is it as easy to pass macro parameters to a bunch of c code and then call that c function you get from the preprocessor?
21:58:42flaviuAda doesn't have the same reputation as C
21:59:25flaviuWhen someone says "Ada", you think "airplanes". When someone says "C", you think "hardcore systems programming"
21:59:49flaviuFx00F: Should be easy to port those macros into nimrod
22:05:20Fx00Fflaviu: I woulndt know how, I could give it a try when I know more nimrod
22:06:33Fx00Fbut actually my motivation was to test how nimrod's standar library, which is based on ideas similar to that c library, compares to said lib
22:08:44AraqFx00F: tbh a comparison against C++ would be more interesting to me
22:09:04Fx00Fwhy?
22:10:06VarriountFx00F: Probably because whenever you try to google something C related, you end up getting results for nothing but C++
22:10:14flaviuAraq: Another feature request, a way of telling the GC the length of a unchecked array
22:10:17*boydgreenfield quit (Quit: boydgreenfield)
22:10:50Varriountflaviu: Can't you do that without the GC?
22:11:04flaviuSure, but it wouldn't work with object refrences
22:11:15VarriountHuh?
22:11:19*Jesin quit (Quit: Leaving)
22:11:21Fx00FVarriount: google is bad at that, not my fault
22:11:37AraqFx00F: because this C library shows again why C++ was a good idea ;-)
22:11:52Varriount"Idea" being the operative word.
22:11:54Fx00F^^
22:12:24flaviuVarriount: I can't have an unchecked array of ref T and have integration with the GC. My objects would be collected prematurely
22:12:45Varriountflaviu: GC_ref and GC_unref?
22:13:10flaviuReally? That works?
22:13:25*Fr4n quit (Ping timeout: 256 seconds)
22:13:33Araqfor some definition of "works"
22:14:00flaviuDoes it lead to neither dangling pointers or memory leaks?
22:14:15Araqit leads to manual memory management
22:14:29flaviuI can confine it to just part of the program, right?
22:14:49VarriountHm. Also, there's unsafeNew, although I don't know how references are dealt with for something like that.
22:15:34flaviuI can alloc the array, no problem. My problem is with ref Ts
22:16:27Varriountflaviu: Also, I must ask, why use arrays, and not seqs?
22:16:46flaviuI'm implementing that cool thing everyone just saw beating nimrod
22:16:59*Jesin joined #nimrod
22:17:04Fx00F^^
22:17:20AraqVarriount: there is no RFC for seqs so he doesn't trust them
22:17:34VarriountAraq: Pft, stop being petty.
22:18:08Fx00Fcan I talk about performance as often as you talk about standars?
22:18:42*Jesin quit (Read error: Connection reset by peer)
22:19:31AraqFx00F: yes
22:19:53Fx00F:)
22:21:52Varriountflaviu: Look at it this way - if your resort to manual memory management, your not doing anything the C benchmark isn't doing already.
22:22:23flaviuI can stick the manual memory management out of sight, its a layer of abstraction
22:22:47Araqflaviu: usually that's exactly what you can't do
22:23:03flaviuAraq: What file is the GC code in?
22:23:27Araqgc.nim
22:23:39flaviunot gc2.nim? ok
22:25:21*boydgreenfield joined #nimrod
22:25:36*Fr4n joined #nimrod
22:26:12*Jesin joined #nimrod
22:27:13Fx00Fthose leadin spaces in gc.nim look awful in my vim
22:27:22*Ven joined #nimrod
22:30:02*q66 quit (Remote host closed the connection)
22:30:21AraqFx00F: we don't clean those up because the resulting git diffs are annoying
22:31:02Fx00Ffair enough
22:31:14*q66 joined #nimrod
22:31:31*q66 quit (Remote host closed the connection)
22:32:53*q66 joined #nimrod
22:33:16flaviuAraq: Skimming over the relevant code, where do you get the size information for seqs?
22:33:48Araqflaviu: in 2 places but forget it
22:33:59Araqyou won't get that feature anytime soon
22:34:54flaviuIt was technically your idea :P "Future directions: GC'ed memory should be allowed in unchecked arrays and there should be an explicit annotation of how the GC is to determine the runtime size of the array."
22:36:59dom96we should make sure not to add any more leading spaces though.
22:37:11Fx00Fcan I safely remove csources/c_code folder?
22:37:26flaviuFx00F: Sure
22:38:10Varriountdom96: We could have nimbot merge pull requests manually for us, and run them through nimrod pretty
22:38:53Araqflaviu: can't you work on something important instead?
22:39:37flaviuI am. I'm just tired of endians
22:40:07*q66 quit (Remote host closed the connection)
22:41:11*q66 joined #nimrod
22:41:12dom96Varriount: We could have nimbot do many things.
22:41:21flaviuThe thing is, I want to be able to say "Nimrod is as fast as C, and it has automatic memory management."
22:41:38*boydgreenfield quit (Quit: boydgreenfield)
22:42:06Demoswhat was the problem?
22:42:11Demoswas it just using more memory?
22:42:37flaviuAnd 5x slower, although it was a very micro microbenchmark
22:43:45Araqflaviu: ok but how do ref arrays help with that?
22:44:44*Jehan_ joined #nimrod
22:45:10Fx00Fflaviu: s/as fast as C/ as fast and memory efficient as C/
22:46:34flaviuFx00F: Never going to be as memory efficent as C, garbage collection has a fixed overhead
22:46:48Fx00Fand probably some applications will still have manual memory management (eg, if it ever repalces fortran in HPC)
22:47:23flaviuAraq: In that benchmark it isn't, but in the general case, people aren't going to use it if they have to manage their own memory
22:47:25Jehan_If anything ever replaces Fortran in HPC, it's going to have manual memory management. :)
22:47:38Jehan_Fortran already has quite a few mechanisms to avoid manual memory management.
22:49:35Jehan_flaviu: "Fast as C" is one of the most meaningless statements in the world.
22:50:18flaviuJehan_: Maybe so, but its good marketing
22:50:41*boydgreenfield joined #nimrod
22:50:43Jehan_flaviu: Yes, but that's not at odds with it being stupid. In fact, a lot of good marketing is stupid.
22:51:17*pafmaf quit (Quit: Verlassend)
22:51:18Demosalso you can always construct a benchmark that C fails pretty hard at
22:51:43Fx00FDemos: not with numrod
22:51:50Fx00Fnimrod
22:52:21Demoswell you may be able to get some situation where nimrod can emit restricts that would be annoying for a human
22:52:31flaviuDemos: C has inline assembler I think, so take your fancy fast program and feed it into the inline assembler
22:52:48Demosflaviu, that hardly counts
22:52:51Demosand nimrod has that too
22:53:09flaviu:P. It technically counts, and that's all that matters
22:53:49Jehan_Well, and Nimrod can {.emit.} C code, too, so by that token, Nimrod can always precisely match C performance ...
22:54:12Fx00Fsure, nimbrod has the potential to genetate "faster than the usual hand written C code"
22:54:32flaviuGreat, I can say that "Nimrod is as fast as C for all possible programs"
22:54:43Demosright which is all that really matters
22:54:48Fx00Fsame as C does that with assembly, usually
22:54:57Demosyeah, exactly
22:54:58flaviuKidding of course
22:55:24flaviuBut what was the initial topic?
22:55:59Fx00Fmemory?
22:56:14Araqthe topic was "why the 2 words of overhead for seqs are unacceptable for flaviu"
22:56:23Jehan_The thing is that when you actually compare idiomatic C to idiomatically written code in other compiled languages, C is not necessarily faster.
22:57:02Jehan_Because the lack of abstraction power you have in C can lead to pretty inefficient designs.
22:57:10Jehan_Where, e.g., you copy data more than is necessary.
22:57:16flaviuAraq: Its not necessary the two words, its that I can't make my own seq, even if exactly the same.
22:59:09AraqJehan_: the excessive 'ifs' everywhere for error checking would be my number one source of inefficiency in C programs
22:59:27flaviuThe language provides the bare minimum, the libraries provide the abstraction. But if the libraries are an integral part of the language, with no clear separation, there is a problem.
22:59:51Jehan_Araq: There's no inherent need to program defensively.
22:59:57Fx00FAraq: that's what #ifdefs are for
23:01:20Demosflaviu, well C does not provide tools for abstraction at all
23:02:00flaviuDemos: I never said C was ideal
23:02:54Araqflaviu: so let me get this straight ... when seqs are built-in that's bad but when arrays are that's not?
23:03:26flaviuI'd be happy with a pointer and a way to tell the GC its type too
23:03:51Araqno, builtin pointers means the language is not expressive enough to have pointers as a library type
23:03:59*darkf joined #nimrod
23:04:31flaviuI'm not going to argue with that
23:04:48flaviuI'd agree, but you have to draw the arbitrary line somewhere
23:05:06Demoswhy not just have a ptr and then gc_root stuff on add and gc_unroot on del
23:05:39flaviuThat wouldn't hide the memory management from clients of the library
23:05:50Demoswhy not
23:07:32flaviuBecause a ref is passed to be stored, not a ptr
23:08:09Demosright you have proc add*(item: ref) = gc_root(item) ...
23:08:10Jehan_flaviu: What are you trying to do?
23:08:47flaviuC kicked Nimrod's ass in a benchmark, I want to implement a new vector type for nimrod
23:08:47Demosactually you would use gc_ref
23:09:07Jehan_flaviu: What benchmark?
23:09:19Demosalso, benchmark seqs aganst c++'s std::vector<T>
23:09:25flaviuhttps://gist.github.com/4eb265c3d05787d56ecb
23:09:55flaviuJehan_: make nimrod_resize, compare with make c_resize
23:10:50Jehan_flaviu: Since the C benchmark doesn't have garbage collection, I'd simply suggest doing a GC-free implementation to match it. /shrug
23:11:03flaviuJehan_: I don't want to do this halfway
23:11:11VarriountWhats the difference, besides performance, between the C and Nimrod versions?
23:11:13Demosflaviu, are you actually using b for anything?
23:11:25flaviuDemos: b?
23:11:33Demosthe seq called b
23:12:09Demosalso do you know that nimrod's countTables are as fast as this khash thing
23:12:15flaviuIts not my code
23:12:24flaviubut it doesn't appear that b is being used
23:13:55Fx00Fflaviu: 5x performance? did you fix the c version to use 32 bits ints?
23:14:03Fx00Fs/32/64
23:15:02Demosdid you profile
23:15:10flaviuDemos: Yes
23:15:18flaviuFx00F: Oh, only 3x then
23:15:24flaviu:/
23:16:57Fx00Fstill willing to make nimrod faster?
23:17:35DemosI bet nimrod could be fixed, the benchmark looks suspect
23:17:46DemosI mean nimrod is allocateing a big ass seq while c is not
23:17:53Jehan_flaviu: The C benchmark is faster simply because realloc() does not need to copy memory.
23:18:22Jehan_When I ran it and printed pointers before and after reallocing, that happened only once.
23:18:23flaviuJehan_: Let me benchmark again, I don't think thats it
23:19:25Jehan_Typical microbenchmark behavior that you won't see in a real program with a heap that's actually being used for more than one thing.
23:19:46flaviuJehan_: copying memory takes just 10% of the time
23:20:50flaviuJehan_: http://i.imgur.com/S3R8kwB.png
23:21:32*Fr4n quit (Ping timeout: 245 seconds)
23:23:57Araqlooks like the optimizer fails to keep the important thing in a register
23:24:04*5EXAAABOS quit (Ping timeout: 250 seconds)
23:24:25Demosalso that looks like it may be profiled with gperf
23:24:31flaviuInlining everything actually makes things worse
23:24:36flaviuDemos: callgrind
23:24:38Jehan_flaviu: Well, incrSeq contains the code to grow the sequence.
23:24:52Demoscallgrind runs on a virtual CPU right?
23:25:06Araqflaviu: well you need to do the inling properly
23:25:33flaviuJehan_: Here you go: http://i.imgur.com/WcTemPy.png
23:26:52*adoniscik quit (Ping timeout: 245 seconds)
23:28:16Araqtry it with a local L and setLen(a, L+1); a[L] = x; inc(L)
23:28:23Fx00FDemos: probably does random sampling, like stopping a debugger at random points, but no idea how
23:31:29Jehan_flaviu: I think your profiler is broken.
23:31:40flaviuFx00F: Actually, I think Demos is right.
23:32:07Fx00Fdoes it slow down the code a lot?
23:32:08flaviuJehan_: Possibly, do you have any recommendations?
23:32:17Jehan_I ran it with Instruments, and runtime was completely dominated by memmove and bzero.
23:32:21flaviuFx00F: Yes
23:33:18Jehan_http://imgur.com/dwGqx4B
23:33:51*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:34:46Jehan_flaviu: My recommendation is to do nothing. In a real program, realloc() won't give you that benefit.
23:43:38*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
23:56:02*vendethiel quit (Remote host closed the connection)
23:57:40*vendethiel joined #nimrod
23:57:49*boydgreenfield quit (Quit: boydgreenfield)