<< 07-04-2015 >>

00:06:23*brson joined #nim
00:17:05a5iWhen was Nim added to coding ground?
00:22:20onionhammerreactormonk resolve locally, sub-package lists
00:23:05*brson quit (Quit: leaving)
00:39:09renesacoh, nimble have tags
00:39:19renesacI never noticed it
00:39:27renesac*has tags
00:46:24*mpthrapp joined #nim
00:50:36*mpthrapp quit (Ping timeout: 240 seconds)
01:09:24reactormonkonionhammer, resolve locally? sub-package lists?
01:09:32reactormonkwhat do you mean by either of those?
01:12:32*rational quit (Quit: Lost terminal)
01:17:30onionhammerreactormonk; I mean when u do nimble install *packagename* it would install it into the folder you're currently in (in .nimble/ or something), unless you install globally (ala npm)
01:17:55onionhammerreactormonk sublists meaning the packagelist can reference other json lists of packages
01:17:58reactormonkonionhammer, so you want to have per-project packages?
01:18:19dom96onionhammer: Why do you want this?
01:18:20onionhammerright
01:18:37reactormonkcan you have multiple versions of a single nimble package installed?
01:18:44dom96yes
01:19:01onionhammerbecause then you can say "I'm releasing project X, a utility that does X, and depends on Y 1.2.4", but Y 1.2.4 doesnt need to be installed globally for u to build it
01:19:07reactormonkCan you specify an explicit version dependency?
01:19:11*endragor joined #nim
01:19:13onionhammerin case you have Y 2.0 installed also
01:20:04dom96onionhammer: you can have both installed globally
01:20:35onionhammerhow do you reference it in code?
01:20:51onionhammeralso when you uninstall X when you're done playing with it, why do I want the old version of Y around?
01:21:23dom96you don't reference it in code, you reference it in your .nimble file and then build via nimble build
01:22:06reactormonkonionhammer, uninstalling isn't too relevant, nimble packages are kinda small. A nimble purge or nimble clean would be nice
01:22:15dom96nimble can uninstall that automatically
01:22:16*saml_ joined #nim
01:22:18onionhammerhow big/small they are is arbitrary
01:22:28reactormonkonionhammer, so I don't see the need for per-project packages
01:22:38dom96it's got enough information to know that no package uses it
01:22:52onionhammerdom96 interesting
01:23:06dom96question is why would I want to install Jester 5 times if I have 5 projects which depend on it?
01:23:12onionhammerprobabloy
01:23:29onionhammerif you dont want to update all your old projects every time you update jester
01:23:40reactormonkyou don't need it
01:23:58onionhammernot everybody sets up nimble builds reactormonk
01:24:17reactormonkonionhammer, are you talking about development or deployment here?
01:24:21onionhammerboth
01:25:02reactormonkfor depolyment it's irrelevant, because you will have a nimble build
01:25:09onionhammeryou will?
01:25:21dom96for development you should be building with the latest package anyway
01:25:29onionhammerdom96 for your NEW project
01:25:30reactormonkhow else will you resolve the .nimble file?
01:25:35onionhammeryes
01:25:49onionhammerdom96 but not for your 5 other projects in your ~/projects directory that you arent working on
01:26:00onionhammerbut you might have to do bug fixes for and redeploy
01:26:52dom96what other package managers do you know of that allow packages to be installed locally like this?
01:27:29reactormonkdom96, ruby has the bundler which messes with rubygems to achieve something similar
01:27:34onionhammernpm
01:27:46onionhammernuget
01:27:56def-dom96: cabal sandboxes do it for Haskell because of cabal hell
01:28:36onionhammerprobably more
01:28:46reactormonkonionhammer, and what advantages would per-project packaging give you? nimble already does per-project resolution
01:29:53dom96I think it would easier to implement 'nimble c file'
01:30:21dom96which will build whatever file you want in your project dir with the correct dependencies
01:31:34reactormonkdom96, how exactly does nimble work? I figured it would just add a few more files to your import search path
01:31:43reactormonks/files/folders/
01:32:25dom96The docs describe how it works pretty well I think :P
01:32:55onionhammerit'd also be cool if nimble never actually crashed :)
01:33:07onionhammerbut instead handled errors and told users what happened
01:33:33dom96hrm? When does it crash?
01:33:57dom96If you're finding crashes and not reporting them then it's not my fault they happen :P
01:34:46onionhammerlol
01:35:12onionhammeri ran a nimble update recently and it crashed, this was while github was being ddosd
01:38:58dom96Yeah, and you should have sent me a gist of the error.
01:40:20onionhammersorry, next time
01:40:28onionhammeranyway, i gtg
01:40:30onionhammerafk
01:40:58dom96me too, good night
01:45:33*endragor quit (Remote host closed the connection)
01:47:46*Demos joined #nim
01:49:00*mpthrapp joined #nim
01:53:52*mpthrapp quit (Ping timeout: 272 seconds)
02:00:23Joe-Twith like npm, you still get the option to install globally, with the -g flag
02:01:29*BitPuffin quit (Ping timeout: 245 seconds)
02:04:08*untitaker quit (Ping timeout: 256 seconds)
02:04:53reactormonkJoe-T, yup, nimble can only install globally
02:09:18*untitaker joined #nim
02:11:24Joe-Tnot sure what a good way of specifying which packages to install globally would be, when running one command that installs all packages listed in a file though
02:12:16Joe-Tunless only ones with versions mentioned are made local or something
02:15:19*endragor joined #nim
02:15:28reactormonkJoe-T, all of them are global, nimble just puts the ones you want into your nim path
02:16:07Joe-Tyeah I'm just thinking what it would be like if it did support local
02:19:34*endragor quit (Remote host closed the connection)
02:21:04*endragor joined #nim
02:26:02*endragor quit (Ping timeout: 276 seconds)
02:32:28*brson joined #nim
02:32:39*brson quit (Client Quit)
02:35:02*jholland quit (Quit: Connection closed for inactivity)
02:45:27*brson joined #nim
02:45:51*endragor joined #nim
02:54:08*nande quit (Remote host closed the connection)
03:01:41saml_how can I get current time?
03:02:21*nande joined #nim
03:03:29*nande quit (Remote host closed the connection)
03:09:06*flaviu quit (Read error: Connection reset by peer)
03:09:19*flaviu joined #nim
03:09:29*nande joined #nim
03:11:24*brson quit (Quit: leaving)
03:17:55saml_lib/pure/times.nim(465, 8) Error: cannot 'importc' variable at compile time
03:19:37saml_https://github.com/Araq/Nim/blob/devel/lib/pure/times.nim#L45-L50 what's going on?
03:31:42*darkf joined #nim
03:34:46*Demos quit (Quit: leaving)
04:05:37*saml_ quit (Quit: Leaving)
04:43:14*a5i quit (Quit: Connection closed for inactivity)
05:01:40*dtscode is now known as mewtwo
05:02:41*wb joined #nim
05:12:02*katis_ joined #nim
05:47:59reactormonksaml, you're using it a template?
05:48:18reactormonkor in nim i?
05:48:49reactormonkboth run in the nim vm, and the vm doesn't support FFI, so you can't importc.
06:33:13*mewtwo is now known as dtscode
06:52:50*Ven joined #nim
07:08:13*endragor quit (Ping timeout: 252 seconds)
07:08:18*endragor_ joined #nim
07:12:21*ChrisMAN quit (Ping timeout: 248 seconds)
07:12:41*lyro quit (Quit: WeeChat 0.4.3)
07:20:38*endragor_ quit (Remote host closed the connection)
07:27:10*repax joined #nim
07:30:18*HakanD joined #nim
07:33:11*darkf_ joined #nim
07:33:30*BlaXpirit joined #nim
07:34:35*netroby left #nim ("Leaving")
07:35:07*nande quit (Remote host closed the connection)
07:36:13*darkf quit (Ping timeout: 245 seconds)
07:47:56*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:48:44*Trustable joined #nim
07:49:18*Trustable quit (Remote host closed the connection)
07:50:02*Trustable joined #nim
07:50:23*HakanD quit (Ping timeout: 245 seconds)
07:50:53*HakanD joined #nim
07:52:46*darkf_ is now known as darkf
07:59:48*dtscode is now known as mewtwo
08:00:16*mewtwo is now known as dtscode
08:03:33*gsingh93 quit (Ping timeout: 256 seconds)
08:07:48*Ven joined #nim
08:21:16*endragor joined #nim
08:23:25*HakanD quit (Quit: Be back later ...)
08:33:02*endragor_ joined #nim
08:34:47*endragor_ quit (Remote host closed the connection)
08:37:03*repax quit (Quit: repax)
08:37:18*endragor quit (Ping timeout: 272 seconds)
08:37:24*endragor_ joined #nim
08:45:57*HakanD joined #nim
08:46:28*endragor_ quit (Remote host closed the connection)
08:47:52*pafmaf joined #nim
08:48:43*endragor joined #nim
08:54:34*Pisuke joined #nim
08:58:33*milosn quit (Ping timeout: 250 seconds)
09:03:25*TEttinger quit (Read error: Connection reset by peer)
09:03:44*TEttinger joined #nim
09:05:07*HakanD_ joined #nim
09:08:53*HakanD quit (Ping timeout: 246 seconds)
09:11:48*endragor quit (Remote host closed the connection)
09:12:15*endragor joined #nim
09:21:40*pafmaf quit (Quit: This computer has gone to sleep)
09:21:53*endragor quit (Remote host closed the connection)
09:24:00*endragor joined #nim
09:24:12*BlaXpirit quit (Remote host closed the connection)
09:26:21*BlaXpirit joined #nim
09:27:42*endragor quit (Remote host closed the connection)
09:27:44*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:31:42*endragor joined #nim
09:36:08*endragor quit (Ping timeout: 252 seconds)
09:38:14*endragor joined #nim
09:40:02*endragor quit (Remote host closed the connection)
09:40:24*endragor joined #nim
09:50:32*endragor quit (Remote host closed the connection)
09:51:39*endragor joined #nim
09:54:31*endragor quit (Remote host closed the connection)
09:59:16*endragor joined #nim
10:01:56*endragor quit (Read error: Connection reset by peer)
10:02:02*endragor_ joined #nim
10:05:39*Matthias247 joined #nim
10:05:59*endragor joined #nim
10:06:16*endragor_ quit (Ping timeout: 255 seconds)
10:12:44*milosn joined #nim
10:15:18*Pisuke quit (Read error: Connection reset by peer)
10:16:10*Pisuke joined #nim
10:18:23*pafmaf joined #nim
10:19:20*wb quit (Ping timeout: 250 seconds)
10:27:32*a5i joined #nim
10:31:47*mpthrapp joined #nim
10:36:29*mpthrapp quit (Ping timeout: 252 seconds)
10:41:07*pafmaf quit (Quit: This computer has gone to sleep)
10:42:20*milosn quit (Ping timeout: 246 seconds)
10:43:27*Ven joined #nim
11:00:20*milosn joined #nim
11:04:19*untitaker quit (Ping timeout: 256 seconds)
11:07:39*jefus_ joined #nim
11:09:57*untitaker joined #nim
11:11:31*jefus__ quit (Ping timeout: 265 seconds)
11:21:04*milosn quit (Ping timeout: 245 seconds)
11:22:12*pafmaf joined #nim
11:22:40*BlaXpirit quit (Quit: Quit Konversation)
11:33:25*pafmaf__ joined #nim
11:34:01*HakanD_ quit (Quit: Be back later ...)
11:36:25*pafmaf quit (Ping timeout: 264 seconds)
11:40:40*HakanD_ joined #nim
11:47:47*milosn joined #nim
11:56:39*Pisuke quit (Max SendQ exceeded)
11:57:30*pafmaf__ quit (Quit: This computer has gone to sleep)
11:57:49*Pisuke joined #nim
12:01:29*pafmaf_ joined #nim
12:03:04*wb joined #nim
12:07:46*pafmaf_ quit (Quit: This computer has gone to sleep)
12:16:27*HakanD_ quit (Quit: Be back later ...)
12:16:56*pafmaf_ joined #nim
12:20:49*Kingsquee quit (Quit: Konversation terminated!)
12:21:14*BitPuffin joined #nim
12:23:24*novist quit (Ping timeout: 272 seconds)
12:33:14*a5i quit (Quit: Connection closed for inactivity)
12:42:17*pafmaf_ quit (Quit: This computer has gone to sleep)
12:43:37*milosn quit (Ping timeout: 264 seconds)
12:46:09*federico3 charges again at async
12:51:01*a5i joined #nim
12:53:49*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:55:29*milosn joined #nim
12:57:47*mpthrapp joined #nim
13:00:35*Ven joined #nim
13:04:13*repax joined #nim
13:07:27*milosn quit (Read error: Connection reset by peer)
13:11:46arnetheduckAraq, well, I only added the deprecation warnings after the review comments :/ I'll follow up with some cleanup anyway
13:12:01def-arnetheduck: I'm just cleaning it up
13:12:07def-arnetheduck: nearly done
13:12:19arnetheducka question first, the funny \n handling is considered a feature, right?
13:13:08arnetheduckdef-, ah, ok, cool, then I'll stay away until you're done.. these kind of refactorings tend to lead to conflicts unless they're done promptly
13:13:16*milosn joined #nim
13:13:26arnetheduckshout if you need me to finish it off...
13:16:07arnetheduck(ie the fact that \n is sometimes \r\n and sometimes just \n)
13:16:43arnetheduckand that the compiler tries to output correct line endings for the platform?
13:18:47def-arnetheduck: Is this ok? https://github.com/Araq/Nim/pull/2483/files?w=1
13:19:04repaxi.e. an extra \r is included for windows targets? That's the only platform nowadays that I can think of that uses \r
13:19:38repaxAnd even so, console apps are rather uncommon on windows
13:20:57repaxPerhaps this goes beyond console apps?
13:22:00def-arnetheduck: any reason we're not just using the standard lib ropes instead?
13:22:52*Matthias247 quit (Read error: Connection reset by peer)
13:23:27*Matthias247 joined #nim
13:26:25arnetheduck\n - compiler ropes have a hack where the format string interprets $n as target-platform-local eol sequence
13:27:04arnetheduckso until that's removed (and a few other small details, we can't use library ropes, unless library ropes are changed to use the same parsing
13:27:21arnetheduckbut then their parsing will be different from ordinary string %...
13:27:43def-ok
13:28:13arnetheduckso my commit was a first step to use the library ropes.. once (if) the other things are sorted, sure the compiler ropes should simply be removed, and things should "just work"
13:36:39arnetheduckrepax, notepad on windows apparently still doesn't take unix newlines
13:40:42repaxI suppose notepad is a valid use case. I can't say how important, though.
13:42:41arnetheduckdunno, but it feels like life would be more simple if \n was always \n, and if that's an issue, if the compiler didn't bother to try to output the correct line ending for the generated c files, since c compilers don't care, in general
13:43:16fowldoes visual studio mind it?
13:43:44*pafmaf joined #nim
13:44:25arnetheduckno.. some older visual studios had a really annoying bug where pasting into a unix line ending file would have you end up mixed.. this was a few years ago so one can hope they fixed it
13:46:02arnetheduckdef-, your pull req looks fine.. you missed the false case of the ~ template, but that doesn't really matter
13:56:06*milosn quit (Ping timeout: 244 seconds)
13:59:04samlimport times; const t = epochTime() this doesn't compile
13:59:19samlreactormonk, https://gist.github.com/saml/3d576990b19501d5f08a this doesn't compile
13:59:24renesacsaml: C FFI don't works at compile time
13:59:56renesacwhy do you want to get the time at compile time?
14:01:00renesacmaybe you meant a "let startTime = epochTime()"?
14:02:35*flaviu quit (Remote host closed the connection)
14:03:52*pafmaf quit (Quit: This computer has gone to sleep)
14:04:40*flaviu joined #nim
14:07:57repaxPerhaps you can convert the CompileDate and CompileTime constants. But you don't get the same precision, I think.
14:10:10*endragor_ joined #nim
14:13:18*endragor quit (Ping timeout: 245 seconds)
14:13:41*endragor_ quit (Read error: Connection reset by peer)
14:13:54*endragor joined #nim
14:17:42samlrenesac, ah. i see
14:18:39samlhttp://nim-lang.org/tut1.html#the-let-statement i see it now
14:24:56*brson joined #nim
14:33:25*TEttinger quit (Ping timeout: 248 seconds)
14:36:52*pcarlesi joined #nim
14:36:52*pcarlesi is now known as nortiero
14:37:46*nortiero left #nim (#nim)
14:45:22*egrep is now known as egrepnix
14:46:04*egrepnix is now known as egrep
14:46:07Araqarnetheduck: a few years ago *most* C compilers on windows wouldn't eat LF
14:46:17Araqand required CR-LF
14:46:33Araqthat's the reason for $n
14:55:34arnetheduckAraq, yeah, it does look like history rearing its ugly head (though it does sound odd with a c compiler that doesn't like lf).. more interesting is, is it still needed?
14:56:20arnetheduckalso, is the \n handling in the language a feature for the future?
14:56:38Araqyeah
14:56:50AraqI like it and nobody convinced me it's a bad idea
14:57:10Araqwhat's the point of \n if it's only an alias for \L ?
15:01:02*endragor quit (Remote host closed the connection)
15:04:18arnetheduckwhat's the point of having \L at all, and a non-standard \n? that's not how it works in c/c++/python/haskell/ruby/etc at least, so I'd say most people expect it to work a certain way
15:04:25federico3looks like I can't divide two TimeIntervals or cast them to floats
15:05:47arnetheduckspecially for c interop, where it's so easy to import c functions, having \n work differently feels like a pretty big gotcha
15:06:35flaviuarnetheduck: Don't use windows and you won't have any problems with that :P
15:08:16*mwbrown joined #nim
15:10:32arnetheduckI don't, except for gaming :) but it sure looks odd.. the other way around would be less surprising.. like a special escape for platform-local newline, and keep \n with its original, pretty much universally agreed upon meaning
15:12:30flaviuarnetheduck: I agree that that'd be better
15:12:49renesachttps://www.python.org/dev/peps/pep-0278/ <-- python i/o
15:16:35Araqwell yes, Nim's \n works better :P
15:16:35renesacyou have os.linesep to discover that returns the current line ending convention
15:16:43*milosn joined #nim
15:17:00Araqthat's the price of improving things, the old stuff is different
15:17:30Araqas a result we have no binary vs text mode nonsense in our IO lib
15:18:40Araq\n # like in C but don't use that, use \N instead which works properly with Nim's IO ?! that's not simpler for anybody in practice, that's *harder* to work with
15:19:24Araqevery newbie will use just \n and not read the docs
15:19:57flaviuBut it doesn't matter if they use \n.
15:20:07flaviuEvery text editor but notepad supports \n
15:20:41Araqit matters for other software too, not only notepad
15:23:35arnetheduckit does?
15:23:52*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:25:52Araqeven if not, it doesn't matter. what's *your* argument again? that it's a "gotcha" for C interop that nobody ever encountered?
15:26:06Araqhow is that a "gotcha"?
15:26:27*egrep is now known as coreutil
15:26:36*coreutil quit (Changing host)
15:26:36*coreutil joined #nim
15:28:22renesacI will side with araq, though it needs to be documented better
15:29:19*coreutil quit (Quit: Error -38: Black hole has swalled this client.)
15:30:16*egrep joined #nim
15:31:32repaxGenerating two different files depending on platform might cause confusion for tools doing comparisons, checksums etc
15:34:17repaxMight there be a burden in maintaining two sets of implementations for ropes etc?
15:36:25arnetheduckwell, it's a gotcha that \n can be more than one char for anyone who's ever seen a different programming language :) it's a little bit like \ vs / in paths.. or utf8 vs everything else.. in the end it tends to be easier to have one way of representing a trivial concept ("let's start a new line" in this case), and if any conversion is needed for reasons of antiquity, do the conversion as late as possible so that the logic dealing with it can be made
15:36:25arnetheduckmore simple...
15:36:27renesacoh, python 3 changed to be more what nim does
15:36:56renesachttps://docs.python.org/release/3.2/library/functions.html#open <-- see the newline parameter
15:40:11*darkf quit (Quit: Leaving)
15:41:37arnetheduckrenesac, how is it more nim-like? python does what I just described (by default), converts early / late, and lets \n be single-char as far as possible, in code ("\nx"[1] == "x" is guaranteed)
15:42:18renesachum, indeed
15:43:55renesacyeah, that last snipped ought to work, and will, but only in unix...
15:44:15renesac(or better, only in not windows)
15:46:59arnetheduckexcept nim, that snipped will work cross platform in most major languages, I'd say.. but anyway, before this goes too far, I readily admit that I don't have the larger picture here for Nim specifically. it struck me as odd, but Nim also seems to be a language in evolution, so above all, I wanted to know if this was slated for removal, or if it was considered a "good thing"
15:49:05arnetheduckin the context of the compiler, and the ropes lib, if ropes are to be a substitution for strings, with %/$ working mostly the same (so that one can switch between ropes and strings effortlessly), the special handling of $n/$N would have to go, and that would mean dropping target newline flavour support
15:51:08*banister joined #nim
15:52:22*Ven joined #nim
15:54:27*ChrisMAN joined #nim
15:55:07arnetheduckand if nim worked like most other langs I know, I'd be putting single-char \n everywhere, and if I needed that to be converted for some antique tool that doesn't cope with different newlines (in a today's webby heterogeneous world), I'd do that somewhere separate so that it could be isolated for that particular use case (like in the depths of the io lib)
15:59:04*endragor joined #nim
16:02:39Araqbash doesn't execute scripts which have CR-LF. interop is a problem everywhere, not just windows
16:03:41Araqarnetheduck: when I use some other IO lib, I use binary mode and do the newline ending on my own because this way a program on windows can deal with CR, CR-LF, LF out of the box. So Nim just uses my best practice really.
16:04:38Araqand I don't want some crazy transformations "in the depths of the IO lib" because that's slow and unnecessary
16:05:50Araqalso HTTP uses CR-LF, not LF. you're also completely missing the point of $n. The point is generate CR-LF on *linux* for *windows*. No IO abstraction can do that.
16:07:22renesacOpen(file, newline="\r\n")
16:07:33flaviu^
16:07:50Araqrenesac: that assumes I know the file's newline ending a priori
16:08:15Araqin other words: it completely misses the point.
16:08:18flaviuWhen it comes to IO, performance isn't really an excuse. Even SSDs will be much slower than the CPU.
16:09:11renesacthen Open(file, newline=""), like binary mode
16:09:16Araqflaviu: performance is one of the few objective things in computing and as such is always a valid excuse.
16:09:41renesacthen you can discover your fille newline ending
16:10:06Araqrenesac: I don't need to "discover" it. handling all three variants at the same time is trivial.
16:10:21renesacthen Open(file), in python 3
16:10:35Araqso python 3 does it like Nim :P
16:10:43*milosn quit (Quit: Lost terminal)
16:10:49renesacdoes like arnetheduck said
16:11:03renesacconvert to the plataform line ending and back on the io level
16:11:03*HakanD joined #nim
16:11:11*milosn joined #nim
16:11:17flaviuAraq: See https://docs.python.org/release/3.2/library/functions.html#open and the default parameters
16:11:34renesacI don't think a simple search and replace is that costly for an io layer
16:11:49renesacand you can aways use the binary mode if performance is important
16:12:07Araqrenesac: yep. exactly. I always use binary mode. because text mode is stupid as fuck.
16:12:24renesactext mode is convenient
16:12:36renesacfor most processing
16:14:51arnetheduckAraq, actually, that's exactly what the python io abstraction does.. in code you use a single newline char, and then, when writing to file, the io module let's you choose how to translate it, so when generating windows files on linux, you give it a special param)
16:15:50*gsingh93 joined #nim
16:15:52Araqarnetheduck: ok, fair enough
16:16:24*elbow_jason quit (Remote host closed the connection)
16:16:37AraqI still like my way better. my open doesn't require 17 different modes of opening a file
16:17:03Araqbut "simplicity" is only a valid reason when everybody-else-except-Araq is doing it
16:18:33flaviuAraq: We can't complain about the things we like in Nim :)
16:22:34arnetheduckanyway, we've established the meaning of $n - the question remains, is it still useful? is there any (supported/used) compiler/ out there which in 2015 doesn't support different newlines, that Nim wants to support?
16:23:27*pafmaf joined #nim
16:24:50arnetheduckelse, it seems like a good candidate for removal.. then, ~ can be implemented using the usual rope function instead of %.. having ~r translate to r % [] is slow for the common case, and sucks because stuff like ~somestring is unsafe, because somestring might have $'s in it if it comes from an unvalidated source
16:24:50renesacError: \n not allowed in character literal <-- at least it warns me
16:25:48arnetheduck(for example, in the compiler on can't use ~sym.name.s to get a rope)
16:28:02*pafmaf__ joined #nim
16:28:10*gokr joined #nim
16:28:24renesacbut yeah, I don't like the plataform specific newline stuff contaminating all string manipulation logic by default...
16:30:06renesacbut I agree that if everybod-else-did-it I would probably not complain about this
16:31:02*pafmaf quit (Ping timeout: 264 seconds)
16:31:37*elbow joined #nim
16:32:25*elbow is now known as elbow_jason
16:34:30endragorthere is no standard TreeSet implementation in Nim, right?
16:34:44fowlrenesac, '\L' is allowed
16:35:10fowl.eval echo "\n" == "\L"
16:35:13Mimbusfowl: true
16:38:07arnetheduckand, back a few lines, the "gotcha" is that nim is different from everyone else - \n has a well-established meaning and in nim it's different, so one has to be careful, and will do copypaste mistakes.. hence the gotcha
16:41:22*HakanD_ joined #nim
16:41:22*HakanD quit (Read error: Connection reset by peer)
16:41:33AraqI'm not careful with \n in Nim and it works for me.
16:42:12*pregressive joined #nim
16:42:19Araqit's however a nice topic for our weekly FUD campaign in #nim
16:43:09fowlAraq, when i started using windows more all grammars i wrote with glossolalia failed because i checked '\L' as newline instead of "\L\r" ._.
16:48:03*jholland joined #nim
16:50:09renesacwhile we are talking about FUD, is there a possibility to make "proc shl[T](a: var T, b: T) = a = a shl b" ?
16:50:22renesacI know the compiler won't alow me do define it
16:50:53renesacis a reason why it can't be maede available?
16:51:16renesacthis together with the command syntax alleviates my critcism on the lack of "<<" like operators in nim
16:51:24renesac*would alleviate
16:53:08fowlso you can do cout << ... << ...?
16:53:21renesacnote the definition of my proc
16:53:32renesacso I can do "h <<= 33"
16:53:35fowlyea i dont get it
16:53:44fowlwhy dont you define `<<=` then
16:53:46renesacinstead of "h = h << 33"
16:53:58*pafmaf__ quit (Quit: This computer has gone to sleep)
16:53:58renesacbecause it won't be an assigment operator
16:54:04renesacit would be a comparison operator
16:54:05renesacIIRC
16:54:16flaviu.eval template shl_eq(x, y: expr): stmt = x = x shl y
16:54:18Mimbusflaviu: <no output>
16:54:20renesacor an arrow like operator
16:54:23flaviuThat should work.
16:54:26flaviuI think.
16:54:55fowlrenesac, ends in = it has precedence of assignment operators
16:55:25renesacstarts in <
16:55:29renesacis a comparison operator
16:55:30fowlanyways
16:55:32fowlit works
16:56:40fowlproc `<<=` (a:var int; b:int) = a = a shl b; var a = 1; a <<= 1; assert a == 2
16:56:44fowl.eval proc `<<=` (a:var int; b:int) = a = a shl b; var a = 1; a <<= 1; assert a == 2
16:56:45Mimbusfowl: eval.nim(4, 1) Error: ')' expected
16:56:50renesacIf the operator ends with = and its first character is none of <, >, !, =, ~, ?, it is an assignment operator which has the lowest precedence.
16:56:50renesac
16:56:50renesacOtherwise precedence is determined by the first character.
16:57:32renesacI know that because I've tried to override that
16:57:41renesacand I was able for a time with templates, but then it broke again
16:57:59renesacusing expr, not int or any thing type checked
16:58:18fowl.eval import macros;dumplisp: 1 <<= 2 += 4
16:58:20Mimbusfowl: StmtList(Infix(Ident(!"+="), Infix(Ident(!"<<="), IntLit(1), IntLit(2)), IntLit(4)))
16:59:01renesachaven't tried macros
17:00:08Araqrenesac: use shiftLeft instead of shl?
17:00:34renesacAraq: much less convenient
17:00:34*HakanD_ quit (Read error: Connection reset by peer)
17:00:36Araqor shiftL or whatever
17:00:59renesacthere is a reason why we don't write "x.addequals(2)"
17:01:06renesacand preffer "x += 2"
17:01:42renesacor equivalenly "x = x add 4"
17:02:32Araqso use |<<= :P
17:02:54renesacAraq: I was asking if there was a reason not to offer this for keyword operators
17:03:13renesacas it seems an invalid syntax right now
17:03:19renesacthat could be useful
17:03:44Araqwell nobody requested it yet
17:03:56Araqneed to look into the grammar
17:04:11renesacok, it can be for after 1.0 I think
17:05:09renesacas I won't convince you to dump those clunky keyword operators in favour of C/python style ones anyway
17:05:10renesac;)
17:06:19renesacas you don't use them often
17:07:27renesacfor me the same argument to have "+" instead of "add" or "plus" would be valid for having "<<" instead of "shl"
17:08:00renesac*same arguments
17:08:07Araqagain the argument is simplicity of operator parsing rules. << is obviously a comparison operator.
17:09:01Araqit even means "much less than" in math. just because C jumps off the bridge, that's not a reason for Nim to do the same
17:11:00renesacok, and then you have that one, valid, argument against it
17:11:13Araqand again I wonder what kind of programs you write. << is simply not a useful operator, it's used for setBit or multiplication
17:11:54renesacor move bunch of bits at the same time
17:11:55renesacetc
17:11:57Araqand a setBit proc/template is not that hard to come up with and use instead
17:12:33renesacyeah, I have one set bit
17:12:39renesac*setbit
17:12:53renesacbut for hashing you use <<
17:13:08flaviurenesac: How often do you write hash functions?
17:13:08renesacfor writting that setbit you use <<
17:13:41renesacanyway, the things I want to write in nim is because they would be too slow in python
17:14:01renesacand in those things I'm usually treating with bytes, not numbers
17:15:22renesacand shr is useful for division by powers of two, especially if you are using signed ints
17:15:37renesacwhere the compiler can't optimize it for you
17:16:49flaviurenesac: So define an optimized int type, and write a `/` method that optimizes divison the way you want.
17:17:06flaviusemistatic seems to be made for this exact situation.
17:17:10renesacI preffer to be explicit
17:17:14renesacsemistatic is no more
17:18:34renesacanyway, the last time I was coding in nim I wanted to help blaxprit write his Random library, giving him a log2 proc for integers, and needed bitshift there too
17:18:49renesac(and had some problem I don't remember what and din't finished it)
17:20:20renesacI passed to him the last version that partially worked though...
17:24:20renesacwell, and data compression, bit granularity streaming, etc
17:24:28renesacanyways, it always come up for me
17:30:10*5EXAAXYM0 joined #nim
17:45:07Araqrenesac: you can use *< and *> and it's quite "logical" this way cause the precedence should be like *
17:48:24Araqand fwiw C completely lacks a bitwise rotation operator
18:00:00federico3https://developerblog.redhat.com/2015/04/07/jit-compilation-using-gcc-5-2/
18:00:35endragorAraq: do you usually implement hash() proc for standard library types? Rational doesn't have one, and I'm not sure if it's an intention or oversight
18:02:12*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:09:45Araqendragor: usually I don't but only because I'm lazy
18:12:44*yalla12 joined #nim
18:21:14*Pisuke quit (Ping timeout: 272 seconds)
18:25:10*Pisuke joined #nim
18:26:09renesacAraq: *> is arrow like right now, and I know you already asked me to do a PR correcting that
18:26:24Araqok
18:26:36renesacbut changing only that isn't that good
18:26:57renesacas there is "xor" and all that left
18:27:37renesacand mantaining an hackish operator library while the language rightly changes under your feet isn't very good either
18:28:43renesacit seems that #!strongSpaces wont be a big thing in the future
18:29:22flaviuI really don't see the problem here.
18:29:30renesacas you are already correcting the "echo $x" problem with a toned down version of it
18:29:30flaviuIs foo = foo shr 1 really that bad?
18:29:58renesacflaviu: about as bad as "foo = foo add 1"
18:30:22Araqpeople are too scared of strong spaces and I usually listen to people even though I pretend to not do that
18:31:35flaviurenesac: That's not that bad.
18:31:37renesacand strong spaces isn't compatible with keyword operators
18:31:49renesacflaviu: yeah, it is possible to live with
18:31:53EXetoCif you completely ignore the usage frequence yes
18:31:55Araqrenesac: I intend to fix that though, haven't forgotten about your bug report
18:32:22renesacAraq: I don't mean that, but also "echo not 1" fails to compile
18:32:33renesacright now
18:32:56Araqthat's not different from echo $1
18:33:01renesacand the unary precedency rule regarding spaces won't change that
18:33:15renesacyeah, but "echo $1" will be corrected
18:33:29Araqaha ok
18:33:37EXetoCas in #!strongSpaces will never be implicit?
18:33:49AraqEXetoC: I don't think so.
18:34:47renesacis ! being used as an unary operator right now?
18:34:56*user7181 joined #nim
18:35:01*MyMind joined #nim
18:35:14AraqI don't think so, renesac
18:35:29EXetoCno point in using then I guess. I assume it'll just result in confusion
18:35:53*BlaXpirit joined #nim
18:35:54renesacit has the same precedence as "not" , and is already used in "!=" comparator
18:36:58*Pisuke quit (Ping timeout: 252 seconds)
18:37:00renesacthat way we could fix the application of all unary operators in the language
18:37:11renesacat least
18:37:41Araqs/fix/change
18:43:46*emilsp quit (Quit: Lost terminal)
18:48:57*Jehan_ joined #nim
18:57:03*endragor quit (Remote host closed the connection)
18:59:04*endragor joined #nim
19:07:07*MyMind quit (Ping timeout: 256 seconds)
19:08:44*repax quit (Quit: repax)
19:12:26*BitPuffin quit (Ping timeout: 265 seconds)
19:14:41renesaccontinuint the nitpicking, it is interesting how Nim and C reached the same bitwise and/or/xor operator precedence over comparison by different paths
19:15:06renesacthat C creators recognized as unfortunate
19:16:20renesacat least in nim it will cause a compilation error not using parenthesis, while in C it will likely lead to an unintended result
19:19:52Araqalso there are good reasons for Nim whereas in C it's completely arbitrary anyway
19:20:11renesacfor C it was backwards compatibility
19:20:33Araqwith what? B? BCPL?
19:20:39Araqolder C?
19:20:45renesacwith B and older C
19:21:02renesacoriginally, C didn't had && and || operators
19:21:33renesacwith short-circuit semantics
19:22:20renesacso it made sense to have | and & operators with lower precedence than ==
19:23:16renesachttp://stackoverflow.com/questions/4685072/operator-precedence-bitwise-lower-than
19:24:35Jehan_Well, there are certainly advantages to the Smalltalk approach to operator precedence as the other extreme, too. :)
19:25:08renesacin D they also have lower precedence, but in Python, Rust, Swift, Go,.. they corrected it
19:25:40*eigenlicht quit (Quit: WeeChat 0.3.2)
19:25:44renesacand &, | and ^ have higher precedence than ==, but lower or equal precedence to *
19:28:17renesacand & always have higher precedence than | or ^
19:28:43renesacwell, in nim "and" has higher precedence than or/xor too
19:28:51Jehan_In Smalltalk, all operators have the same precedence. :)
19:30:28Jehan_That said, what you generally want for convenience is: logical operators < relational operators < arithmetic/bit operators.
19:30:45renesacyeah
19:30:50Jehan_The biggest problem is sorting out the precedence for the various arithmetic/bit operators.
19:31:34Jehan_Other than + and - being below * and /, things are pretty much up for grabs.
19:32:13*vendethiel joined #nim
19:34:29renesacwell, go uses only two precedence levels for arithmetic, then one for relational, and two again for logical (mantains && higher than ||)
19:34:53renesacit is the simplest I've seen (except for smalltalk or lisp of course)
19:35:36*Strikecarl joined #nim
19:37:12StrikecarlCan someone help me using RegQueryValueExA
19:37:34renesacit is interesting that swift gives << higher precedence than *, while rust gives it lower precedence
19:38:18renesacoh, D also gives it lower precedence than + -
19:39:21renesacStrikecarl: it seems you are making this question for some days now
19:39:25renesacwhat is that?
19:39:38StrikecarlYea, yesterday i was wondering how you could echo out an REG_SZ
19:39:46StrikecarlToday i found the RegQueryValueExA
19:40:08renesacand I have no idea what you are talking about, sorry
19:40:09StrikecarlNeed to feed it with info tho, i dont know what half of it is: key: HKEY, lpValueName: LPCSTR, lpReserved: LPDWORD, lpType: LPDWORD, lpData: LPBYTE, lpcbData: LPDWORD): LONG
19:40:16StrikecarlYou don't use windows i guess.
19:40:29renesacoh, windows registry
19:40:29BlaXpiriti'm annoyed by this.
19:40:45renesacwell, I don't know
19:40:58StrikecarlAll good renesac.
19:41:06StrikecarlI dont know anyone atm using windows with NIM <.<
19:41:16renesacvarriount?
19:41:19flaviuStrikecarl: Gotta think in hungarian notation :P
19:41:35StrikecarlWhat flaviu ?
19:42:25flaviuDon't mind me, I'm just making fun of the hungarian notation the windows api loves so much.
19:42:37*yalla12 quit (Quit: Leaving)
19:43:00dom96Strikecarl: I'm using Nim on Windows.
19:43:12flaviuhttps://msdn.microsoft.com/en-us/library/windows/desktop/ms724911%28v=vs.85%29.aspx might be useful
19:43:17Strikecarldom96, do you have any experience using the registry with NIM?
19:43:27dom96Nope, sorry.
19:43:41dom96If you follow the docs flaviu posted you should be able to get something working.
19:43:43Strikecarlflaviu, its the same data i need it to spoonfeed, lemme read it.
19:44:12Strikecarlwait
19:44:16StrikecarlReqQueryValueEx
19:44:25AraqStrikecarl: it's not hard but tedious. registry.nim would make a good Nimble package
19:44:39StrikecarlI first have to find the right one,
19:44:47Strikecarlas the one i am looking at doesnt seem to do the job.
19:45:27Strikecarlnvm it is
19:45:29dom96Strikecarl: Try looking for examples in C/C++, converting them to Nim shouldn't be too difficult.
19:45:52Strikecarldom96, it's the same proc name, which is why i think i can use it.
19:46:09StrikecarlReqQueryValueEx in C++.
19:46:25StrikecarlWait, nvm i am retarded.
19:50:35*endragor quit (Remote host closed the connection)
19:50:38EXetoCflaviu: yeah the wrong kind of hungarian
19:59:37Strikecarlmeh
19:59:41Strikecarli give up for today
19:59:42*Strikecarl quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
20:19:41*ChrisMAN quit (Remote host closed the connection)
20:27:18*ChrisMAN joined #nim
20:28:40*lyro joined #nim
20:33:13*lyro quit (Client Quit)
20:33:18*pipeep quit (Ping timeout: 245 seconds)
20:37:13*lyro joined #nim
20:40:49*pipeep joined #nim
20:41:26*Ven joined #nim
20:43:39*5EXAAXYM0 quit (Quit: This computer has gone to sleep)
21:17:41*pafmaf joined #nim
21:26:10*wink-s joined #nim
21:45:26*lyro quit (Ping timeout: 252 seconds)
21:53:15*a5i quit (Quit: Connection closed for inactivity)
22:01:10*Jehan_ quit (Quit: Leaving)
22:03:38*Kingsquee joined #nim
22:05:28renesacoh, I discovered a trick in github
22:05:53renesacappending ?w=0 makes nim commit diff pages readable again
22:06:04renesacignores changes in whitespace
22:07:03renesachttps://github.com/ReneSac/Nim/commit/e41a3e966151cf7c399c747af120cae3482bb793?w=0
22:07:13*gsingh93 quit (Ping timeout: 250 seconds)
22:07:16renesacthis is another application for it
22:08:09renesacI wonder if I can make that default
22:08:31*Senketsu_ joined #nim
22:08:44*pregressive quit (Read error: Connection reset by peer)
22:08:49flaviurenesac: Probably not, but you can write a userscript to do it, I think.
22:08:51*Senketsu quit (Read error: Connection reset by peer)
22:09:03*mwbrown quit (Ping timeout: 264 seconds)
22:09:09*pregressive joined #nim
22:09:23*nulpunkt quit (Read error: Connection reset by peer)
22:10:27*Jehan_ joined #nim
22:11:03*BlaXpirit quit (Quit: Quit Konversation)
22:11:07*reactormonk quit (Ping timeout: 250 seconds)
22:12:21*reactormonk joined #nim
22:18:15dom96I always thought it was ?w=1
22:20:14*gokr quit (Quit: Leaving.)
22:20:15*nulpunkt joined #nim
22:21:59*pregressive quit ()
22:22:52flaviuw=18029483029 also works. Coincidence? I think not! ;)
22:23:53gmpreussner|workhaha
22:25:24*Matthias247 quit (Read error: Connection reset by peer)
22:29:29*Trustable quit (Remote host closed the connection)
22:29:34*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:31:44*nulpunkt quit (Ping timeout: 250 seconds)
22:36:57*flaviu quit (Remote host closed the connection)
22:39:10*flaviu joined #nim
22:40:36*nulpunkt joined #nim
22:47:56*vendethiel quit (Ping timeout: 240 seconds)
23:04:33*ChrisMAN quit (Ping timeout: 245 seconds)
23:07:57*jefus__ joined #nim
23:09:18*jefus__ is now known as jefus
23:09:47*pafmaf quit (Quit: This computer has gone to sleep)
23:09:57*Jehan_ quit (Quit: Leaving)
23:11:36*jefus_ quit (Ping timeout: 252 seconds)
23:12:59*saml_ joined #nim
23:19:08*BitPuffin joined #nim
23:24:37*user7181 quit (Quit: leaving)