<< 25-01-2015 >>

00:01:18reactormonkdef-, I don't know
00:12:22*Sphax_ quit (Quit: CYA!!)
00:12:33reactormonkAraq, I currently have the problem that I don't really know how to test the split so I can assure it still works the same afterwards. Is it enough to test the docstring stuff? Or can I ask the tester to give me a diff.
00:17:12*Demon_Fox joined #nim
00:20:22*Trustable quit (Quit: Leaving)
00:20:56Araqthere are tests in strutils itself and perhaps some in tests/stdlib
00:21:23Araqbut the docstring should be its spec
00:35:13*Matthias247 joined #nim
00:35:35*Ionian_ joined #nim
00:35:49Ionian_Hello!
00:39:06Ionian_anyone on?
00:42:09Ionian_NimBot
00:45:11*ctran quit (Quit: ctran)
00:46:06*FusionGaming quit (Read error: Connection reset by peer)
00:46:32*FusionGaming joined #nim
00:48:47*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
00:50:18*Mat4 left #nim (#nim)
01:03:22*keyle joined #nim
01:04:13keylemorning
01:09:59*davidhq joined #nim
01:16:26*JinShil joined #nim
01:20:18*Matthias247 quit (Read error: Connection reset by peer)
01:32:31ekarlsois there a way I can expand somehting to a varargs or so ?
01:32:45ekarlsolike in python u do myFucc(*lst )
01:32:53ekarlsosimilar in nim ?
01:35:02ekarlsosimilar in nim ?
01:35:07ekarlsomeh, wrong arrow up
01:35:16daniel_cpekariso: http://nim-lang.org/tut1.html#varargs
01:36:13daniel_cperr *ekarlso ^
01:38:49Ionian_Im choosing between Rust vs Nim
01:38:53Ionian_to learn
01:38:55Ionian_any help?
01:45:50reactormonkIonian_, welcome to IRC, you haven't asked your question yet.
01:46:13reactormonkIonian_, and naturally, you should choose nim.
01:46:32Ionian_I knew you were gonna say that
01:46:40Ionian_but after i come back, ill explain
01:48:23reactormonkAraq, none in strutils itself. Will add the doc examples. One split example in tstrutils.
01:50:09Ionian_Ok, Why Nim?
01:50:33Ionian_Rust post 1.0 will have Compile time Execution
01:50:47bjzIonian_: yeah
01:51:04Ionian_Rust post 1.0 will also have improved LLVM Ir format and optimizations
01:51:07reactormonkIonian_, nim has that for a few years.
01:51:14Ionian_Yes I know
01:51:16reactormonkIonian_, nim runs on the metal with C.
01:51:30bjzIonian_: nim is better at compile time metaprogramming
01:51:40Ionian_As of now yes
01:51:48bjzIonian_: it just depends on what you value most
01:52:28Ionian_the improved LLVM IR output of Rust will result in speed as fast as idiomatic C code, and even faster than C with some other compiler tweaks
01:52:29bjzIonian_: yes, but as a heavy Rust user, I think nim's ergonomics for metaprogramming will always be nicer
01:52:35keyleI read samples of code in Rust, and in Nim. From there on, the choice was damn easy.
01:52:48bjzIonian_: better IR will mean faster build times
01:53:04Ionian_Can also result in faster programs in the end
01:53:10Ionian_not just from the IR
01:53:36bjzIonian_: agreed - we can output better invariants than C can, because we know more about the semantics of the program
01:53:37*reem quit (Remote host closed the connection)
01:53:47bjzIonian_: which give llvm more room to move
01:54:08bjz*gives
01:54:41reactormonkIonian_, not sure about rust, but you can actually do sampling with valgrind and linux perf on nim code
01:55:11reactormonkit won't give you the source code, but you can go by the function names farely relyably
01:56:26*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
01:56:34bjzreactormonk: you are outputting good debug symbols
01:56:34bjz?
01:57:04reactormonkbjz, yup
01:57:13bjzyeah, that is good
01:57:15reactormonkwell, kinda
01:57:16reactormonknim -d:release --passC:-pg --passL:-pg c strutilstest.nim
01:57:29bjzsame with Rust - makes debuggin much nicer
01:57:46reactormonkIonian_, if you want speed, -d:release - gives 5x-10x speed boost but no more stack traces.
01:57:52bjzshame all the tools are built with C or C++ in mind
01:58:50Ionian_reactormonk: On the valgrind and linux perf, Rust cam
01:58:52*davidhq joined #nim
01:58:52Ionian_can*
01:58:53reactormonkyou could {.push extern.} if you really want to (IIRC that's the syntax)
01:59:05reactormonkso all the function names in that file don't get mangled
01:59:20reactormonknaturally, if you have any collissions, you're screwed
01:59:27reactormonkIonian_, ok
01:59:42bjzreactormonk: collisions?
01:59:57reactormonkbjz, yup
02:00:02*keyle gets the measuring tape and unzip compiler pants
02:00:12reactormonkas in your function names are called something that's already used
02:00:12keylethis is non sense
02:00:20Ionian_reactormonk: Also I know Nim is fast, given C is its target, but rust gives you all of that and _performance_
02:00:43Ionian_disclaimer, I may seem biased, as I enter the Rust IRC first
02:00:47Ionian_Im trying to compare
02:01:05keyleexpressiveness and developer productivity beats the few milliseconds you're trying to shave 15 folds.
02:01:31reactormonkIonian_, performance? https://arthurtw.github.io/2015/01/12/quick-comparison-nim-vs-rust.html#execution-time-comparison
02:01:45keyleif not, write the speed critical stuff in C, and the domain logic in python or groovy or whateverelse.
02:01:47Ionian_I brought that up as well over there
02:01:59Ionian_Check the updates
02:02:07reactormonkah right, stringops.
02:02:39Ionian_plus Rust was also running with bound checks, while Nim was running with release mode
02:02:47Ionian_It is however self-evident
02:02:55Ionian_Nim is much prettier then Rust
02:03:44reactormonkthat's your choice. But I stay far away from any language that uses ;
02:05:35Ionian_I dont really mind it
02:05:44Ionian_its become a habit from the firs tlanguage I was taught
02:05:47Ionian_JavaScript
02:06:10EXetoCkeyle: I'll happily write high level code in nim ;)
02:06:30*Boscop_ joined #nim
02:06:38keylechoosing nim for the lack of ; is comical
02:06:41Ionian_Nim's syntax reminds me of Ruby
02:07:27EXetoCkeyle: it's silly. I don't exactly agree with "syntax matters not" though
02:08:09keyleat the end of the day, it's also a personal choice
02:08:18keylewrite a medium size program in both languages, rust and nim
02:08:23keylethen you will know what you want to use
02:08:27*Threewood3W joined #nim
02:08:48keyleagressively picking on compiler details in the language's irc channel achieves very little to your personal choice
02:09:04keyle"I chose to write my programs in XYZ because the irc channel convinced me"
02:09:29bjzkeyle: +1
02:09:33*def-- joined #nim
02:09:47keylebut one thing to consider is that Rust has Mozilla.
02:09:54keyleGo has Google
02:10:06keyleJulia has a large science community
02:10:12*no_name_ joined #nim
02:10:22*buMPnet_ joined #nim
02:10:36bjzNim has a super committed fellow behind it!
02:10:41keyleNim feels like that little rebel language, but at the same time, has no agenda beyond itself
02:10:54keyle(which is good)
02:11:09Ionian_Im asking people form each side of this question
02:11:12Ionian_from*
02:11:13*onionhammer1 joined #nim
02:11:17*Araq_ joined #nim
02:11:30Ionian_Then, gathering it up to acheive my personal choice
02:11:49Ionian_Im not letting a minor ';' choose between 2 languages
02:12:09Ionian_before Rust vs Nim, I was either choosing D, Go, Rust, or Nim
02:12:28keylewhat made you drop Go ?
02:12:50*darkf joined #nim
02:12:55Ionian_Just didnt like it personally
02:13:53Ionian_I like Rust's syntax personally
02:14:12Ionian_except the word 'Let'
02:14:19bjzIonian_: have you encounters the pyramids of doom?
02:14:36Ionian_Dunno whta that is
02:14:43keyleIonian_, can you overwrite rust to have your own keyword instead of Let ;>
02:15:06bjzIonian_: the crazy nesting of match expressions :)
02:15:15Ionian_keyle, explain?
02:15:44Ionian_bjz, I encountered that the first time I tried rust, seemed prety straight forwad to me :S
02:15:47bjzIonian_: just saying - Rust's syntax is not the nicest always.
02:15:59Ionian_Im sure thats true
02:16:01keylewell in nim you can easily overwrite the keywords
02:16:12Ionian_hmm
02:16:19*onionhammer quit (*.net *.split)
02:16:19*Araq quit (*.net *.split)
02:16:20*threewood quit (*.net *.split)
02:16:20*ARCADIVS quit (*.net *.split)
02:16:20*sillesta quit (*.net *.split)
02:16:20*Boscop__ quit (*.net *.split)
02:16:20*VinceAddons quit (*.net *.split)
02:16:20*buMPnet quit (*.net *.split)
02:16:20*def- quit (*.net *.split)
02:16:20*betawaffle quit (*.net *.split)
02:16:21*eigenlicht quit (*.net *.split)
02:16:21*no_name quit (*.net *.split)
02:16:21*def-- is now known as def-
02:16:24keyleso if you didn't like `type` you could use another word
02:16:25bjzIonian_: each match expression gives two levels of indentation - that's 8 spaces
02:16:33Ionian_Ima have to ask Rusteceans, however Im sure U cant, but idk, worth a shot
02:16:45*VinceAddons joined #nim
02:16:46bjzIonian_: you can't in Rust
02:16:58reactormonkkeyle, you'd rather not.
02:16:59bjzIonian_: for better or for worse
02:17:00*no_name_ is now known as no_name
02:17:03*Ionian_ left #nim (#nim)
02:17:09keylebut Ionian_ don't let the word let put you off a complete language
02:17:20*betawaffle joined #nim
02:17:24keyleit's also about the standard lib, the wrappers, the community
02:17:39keyleok he's gone
02:18:18*Ionian_ joined #nim
02:18:27Ionian_ bjz, I dont exactly mind it
02:18:52*eigenlicht joined #nim
02:18:54*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
02:19:23*fowlmouth joined #nim
02:25:40*davidhq joined #nim
02:27:36*ARCADIVS joined #nim
02:27:46*ARCADIVS quit (Max SendQ exceeded)
02:28:35*visi0n joined #nim
02:28:38*gmpreussner__ quit (Ping timeout: 244 seconds)
02:29:01*ARCADIVS joined #nim
02:29:37*Demon_Fox quit (Quit: Leaving)
02:35:10*fowl quit (Ping timeout: 244 seconds)
02:35:12*VinceAddons quit (*.net *.split)
02:35:12*JinShil quit (*.net *.split)
02:35:12*trevorriles quit (*.net *.split)
02:37:55*atticusalien joined #nim
02:38:55*JinShil joined #nim
02:40:47*valberg_ joined #nim
02:41:04*skyfex_ joined #nim
02:41:34*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
02:42:21*VinceAddons joined #nim
02:42:24*Ionian__ joined #nim
02:42:32*gmpreussner__ joined #nim
02:42:43*jez0990_ joined #nim
02:44:54*dv-_ joined #nim
02:45:15*vegai_ joined #nim
02:45:49*gunn_ joined #nim
02:45:57*Triplefox_ joined #nim
02:46:37Ionian__is there inline asm in nim?
02:46:44EXetoCyes
02:49:27*Ionian_ quit (*.net *.split)
02:49:27*gunn quit (*.net *.split)
02:49:28*gokr quit (*.net *.split)
02:49:28*lyro quit (*.net *.split)
02:49:28*TylerE quit (*.net *.split)
02:49:28*skyfex quit (*.net *.split)
02:49:29*reactormonk quit (*.net *.split)
02:49:29*Triplefox quit (*.net *.split)
02:49:30*valberg quit (*.net *.split)
02:49:30*vegai quit (*.net *.split)
02:49:30*jez0990 quit (*.net *.split)
02:49:31*dv- quit (*.net *.split)
02:49:43*Ionian__ is now known as Ionian_
02:51:33*atticusalien left #nim (#nim)
02:52:15*ARCADIVS quit (Quit: ARCADIVS)
02:55:48*TylerE joined #nim
02:56:06*reactormonk joined #nim
02:57:50*lyro joined #nim
03:09:15Ionian_Does nim have bounded polymorphism
03:10:23*CARAM__ quit (Ping timeout: 245 seconds)
03:11:22*endou______ quit (Read error: Connection reset by peer)
03:11:38*keyle quit (Quit: <Morbo> Chitchat achieved!)
03:12:19*VinceAddons quit (Read error: Connection reset by peer)
03:15:12*CARAM__ joined #nim
03:16:21*endou______ joined #nim
03:20:55*gmpreussner__ quit (Ping timeout: 244 seconds)
03:21:07*gmpreussner__ joined #nim
03:23:31*davidhq joined #nim
03:26:22*davidhq quit (Client Quit)
03:34:54*johnsoft quit (Ping timeout: 272 seconds)
03:36:33*Boscop__ joined #nim
03:40:25*nande_ joined #nim
03:41:39reactormonkIonian_, example
03:47:07*dtscoder joined #nim
03:52:04*Boscop_ quit (Ping timeout: 628 seconds)
03:52:04*Jesin quit (Ping timeout: 628 seconds)
03:52:04*nande quit (Ping timeout: 628 seconds)
03:52:05*dtscode quit (Read error: Connection reset by peer)
03:52:05*Jessin joined #nim
04:01:46*gunn joined #nim
04:01:53*gunn quit (Max SendQ exceeded)
04:02:30*gunn joined #nim
04:02:46*gunn_ quit (Ping timeout: 244 seconds)
04:05:19*Triplefox_ is now known as Triplefox
04:09:08*dtscoder is now known as dtscode
04:14:17*EXetoC quit (Ping timeout: 252 seconds)
04:16:29*dtscode is now known as notdts
04:18:06*notdts is now known as dtscode
04:20:39*chroem joined #nim
04:21:35chroemHow would one go about serving HTTPS content in Nim?
04:30:05dtscodecan someone eli5 how to use the pegs module to find each occurance of a word in a string and replace it with another word?
04:43:30onionhammer1chroem look at jester https://github.com/dom96/jester/
05:11:31gmpreussner__i've been using nim for a while now, and i'm starting to think that 2 spaces for indentation is not enough. 4 spaces is much easier to read
05:11:54gmpreussner__with 2 spaces, everything kinda melts together. of course, it is less wasteful, too
05:12:34*BitPuffin quit (Ping timeout: 264 seconds)
05:13:02gmpreussner__oh well, maybe my eyes are just tired :)
05:18:03gmpreussner__yeah, two spaces is not so bad. nevermind
05:20:59Ionian_reactormonk: T: Trait
05:21:40TriplefoxI tested four spaces on some code I had...didn't really change it for me
05:22:22Triplefoxwith four i tend to get irritated at how code gets cramped when using an 80-col limit
05:23:31Triplefox(I write wide code when I'm allowed to)
05:32:00chroemonionhammer1: From what I can tell, Jester doesn't seem to support it yet.
05:39:35*gunn quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
05:40:23gmpreussner__Triplefox: yeah, i agree. it eats up too much space. 2 is fine. i'm just tired :)
05:41:21*gmpreussner__ is now known as gmpreussner
05:49:19*dv-_ is now known as dv-
06:07:55*johnsoft joined #nim
06:18:33dtscodeis httpclient async?
06:19:01dtscodeoh never mind
06:22:55*rkj-b joined #nim
06:28:46dtscodeAraq_, just an fyi, http://nim-lang.org/system.html#declared the example uses defined instead of declared
06:52:59*brson joined #nim
06:53:57gmpreussnercan someone tell me whether this is supposed to work? https://gist.github.com/gmpreussner/34b6bf829f8a2e46b2bb
06:54:19*brson quit (Client Quit)
06:54:33*brson joined #nim
07:02:46dtscodeis check like assert?
07:03:24dtscodei dont think that should compile, since the tuples type would have to be known at compile time
07:05:17*cb_ joined #nim
07:07:03*chroem quit (Quit: Page closed)
07:07:27gmpreussnerdtscode: yeah, check is in unittest
07:07:33gmpreussnersimilar to assert()
07:07:46dtscodefigured. was too lazy to look it up
07:08:08gmpreussnerdtscode: so the error is legit?
07:08:21dtscodeyeah. do you write c++ code?
07:08:22gmpreussneri expected T to be known at compile time
07:08:36dtscodeits not guaranteed to be known though
07:09:11gmpreussneri see... maybe i don't fully understand tuples then
07:09:32gmpreussnerunder what circumstances would T not be known?
07:10:02dtscodecreating a variable at runtime
07:10:14dtscodeof course, im just guessing here. im by no means a nim expert
07:11:10gmpreussnerdtscode: i don't see how that would be any different for the first version then
07:11:22gmpreussnerif the type wasn't known, then that shouldn't compile either, should it?
07:12:08dtscodearent tuples created at run time though?
07:12:33gmpreussnerdtscode: i don't think i know what you mean by that :)
07:13:16dtscodesorry :/ too tired to explain
07:13:41gmpreussnerhehe... yeah, and i'm probably too tired to comprehend it anyway
07:13:44gmpreussner2 a.m. here
07:15:08dtscode11, but im very behind on my sleep :D. it might also be worth while to post on the forums or to create an issue, because the compiler developers will be able to give you a much better answer than my shitty response
07:15:10dtscodes
07:15:59gmpreussneryeah
07:16:24gmpreussneri'll keep the gist for now. let's see what Araq says tomorrow. if it's a bug, i'll file an issue.
07:17:12dtscodeit could very well be a bug, but my c++ roots are screaming no duck typing
07:17:19*JinShil quit (Quit: Konversation terminated!)
07:27:20gmpreussnerdtscode: well, it's not really duck typing. variable b is clearly of type 'tuple(float, float)', so it should match Bar[float]. it may be that Foo is simply an alias for 'tuple(float, float)', which is why it works. and there may not be any code trying to resolve Bar[T] from 'tuple[T, T]'. this may be a bug or feature; i don't know. we'll let the compiler gods decide.
07:29:51dtscodesaying something is clearly of type foo without actually specifiying its foo is exactly what duck typing is
07:31:55gmpreussneryou mean Bar... yes, maybe
07:32:10gmpreussneri gotta go to sleep now. have a good night :)
07:32:25*cb_ quit (Quit: Page closed)
07:32:34*gmpreussner is now known as gmpreussner|zzZz
07:33:02dtscodenight
08:02:03*barosl quit (Ping timeout: 245 seconds)
08:06:28*Outlander joined #nim
08:09:13*d3m1gd joined #nim
08:25:49*vegai_ is now known as vegai
08:26:05*barosl joined #nim
08:27:22*Outlander quit (Ping timeout: 245 seconds)
08:27:23*nande_ quit (Read error: Connection reset by peer)
08:45:35*rkj-b quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0/20150108202552])
08:45:54*gmpreussner|zzZz quit (Ping timeout: 244 seconds)
08:48:08*VinceAddons joined #nim
08:51:46*Ionian_ quit (Quit: Connection closed for inactivity)
08:54:07*gmpreussner|zzZz joined #nim
09:04:02*reem joined #nim
09:06:59*reem quit (Remote host closed the connection)
09:07:40*reem joined #nim
09:09:42*reem quit (Remote host closed the connection)
09:10:10*reem joined #nim
09:15:55*reem quit (Ping timeout: 256 seconds)
09:21:33*gmpreussner|zzZz quit (Ping timeout: 244 seconds)
09:21:34*gmpreussner joined #nim
09:23:26*vendethiel quit (Ping timeout: 246 seconds)
09:23:38*xeizlif joined #nim
09:24:52*vendethiel joined #nim
09:26:35xeizlifHey folks. I'm trying to use nim-sdl2's RendererPtr's copy method, but it takes two [ptr Rect] but I can't seem to get a pointer out.
09:26:38xeizlifUsing renderer.copy(bg_texture, ptr Rect, ptr Rect)
09:26:50xeizlifgives error| type mismatch: got (RendererPtr, TexturePtr, typedesc[ptr Rect], typedesc[ptr Rect])
09:27:37xeizlifI'm... not really sure what the compiler's trying to tell me.
09:27:43xeizlifLibrary's funciton signature is: proc copy*(renderer: RendererPtr; texture: TexturePtr; srcrect, dstrect: ptr Rect): SDL_Return
09:29:54xeizlif...nevermind.
09:30:28xeizlifchanged it to srcrect and dstrect instead of "ptr Rect" twice ;)
09:31:25xeizlifBut now I get "error| type mismatch: got (RendererPtr, TexturePtr, typedesc[ptr Error Type], typedesc[ptr Error Type])", and two "error| type expected" ... how can I supply more type information?
09:36:40xeizlifThe keyword I'm supposed to be using is "addr". Fixed.
09:37:35*Matthias247 joined #nim
09:46:15*vendethiel quit (Ping timeout: 264 seconds)
09:50:55*gokr joined #nim
09:51:24*JinShil joined #nim
09:55:25*BlaXpirit joined #nim
10:03:24*barosl quit (Ping timeout: 244 seconds)
10:03:45*barosl joined #nim
10:09:04*vendethiel joined #nim
10:11:09*bjz_ joined #nim
10:11:28*bjz quit (Read error: Connection reset by peer)
10:12:53*SplinterOfChaos quit (Ping timeout: 252 seconds)
10:20:59*EXetoC joined #nim
10:23:09*barosl_ joined #nim
10:23:21*barosl quit (Ping timeout: 256 seconds)
10:26:35*valberg_ is now known as valberg
10:26:39*valberg quit (Changing host)
10:26:39*valberg joined #nim
10:59:53ekarlsohow can you do something like optional args in nim ?
11:02:42xeizlifproc test(x: int = 4) = ...
11:03:09xeizlifbasically you just assign to the argument as if it were a local variable, and if you don't specify it then it gets filled in
11:03:16Triplefox.eval proc fn(a, b=2)=return a+b; echo(fn(1))
11:03:41xeizlifAlso works without specifying the type, as Triplefox demonstrated
11:03:54Triplefoxwell i expect the bot to be there .-.
11:14:26ekarlsoah, so you need to specify a default -,,-
11:15:37xeizlifWell, otherwise you'd have an undefined variable and I'm not sure how you'd handle that otherwise...
11:15:45EXetoCoverloading?
11:17:10*keyle joined #nim
11:17:11Triplefoxoverloading can usually do what you want to do with an optional arg
11:17:30Triplefoxalthough i'm still getting used to the idea of having 10 implementations of "copy"
11:18:17EXetoCI've tried to rely on only a single proc that is generic, but it's a little ugly atm
11:22:11ekarlsohttps://bpaste.net/show/b44194c06a57 < better way to write that ? :p
11:25:42Triplefoxit seems like that would make an inefficient query that searches for -1 a lot
11:26:07ekarlsoTriplefox: just unsure of how to make a "query" constructor else in nim :&
11:27:09wtwis there a reason I cannot 'echo' an int and a string like "echo $int & "string" "?
11:27:21wtwit works when doing "echo "" &int & "string" "
11:27:28wtwarg
11:27:38Triplefoxyou could define each argument as an object i guess, if you need a generic query constructor
11:27:38wtw"echo "" &$int & "string" "
11:27:54EXetoCmight be a case of operator precedence. try adding parentheses
11:28:51EXetoCit will change at some point I think. it's a common mistake
11:29:15wtwok
11:29:33EXetoCekarlso: what packages will have an id of -1?
11:29:48wtwit's somewhat counter-intuitive if something works in the middle of an expression but not in the beginning
11:29:52ekarlsoEXetoC: it was more like add a if pkgId != -1 then filter on id
11:30:07ekarlsobut tbh I think i'll make a small "Filter" object and use that instead
11:32:46EXetoCconsider overloading too (procs with the same name but different parameters)
11:34:44EXetoCso as to minimize redundancy
11:37:27EXetoCit's just a suggestion. it might make more sense to introduce some type
11:48:03EXetoCwtw: that statement is too general, but in this case it is. it's the equivalent of this: "echo($, 1)". the same principle applies for "x + y * z" which is the same as "x + (y * z)"
11:50:40wtwah, unified calling syntax goes wrong here without parentheses?
11:51:06*Trustable joined #nim
11:52:24BlaXpiritno, no, EXetoC
11:52:34BlaXpiritecho $ 1
11:53:11BlaXpiritwtw, it's sees that as a binary operator
11:53:58EXetoCthat's true
11:54:23EXetoCwtw: yes, this alternative call syntax is the culprit
11:55:04EXetoCgotta use dumpTree more often
12:14:24*heinrich5991 joined #nim
12:31:25*darkf_ joined #nim
12:33:12*gunn joined #nim
12:33:43*darkf quit (Ping timeout: 245 seconds)
12:37:17*sillesta joined #nim
12:49:53gokrhey
12:51:20sillestahi
12:52:16*BlaXpirit quit (Read error: Connection reset by peer)
13:25:12keylehi
13:25:54*Outlander joined #nim
13:27:49*BitPuffin joined #nim
13:29:52*Boscop__ quit (Ping timeout: 240 seconds)
13:35:23EXetoCwtw: there's no need for either $ or & when using echo though
13:35:40EXetoCbecause of the proc signature
13:36:52xeizlifWhat the. Apparently consts will adapt their type to their usage, not their assignment
13:37:13xeizlifi.e.:
13:37:37xeizlifconst x = 32; var y = 1.0'f32 + x
13:37:46xeizlifx is now a float32
13:38:13xeizlifthis is strange considering that the string literal "32" used in place of x will not do that
13:38:24def-xeizlif: yes, 32 will do that too
13:38:36def-xeizlif: but with let instead of const it's an int
13:39:34xeizlifhmmm, odd, before when I had literal ints mixed with floats the compiler complained about expecting a float but getting an int ... perhaps there was a difference I overlooked
13:39:52xeizlifThanks for telling me that, const's behaviour makes more sense now
13:40:07xeizlifI decided to give my consts types from now on
13:40:50EXetoChuh
13:41:46def-Interesting, consts are just symbols bound to a value. So a const number can be used as int and float at the same time
13:43:17xeizlifThe problem I was having is that my presumably integer consts were causing for-loop ranges to be promoted to floats...
13:43:19EXetoCit's a case of implicit conversion
13:43:59xeizlifwhich was driving me crazy because I couldn't work out why that was happening. Turned out I'd used the const elsewhere in the function as a float and so it treated it like a float throughout the whole function
13:44:31xeizlifwrapping everything in my const block in int() fixed that. I probably should use :int syntax tho
13:44:39EXetoC'x' will remain an int of value 2 no matter what
13:45:21EXetoCyou could, but it's obvious what the type is in the case of the constant at least
13:45:49xeizlifunfortunately if I do not do this, I have to explicitly cast to int everywhere I want it to be an int.
13:46:06EXetoCyou can type 'x.type' and look at the error message to see what the type is
13:46:30xeizlifI fixed the code and so for me it's no longer a problem but I can try to show you what I mean if you'd like
13:46:57def-EXetoC: import typetraits; echo x.type.name
13:47:38EXetoCdef-: I know but I can't be bothered for simple cases
13:49:19EXetoCand it is convenient for plugins that show the error message after a save
13:51:01EXetoCxeizlif: I'm just saying that you're wrong about the semantics of constants
13:51:28*Boscop joined #nim
13:51:28*Boscop quit (Changing host)
13:51:28*Boscop joined #nim
13:51:39EXetoCyou mean when doing float + int? then yes. floatVar.int works too, but you can decide what looks best
13:54:09EXetoCx.int being syntactic sugar for int(x). "var y = 1.0'f32 + x" expands to this: "var y = 1.0'f32 + x.float32"
13:58:06*keyle quit (Quit: <Morbo> Chitchat achieved!)
13:58:24EXetoCsomeone made a complaint about this implicit behavior on the forum recently. I disagree though. first of all, you can do "x: int" if needed; and second, it's only applied iff it's certain that no bits will be lost (such as when doing "int16(int32var)")
14:00:33*Outlander quit (Ping timeout: 244 seconds)
14:05:51xeizlif...my actual problem was `/` having a float result. Big mistake.
14:06:34xeizlifI'm very glad that people definitely know the language in this channel or I'd have caused a lot of trouble :S
14:06:56xeizliffrom now on if I notice something weird I'll write an extremely constrained test for it.
14:07:10EXetoCok. do you know about `div`?
14:08:32xeizlifI do now. It's an integer typed division
14:11:05xeizlifI should change my floating-point `mod`s to `fmod`, even though `mod` has a valid floating point overload
14:11:22*rational joined #nim
14:12:05xeizlifAlthough fmod is implemented differently to mod(float, float)
14:31:51ekarlsois there any sql compiler in nim ?
14:32:50*brson quit (Quit: leaving)
14:37:33xeizlifhttp://nim-lang.org/parsesql.html there's a parser
14:38:06xeizlifhttp://nim-lang.org/lib.html is a good list to check if you haven't seen it already
14:40:17xeizlifhttps://cdn.mediacru.sh/X/XsuIgXk1NQiI.png :D. My crappy platformer's map drawing code partially works. (I generated a random mapfile, this is intended behaviour)
14:49:12*JinShil quit (Quit: Konversation terminated!)
14:55:58def-xeizlif: nice
14:56:47xeizlifty ^_^
14:59:17def-xeizlif: sdl2 instead of csfml?
15:00:33xeizlifYeah. I've got a fondness for sdl (sdl2 > sdl, but I've used sdl a lot in the past), and I'm basically writing this game because I was bored.
15:06:00def-what's your opinion on sfml?
15:07:39xeizlifI don't have a lot of experience with it, but using it with C++ was nicer and of course faster than SDL1's archaic API and software blitting on X11
15:08:09def-there's a really nice binding for nim for it, by blaxpirit
15:08:13xeizlifIt's a nice library, but if I'm just going to hack something up, sdl2 will do just fine
15:08:21xeizlifoh, I'll check that out
15:08:47xeizlifTo be quite honest, as soon as I saw nim-sdl2 I just started using it. The only other graphics binding I knew existed was nim-opengl
15:08:48def-with example games and everything: https://github.com/blaxpirit/nim-csfml
15:11:11xeizlifExcellent. I'll definitely consider that in future. That's very nice.
15:11:43xeizlifThanks very much for your help, everyone, it's 2AM so I better get to bed.
15:12:32def-good night
15:15:26*UberLambda joined #nim
15:21:42*Sphax joined #nim
15:35:13*Sphax quit (Quit: CYA!!)
15:38:18*darkf_ quit (Ping timeout: 245 seconds)
15:54:38*TylerE quit (Ping timeout: 272 seconds)
15:59:25*TylerE joined #nim
16:27:55*UberLambda quit (Quit: Leaving the Matrix)
16:29:01*Ionian_ joined #nim
16:29:28Ionian_reactormonk:
16:44:37*sdw joined #nim
16:53:13*johnsoft quit (Ping timeout: 256 seconds)
16:53:31*johnsoft joined #nim
17:05:59*sdw_ joined #nim
17:06:41*sdw quit (Disconnected by services)
17:06:45*sdw_ is now known as sdw
17:06:46*sdw quit (Changing host)
17:06:46*sdw joined #nim
17:09:14*Trustable1 joined #nim
17:11:15*matkuki joined #nim
17:15:09*EXetoC1 joined #nim
17:15:21wtwcan the importc pragma also import c macros? the manual only states "proc or variable from C"
17:15:25*matkuki is now known as 7F1ACIFBX
17:15:25*Trustable quit (Ping timeout: 240 seconds)
17:15:25*EXetoC quit (Ping timeout: 240 seconds)
17:15:46ekarlsois there "some" for rust ?
17:15:49ekarlsoehm, nim -,,-
17:16:08wtwyou mean a Maybe monad?
17:16:42ekarlsonot sure what it's called elsewhere ;)
17:16:53*7F1ACIFBX quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0/20150108202552])
17:17:48wtwso something like "Just a | Nothing" (in Haskell), i.e. the return value thing?
17:17:48*matkuki joined #nim
17:18:23ekarlsoi dont know haskell either..
17:19:30*endou______ quit (Ping timeout: 272 seconds)
17:19:34wtwif you're referring to this https://en.wikipedia.org/wiki/Option_type, then afaik not yet, but it could be easily implemented
17:20:54*CARAM__ quit (Ping timeout: 276 seconds)
17:23:06*matkuki quit (Ping timeout: 240 seconds)
17:25:54*endou______ joined #nim
17:26:00*UberLambda joined #nim
17:28:55EXetoC1ekarlso: https://github.com/fowlmouth/nimlibs/blob/master/fowltek/maybe_t.nim ?
17:29:15*EXetoC1 is now known as EXetoC
17:30:45*CARAM__ joined #nim
17:46:56*SplinterOfChaos joined #nim
17:54:21*Jessin quit (Quit: Leaving)
17:54:35ekarlsoEXetoC: a
17:54:37ekarlsoah
18:14:47wtwAraq_: I identified the FreeBSD parallel bug, quite silly... the fix is probably three lines or so, I'll create a PR tomorrow
18:19:10*Jesin joined #nim
18:23:59def-wtw: nice
18:24:08*matkuki joined #nim
18:37:34titaniumone^how do you use importc to import a variable from a header, instead of a function?
18:37:50matkukiWhen using the "fields" iterator, is there a way to make the loop variable readonly? Example: for field in MyTuple.fields():; field = 12 #error, cannot assign!
18:41:24def-titaniumone^: var foo {.importc: "foobar" .}: cint
18:42:16gmpreussnercan the assignment operator be overloaded yet?
18:42:22def-gmpreussner: nope
18:42:57titaniumone^def- oh that's easy. thanks
18:42:57gmpreussnerdef-: hmmk... so we're still stuck with constructor procs (newXYZ) and converters then?
18:44:10def-thnk so
18:44:12def-think*
18:44:25gmpreussneri have a generic proc that uses expressions of the form 0.T, 1.T etc. how would I add support for these in types that do are not compatible with ordinals and reals?
18:44:40gmpreussner-do
18:45:19def-gmpreussner: don't think i understand
18:46:22def-matkuki: you could implement your own immutable replacement iterator
18:46:25gmpreussnerT is a generic parameter for the type. the proc works on T. for example, within the proc i want to initialize local vars to a zero value, i.e. "let a = 0.T", where 0.T is the zero value for type T.
18:46:34EXetoCfoo.bar is bar(foo)
18:47:03matkukidef-: Will try it, thanks.
18:47:34gmpreussnerso i need something like "proc newFoo(x: SomeOrdinal)" then?
18:47:39EXetoCgmpreussner: it doesn't work? objects are implicitly zero'ed though
18:47:52gmpreussnerwell, i have values other than zero as well
18:48:05gmpreussnerunit values are common, i.e. 1.T
18:48:53EXetoCgmpreussner: so it doesn't work?
18:49:14gmpreussneri haven't tried it yet. newFoo() is what i need in this case, yes?
18:49:21EXetoCI can't remember if appropriate constraining helped in this regard (T:SomeInteger for example)
18:50:16gmpreussneri guess my question is: which proc performs the conversion for 1.T where T is Foo
18:50:30gmpreussneri.e. what if
18:50:37gmpreussnertype Foo = string
18:51:14gmpreussneror: type Foo = object ...
18:52:55*UberLambda quit (Quit: Leaving the Matrix)
18:53:22gmpreussneri'm not making any sense, am i? let me see...
18:53:54Ionian_Hi
18:53:58EXetoCgmpreussner: it's not a proc actually, but int(x) is very similar to "proc int(x: T): int". what is T anyway?
18:53:59Ionian_Does Nim have bounded polymorphism?
18:55:04gmpreussnerfor example: "var c = 1.T". i want this to work for all numeric types. let's say T is Complex, then 1.T should be converted to a tuple "(1.0, 0.0)"
18:55:51EXetoCinitFoo(x: SomeInteger)?
18:56:19gmpreussnerEXetoC: ah ok, so "initXYZ" is the proc that the compiler is looking for then?
18:56:37Ionian_:(
18:57:26EXetoCgmpreussner: no it doesn't. x.int does involve some magic
18:57:42gmpreussneraha
18:57:57gmpreussnerso i need to add equivalent magic to my own types then
18:58:16gmpreussneris that possible, and if yes, how?
18:58:26EXetoCgmpreussner: you can do "proc T..."
18:58:42EXetoCbut user-defined constructors are named initFoo/newFoo by convention
18:59:18EXetoCT(U) is supported for distinct types though
18:59:58EXetoCIonian_: not in the form of interface constraints, but it might be possible to enforce that in the body. I'll look into it
19:00:07gmpreussnerthat would include built-in numeric types, i suppose. so i could write T(1) instead of 1.T
19:00:45gmpreussneri guess ultimately i'm really looking for an assignment operator :/
19:01:26EXetoCbut "proc Foo" might be appropriate. conventions can be deviated from
19:01:49*UberLambda joined #nim
19:03:44EXetoCIonian_: "U is T". "when U is T: ..." for example
19:06:41Ionian_EXetoC: Like T: Trait
19:07:56*bpr joined #nim
19:08:01EXetoCIonian_: I was trying with a typeclass, and that didn't work. "traits" have been broken for some time. the author has been busy with other things for quite some time
19:08:45Ionian_I see
19:08:49EXetoCIonian_: http://nim-lang.org/manual.html#user-defined-type-classes
19:09:05EXetoCit seems like we will get that some time after 1.0
19:09:15Ionian_Again, just tryna compare
19:09:25sdwis there any work done in nim on modeling ranges from D?
19:10:10EXetoCsdw: I've been wanting to experiment with that, but I haven't bothered to try it without traits
19:10:54Ionian_been doing some trivial programs in Nim and Rust
19:12:02EXetoCsdw: and D-like arbitrary constraints cannot be applied to an actual interface, so that incurs some limitations
19:12:20EXetoCIonian_: great
19:14:55Ionian_as im going, the only thing I see Nim having over Rust is is syntax
19:15:08EXetoCI disagree
19:15:12Ionian_anyone want to shed light on some other features Nim has that Rust doesnt?
19:16:07sdwIt's strange the perspective that people have. I usually think "What is so great about Rust that I should invest the time?"
19:16:43Ionian_Whats bad about Rust?
19:17:03bprIonian_: Nim has overloading, Rust doesn't.
19:17:19Ionian_you mean function overloading?
19:17:27bprYes.
19:17:39Ionian_I find that confusing to be honest :S
19:17:45Ionian_coming from java
19:17:46sdwHow can Rust not have overloading?
19:18:29bprI like overloading. My biggest problem with OCaml was the lack of overloading.
19:18:41sdwThat seems synonymous with "Cannot do generic programming"
19:19:14EXetoCbut then again I haven't used Rust in a long time, but this was my transition: D -> Rust -> Nim, after discovering each language in that order
19:19:22EXetoCsdw: kind of, with traits
19:19:25*johnsoft quit (Ping timeout: 256 seconds)
19:19:25Ionian_Rust has generics
19:19:57Ionian_EXetoC, when was the last time you touched Rust?
19:20:22sdwIonian_: nevermind me, I don't actually know Rust. It may well be that they prefer another solution to similar problems
19:20:24*Jervac joined #nim
19:20:47*johnsoft joined #nim
19:20:52Ionian_Rust's Type system is pretty cool if u ask me
19:21:04Ionian_Then again im a noob deciding between Nim and Rust
19:21:21bprRust has generics, and when Nim finally has user defined type classes working properly, it will (I think) have bounded genericity.
19:21:23*cjbest joined #nim
19:21:25Ionian_thats why I only see Nim's pretty syntax as a big win
19:21:38Ionian_bpr, bounded polymorphism?
19:21:59Ionian_Rust is also implementing Compile-Time execution
19:22:03sdwhttp://nim-lang.org/manual.html#user-defined-type-classes
19:22:53Ionian_i c
19:23:02Ionian_so wut else does nim have
19:23:12bprYou'll be able to constrain the types of your generics. Terminology is confusing here because the two languages are using using different terminology. Score one against overloading ;-)
19:23:38Ionian_overloading I see is about personal preference
19:24:05bprNim has a GC, so the massive PITA of satisfying the borrow checker is not an issue.
19:24:05Ionian_maybe not, but im personally against overloading of functions
19:24:13Ionian_PITA?
19:24:23bprPain In The Ass
19:24:23sdwurbandictionary that one :P
19:24:30JervacI have a fix to the nim sdl2 library. How do I show nim-lang my fix?
19:24:30dom96Ionian_: Does Rust have coroutines?
19:24:35EXetoCthe metaprogramming capabilities of Nim is a big plus for me. it's a huge part of the language
19:24:43dom96Jervac: create a pull request
19:24:54Ionian_dom96: Idk,lemme ask
19:25:01bprBecause Nim has a GC, it can have full closures too, not just the downward funeral variety.
19:25:15dom96Ionian_: Does Rust have async await?
19:25:17bprfunarg not funeral. FU spell checker!
19:25:46Ionian_dom96: do you mean coroutines like goroutines?
19:26:26dom96Ionian_: no
19:26:40Ionian_explain a bit more then please
19:27:00dom96http://nim-lang.org/manual.html#first-class-iterators
19:27:46EXetoCdom96: I still would like to try my hands at an iterator interface implemented in userland. macros yay
19:28:38Jervacdom96: thanks, I think i did it correctly
19:29:39dom96Jervac: I don't think that will compile
19:30:03dom96Ionian_: Does Rust have exceptions?
19:30:06Jervacit tells me there's an invalid indentation too
19:30:13Jervacline 1381
19:30:14dom96Ionian_: Does Rust have an effect system?
19:30:21Ionian_dom
19:30:23Ionian_calm down
19:30:27Ionian_ur not letting me answer
19:30:33dom96Ionian_: I can go on and on :P
19:30:40dom96My point is: it's not just prettier syntax.
19:30:51Ionian_Ima answer your question
19:31:00Ionian_Rust does have iterators
19:31:12Ionian_by execptions, you mean error handling?
19:31:22dom96By exceptions I mean exceptions.
19:31:31dom96Error handling can be implemented in different ways.
19:31:44dom96Iterators or first-class iterators?
19:31:45Ionian_If Not found => thorw exeception error?
19:31:47dom96There is a different.
19:32:01dom96try: foobar() except: echo("Something bad happened")
19:32:25dom96*difference
19:32:48Ionian_Yes
19:32:51Ionian_Rust has that
19:33:03Ionian_With options
19:33:20Ionian_.unwrap().expect("Something bad happened");
19:33:27EXetoCdom96: not a good example is it? since nothing specific is caught
19:33:48sdwRust probably has a nicer error handling mechanism than nim atm
19:34:04dom96Ionian_: Will Rust give me a nice stack trace if I don't catch that?
19:34:11dom96sdw: That's debatable.
19:36:23Ionian_dom96: Rust has async
19:37:15dom96Does it have async *await*?
19:37:26Ionian_btw
19:37:36Ionian_whats the difference between first class iterators
19:37:39Ionian_and iterators
19:37:51Ionian_Oh and yeah, take a look at mio
19:38:46sdwdom96: yes, Rust claims to have nearly all of those
19:38:55sdwI'm unsure about the effect system part
19:39:46sdwdoes nim use the effect system for anything besides checked exceptions?
19:40:14Ionian_Yeah
19:40:15def-Ionian_: inline iterators get translated to loops: http://nim-lang.org/manual.html#iterators-and-the-for-statement
19:40:32Ionian_Im talking about first class
19:40:35Ionian_whats the sifference
19:40:39Ionian_I dont see any
19:40:44def-first class iterators are not inline iterators
19:41:07def-you can use them more flexibly
19:41:39dom96Ionian_: Perhaps you should try out both languages. That should give you a good idea of the different features each supports.
19:42:00Ionian_That would be diving straight into the very core of the languages
19:42:25dom96See? Rust doesn't have coroutines :P
19:42:36Ionian_Im talking about first class iterators and normal Rust iterators
19:42:45Ionian_which they call kickass iterators
19:43:22dom96Ionian_: It seems to me that you are already sold on Rust.
19:43:41Ionian_No actaully I just entered their IRC first
19:43:51Ionian_with no knowledge
19:44:02Ionian_then cam to Nim, hoping for some light
19:44:10*BlaXpirit joined #nim
19:44:25dom96Ionian_: A user in #rust admitted that mio is "very low-level"
19:44:50dom96So it doesn't sound like it's ready for action yet.
19:44:56Ionian_dom96, have you seen its repo on github?
19:44:57dom96Async await is pretty good for beginners.
19:44:58sdwIonian_: expect this no matter where you go. If I go to Rust and ask "Why is Rust better than nim" I'm likely to just get a different incoherent list of features :P
19:45:16EXetoCsdw: even in #java :-p
19:45:25Ionian_I basically sked
19:45:29Ionian_what does x have over y
19:45:42Ionian_and being on the irc chat on the same time
19:45:47Ionian_can make them more honest
19:46:13*gmpreussner_ joined #nim
19:46:15sdwIonian_: that's not a simple answer
19:46:32Ionian_Im surely not expecting one answer right away
19:46:43*gmpreussner quit (Ping timeout: 244 seconds)
19:46:52dom96see you later
19:47:16sdwGo through the language docs for each one and you'll get a good feel for the differences
19:47:30Ionian_differences in syntax
19:47:56sdwsure, certainly there's a large difference in syntax
19:48:41Ionian_Of course
19:48:56Ionian_Thats why I said Nim's syntax is a win for nim
19:49:06Ionian_in most aspects
19:49:43Ionian_Last night, I looked at what Rust has and will have
19:49:48Ionian_and what Nim has and will have
19:49:58Ionian_both looking quite the same
19:50:08Ionian_then I looked into speed
19:50:14Ionian_performance*
19:50:15*Demon_Fox joined #nim
19:53:13EXetoChttps://github.com/Araq/Nim/wiki/Roadmap
19:53:26cjbestwhat's the state of the union with nimble: is it a going concern? do people feel it's a critical piece of the ecosystem?
19:54:14cjbest / package management in general
19:54:17EXetoCcjbest: it's usable and it's being improved upon slowly but surely
19:56:09cjbestEXetoC: that's good to hear.
19:57:28*BitPuffin quit (Quit: See you on the dark side of the moon!)
19:57:49cjbestI recently stumbled on nim and am blown away by the language in general, but it feels like a great package manager/ecosystem is one of those practical things that makes things go
19:58:57bprIonian_: I like Rust quite a bit, and I'd be happy to use it if I were writing high performance servers. Lately my work is more oriented to data munging and analysis, and Nim is far (FAR) more pleasant to use for that task.
19:59:09*BitPuffin joined #nim
20:00:01bprPick the language for the set of tasks you'll likely be doing.
20:00:43EXetoCeasy exploratory programming is a great thing, and I haven't needed to care about strict memory safety yet. I welcome improvements that aren't too intrusive though
20:01:00EXetoC'lent' pointers qualify I think, but I'm not sure yet what that will imply
20:01:28EXetoCbut now I'm speculating and there's only so much you can convey here, so I'm done. happy coding
20:02:04Ionian_data munging?
20:02:40*TheJacob joined #nim
20:02:41*TheJacob left #nim (#nim)
20:02:44*TheJacob joined #nim
20:03:11TheJacobIs there anything I can say to convince a friend that despite having a gc nim is still as fast (or faster) than rust?
20:03:36vegaiis that even true?
20:03:45vegaiI mean... the "faster" bit
20:03:50TheJacobI don't know
20:04:05EXetoCTheJacob: tell him that languages like java are far from bleeding-edge
20:04:12vegaiabout as fast for most things, certainly
20:04:26TheJacob my friend is convinced that when it comes down to performance sensitive applications rust will beat nim handily
20:04:44TheJacobEXetoC: how did java come in to this?
20:04:48EXetoCand that research has improved the situation greatly for modern languages
20:05:19*fizzbooze joined #nim
20:05:25EXetoCTheJacob: many people believe that every GC is roughly as bad as the one for java
20:05:29sdwTheJacob: what application?
20:05:31TheJacobEXetoC: any links or article, or things to look up?
20:05:38*Varriount|Mobile joined #nim
20:05:49TheJacobsdw: he's saying anythign that is memory sensitive
20:05:52TheJacob*anything
20:05:55fizzboozewhat's the overhead of calling a C++ function from ffi?
20:05:56TheJacob*its
20:06:05sdwconsider that in nim you can just use maloc, right?
20:06:42TheJacobsdw: true, but that kinda defeats the point to a large extent, doesn't it?
20:06:44EXetoCTheJacob: unfortunately not. I'm sure Araq has some. ask in the forum if you want
20:06:50sdwTheJacob: it does not
20:06:53TheJacobEXetoC: okay, thanks
20:07:04TheJacobsdw: can you use both malloc and leave little things to gc?
20:07:44sdwsure, why not?
20:07:53TheJacobsdw: okay, cool, thanks!
20:07:56sdwisn't Rust garbage collected?
20:08:13TheJacobsdw: they have some weird ownership system, I don't really understand it honestly
20:08:28sdwmake sure you compare apples to apples
20:08:35fizzboozesdw: rust has no GC
20:09:10TheJacobsdw: we are comparing lack of gc to gc
20:09:12EXetoCa clever programmer oce told me that it's very difficult to manage memory as efficiently as a performant GC in certain situations </anecdotal evidence>
20:09:12fizzboozewhat's the overhead of calling a C++ function from ffi?
20:09:26bprData munging is just transforming data from one form to another. Cleaning, translating, etc. Sorry if I was unclear, I don't often know the terminology others use.
20:09:40EXetoCthat shouldn't be surprising to anyone
20:11:05*TheJacob left #nim (#nim)
20:11:35bpr<TheJacob>: Is the Rust compiler a performance sensitive application?
20:11:44EXetoCTheJacob: the GC can also be disabled, and there's a real-time GC (the documentation claims that the granularity is about 1ms, which is often too high, but the real number is lower than that apparently)
20:11:48sdwtoo slow :P
20:12:27EXetoCwe'll have to wait for relevant benchmarks
20:14:41EXetoCdom96, Araq_: do any of the benchmarks that we're doing well in stress the GC?
20:15:38*Mat4 joined #nim
20:15:44Mat4hello
20:15:59sdwHi Mat4
20:16:09Mat4hi sdw
20:20:12fizzboozecan anyone answer my question regarding ffi overhead?
20:21:20*gmpreussner_ quit (Ping timeout: 244 seconds)
20:21:22cjbestis the argument against having a GC "in some rare cases it causes unacceptable performance" or "its better never to have it"? If the former, it feels like being able to write code quickly and naturally without burning cycles worrying about memory management minutiae, and being able to hand optimizing where it really matters is the best of all worlds
20:21:39*Threewood3W quit (Ping timeout: 264 seconds)
20:21:40*gmpreussner_ joined #nim
20:22:25EXetoCfizzbooze: there should be no additional overhead
20:23:22EXetoCand we do have a C++ generator (C being the default)
20:23:42*UberLambda quit (Quit: Leaving the Matrix)
20:24:14*Jervac quit (Quit: Page closed)
20:25:30fizzboozeEXetoC: thanks
20:25:33*dumdum joined #nim
20:26:19dumdumHello, does anyone know how autocomplete is supposed to work in Aporia ide?
20:27:01dumdumFor me it triggers on '.' but always comes up with: "No items found for suggest"
20:27:44EXetoCit might not work at all still
20:27:46sdwcjbest: my take is that it's a fear of performance loss. The person who asked was inquiring about performance
20:28:33EXetoCdumdum: it did break at some point, and context sensitivity seems limited atm
20:29:14dumdum:( ok, is there any other editor with proper autocomplete?
20:29:38sdwNimSlime for sublime?
20:30:00EXetoCthe problem has been idetools, which I'd imagine is used by most editors with autocomplete support
20:30:54dumdumsdw: Nimlime only gives already parsed strings from the file..
20:31:11dumdumor i havent configured it properly maybe
20:31:13cjbestsdw: but how often is there meaningful performance loss? Feels like most stuff you want to do, the GC is just not a performance problem
20:31:46EXetoCcjbest: and far from everyone needs uncompromised speed anyway
20:32:35sdwcjbest: it depends on the application
20:32:44cjbesti've had that pain in Java, where it mostly sucks because a) you can't *avoid* using the GC, so in cases where you're actually throwing a lot at it you have to do hacky things to avoid allocation, and b) it stops things for so freaking long (this is the cause of like 95% of shitty UI stutter on android)
20:33:35*UberLambda joined #nim
20:34:19Mat4at least on Android the situation is getting slightly better because of the new runtime
20:34:55sdwAre there nim projects that run on android?
20:35:25cjbestsdw: I dunno, certainly sounds like a fun idea. The ndk works (but is a pain)
20:36:21Mat4sdw: No I'm aware of
20:36:22cjbestimagine a world where I can write my core libraries in nim and target android+ios, and then just write the last mile of graphical sugar in the standard languages
20:37:05*UberLambda quit (Client Quit)
20:37:15Mat4do you have something like Net in mind ?
20:37:19EXetoCyou just need a C++ compiler, right? so I'd assume that it'll work. one might have to wrap something though
20:38:18cjbestnow I kinda want to try this
20:38:36sdwdumdum: https://github.com/Varriount/NimLime <- it advertises autocomplete, but I think I agree with you that I've never seen it work
20:38:44EXetoChttp://forum.nim-lang.org/t/640#3464
20:39:28*bpr quit (Ping timeout: 246 seconds)
20:40:34dumdumsdw: lots of code in: https://github.com/Varriount/NimLime/blob/master/AutoComplete.py but does not work for me :(
20:41:38dumdumi dont know much about ide tools or nim , just a beginner
20:42:06*Var|Mobile joined #nim
20:42:30*TylerE quit (Ping timeout: 265 seconds)
20:43:51dumdumI think i have been dumbed down by Java too much and eclipse like IDEs
20:44:18cjbesthaving a great IDE doesn't dumb you down IMO, it lets you focus on the things that matter
20:44:45cjbestsay what you will about Java, using IntelliJ is a pleasure
20:44:52cjbesteven pycharm kindof rocks for python
20:44:58cjbestshould make nimcharm :)
20:45:04dumdumliclipse :)
20:45:25cjbesti hate eclipse with a firey passion
20:46:10*Varriount|Mobile quit (Ping timeout: 264 seconds)
20:46:17reactormonkcjbest, nim-mode for emacs is meh. I should take another look at it.
20:47:08dumdumabout dumbing down: I really think I should have spent this time teaching myself nim, but instead have spent last two hours searching for a 'proper' ide
20:48:39Mat4you can try working with a simple text editor and use a shell for compilation (for Unixoid operating systems 'screen' offers easy handling of virtual consoles)
20:48:49reactormonkdumdum, apora is all you will get
20:49:01reactormonk*aporia
20:49:06Mat4or try aporia
20:49:17sdwNimLime kinda works
20:49:28dumdumyep, aporia and sublime text (nimlime) it is for now
20:50:24Mat4there exist also a syntax highlighting file for gedit (or other gtkview based editors)
20:51:00*cjbest quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:51:02Mat4not to forget, you can use Vim or Emacs
20:51:42sdwThat's so sad :P
20:52:10reactormonksdw, no corporate money behind nim :-/
20:53:08sdwdumdum: when you try out esoteric languages, you often have to accept that the tooling won't be great
20:53:12dumdumEmacs is great I think but I dont like emacs :)
20:56:02*d3m1gd quit (Ping timeout: 276 seconds)
20:56:29dumdumsdw: agreed, I am not dumb enough to leave nim for an ide lang
20:57:10dumdumI spent last week on exploring Rust. .had not heard of Nim before it
20:57:40sdwThe big 3 C++ replacements seem like D, Rust, and Nim
21:00:23dumdumI was super excited about Rust, u know its seduced me , its branding (mozilla, logo, website etc) , its complexity (made me feel great to try understand it)
21:00:43dumdumbut in the end when i was writing it, my code looked massively ugly
21:01:45dumdumso if in the end i will only use it if: i dont want GC at any cost
21:01:48sdwI think it would be difficult to beat nim's syntax
21:02:37dumdumits the best infix notation i have even seen, it seems to be well thought out
21:02:52sdwit'll be the thing that bites it in the ass, though
21:03:13dumdumwhy? too much syntax?
21:03:16EXetoCcan't compromise too much
21:03:51sdwWhen large programs grow, all that sugar makes it difficult to reason about what it's going to do
21:05:52EXetoCpossibly, if you go nuts with the syntax
21:06:02EXetoCwhat about the compiler source?
21:06:14sdwTrying to bring that up right now, in fact :)
21:06:58dumdumbut does not the sugar reduce the number of symbols needed for expressing
21:07:12EXetoCsdw: a lot of the code was ported though
21:07:13dumdumso otherwise, you will be using more words..
21:07:17sdwsure, it's a trade-off
21:07:42sdwbut understand that it's a cognitive load for the reader
21:07:57dumdumas I saw in nim docs somewhere: complexitiy is constand in the problem at hand
21:08:06dumdumconstant*
21:08:16EXetoCsdw: are you making any assumptions about the reader's skills?
21:08:24sdwEXetoC: yes
21:08:55dumdumagreed, that is why java got so popular, it basically took away all freedom and many people seem to like it that way
21:09:32dumdumfor large programs, multi people programs, I still java is great choice if it fits
21:09:41sdwit's something that coding standards can enforce anyways. don't like operator overloading? fine, don't use it
21:09:42*cjbest joined #nim
21:11:01EXetoCdumdum: The "objects everywhere" sales pitch wasn't a big factor?
21:11:35ekarlsohttps://github.com/deuterium-orm/deuterium-orm < wondering how hard that would be in nim
21:13:53dumdumok yes :) but the relatively simple language was one too
21:13:54EXetoCekarlso: we do have type introspection. see the typeinfo module, and marshal for typeinfo in action
21:17:30sdwis that a work in progress? I wouldn't expect to see any SQL in an ORM system
21:17:57ekarlsosdw: ?
21:18:34sdwin your link they set up the tables using sql
21:22:50ekarlsohttps://github.com/deuterium-orm/deuterium/ < guess that's the most important bit
21:23:11*threewood joined #nim
21:26:32*Var|Mobile quit (Remote host closed the connection)
21:28:53*hasenj joined #nim
21:29:05hasenjnoob question
21:29:17hasenjdoes the noSideEffect pragma still work or has it been deprecated?
21:29:30hasenjI put it on a function with an echo statement and the compiler didn't complain
21:30:24Ionian_Nim isnt faster than Rust
21:34:39EXetoCnever?
21:34:49*MightyJoe is now known as cyraxjoe
21:35:09*cyraxjoe is now known as MightyOP
21:35:11Ionian_wut
21:35:34*MightyOP is now known as cyraxjoe
21:35:46EXetoCit never is? that seems unlikely
21:36:03dumdumhasnj: it allows echo, but does not for example changing a variables value
21:36:40dumdumprobably nim does not know the nature of echo
21:36:49EXetoCor maybe it isn't in this point in time, but it's a vague claim
21:37:23Ionian_as of now, even when Rust isnt as fast as its suppoed to be, Rust is faster than nim in most cases
21:37:33Ionian_however there is room for improvemnt on both sides
21:37:41hasenjdumdum: got it, thanks
21:37:47EXetoCdefinitely
21:37:48hasenjThe tutorial needs updating then :)
21:38:03hasenjhttp://nim-by-example.github.io/procs/
21:38:35Ionian_but really
21:38:42Ionian_the Comparison is more like Rust vs C
21:38:58EXetoCllvm vs C?
21:39:24Ionian_well llvm is like gcc
21:39:26dumdumhansnj: tutorial appears correct to me
21:39:33EXetoCbut it's not idiomatic C, so that might be overly simplistic
21:39:44dumdumit has additional expr: x - y
21:39:46dumdumnot just echo
21:40:09threewoodAre pragmas part of the type system?
21:40:31threewoodOr done through meta-programming?
21:41:43threewoodCan I have a side-effecting function that returns a noSideEffect function?
21:41:55EXetoCmetaprogramming yes. how does it work with the alternative?
21:42:18threewoodWell, is the {. noSideEffect .} part of a function type?
21:42:45threewoodIs it possible to declare a parameter that is a noSideEffect function?
21:43:42threewoodI'm thinking no and that it's only meta-programming
21:44:07threewoodSo the requirement that the function be noSideEffect is implicitly required when the function is used in a noSideEffect context
21:44:21threewoodbut I'm not sure
21:45:08dumdumhansenj: sorry, you are right, there are no sideffects
21:48:17EXetoCthreewood: is it not part of the type system then?
21:48:37threewoodI don't think so... still reading through the docs
21:49:22threewoodI think pragmas are annotations of symbols and don't affect types
21:49:39threewoodanyone know?
21:50:39threewoodOr maybe they annotate expressions actually
21:51:14*Var|Mobile joined #nim
21:51:24EXetoCwhat if you try to pass a closure to a non-closure proc? (closure being defined by including the closure pragma)
21:52:36threewoodI think pragmas are generally AST annotations, but maybe Araq can answer when he returns
21:53:06EXetoCI don't know what it is then if not a type error
21:53:24threewoodEXetoC, would that be a problem?
21:53:58*milosn quit (Ping timeout: 264 seconds)
21:54:22EXetoCit would apply only to certain compiler-defined pragmas then I imagine
21:54:48threewoodI mean your question about closures being passed to non-closure procs... that seems like it should just work fine
21:55:14EXetoCthreewood: the other way around then
21:56:03*dumdum quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
21:57:15threewoodI don't think either way should be a problem. The ones that are closures have access to their environment. If you have a closure function defined in a non-closure function, I would expect the environment it has access to would only be the local environment of the non-closure function.
21:57:26EXetoCa type error is generated, right? because the compiler sees the pragma and acts accordingly
21:59:12EXetoCwell it fails in some way, because of a mismatch, caused by the application of the closure pragma. I'm referring to your type system claim
22:00:02threewoodOh ok. I think what it's going to do is fail when you pass it in.
22:00:34*milosn joined #nim
22:01:07threewoodWait, are you talking about whether closure is a pragma or part of the type?
22:01:18EXetoCso, the closure pragma is then part of the type system? the compiler needs to take the pragma into account when doing signature matching
22:01:20threewoodI would think calling convention would need to be part of the type
22:01:26threewoodYeah, I agree
22:01:26*davidhq joined #nim
22:01:43EXetoCso the answer would be, "it depends"
22:02:45*brson joined #nim
22:03:28threewoodYeah, I'm not sure. Maybe it is part of the type. That, or the 'proc' meta-function interprets the annotations passed to it and attaches the calling convention to the procedure type, at which point it's in the type and not just an annotation anymore.
22:03:49threewoodI kind of think it's the latter, but again, not sure.
22:03:56gokrIonian_: As some random input on the "Rust vs Nim" choice: Nim has a nice and neat Exception mode, error handling in Rust seems very primitive IMHO. Nim has very good C/C++ interop, I suspect much better than Rust. On performance, Nim and Rust are probably quite equal. On platform support, I suspect Nim wins given "C runs everywhere".
22:04:07EXetoCdown with Rust!
22:04:15EXetoCbrson: joking of course. sup
22:04:22gokrs/mode/model
22:04:58Ionian_gokr, have you tried Rust and C/C++ interop?
22:05:34Ionian_"Run everywhere"
22:06:02gokrIonian_: And IMHO... no GC? Ok, of course you *may* be doing stuff where you don't want GC, but ... I suspect the vast majority of software works perfectly fine with a good GC and that is a big difference in effort.
22:06:21Ionian_GC is irrevelant right now
22:06:26Ionian_Im asking you a question
22:07:11gokrIonian_: No, I have not tried Rust (take it easy man, I am trying to answer) but since Nim compiles via C/C++ a fair guess is that Nim will interoperate better.
22:07:56EXetoCwasn't there a nim vs rust article? did you read it?
22:08:24bjz_http://arthurtw.github.io/2015/01/12/quick-comparison-nim-vs-rust.html
22:08:40gokrIonian_: And... GC irrelevant? Its a HUGE difference between the languages.
22:09:01Ionian_Yeah
22:09:07Ionian_I read that to see performance
22:09:15Ionian_and after he updated the whole thing
22:09:18gokrIonian_: Also, try to check how Rust does error handling.
22:09:25Ionian_.expect()
22:09:31gokrIonian_: I tried to even find info on it - and failed quite badly.
22:10:01Ionian_gokr, did you try asking the IRC themselves?
22:10:16gokrThey may have changed the manual, but a hint: Don't search for "Error handling", look under "Result".
22:11:00gokrNo, I have never had enough interest in Rust to go chatting.
22:11:14Triplefoxi idle in the IRC. it is always busy, although it seems like most people's questions involve complex situations involving borrowing...which I find a little unnerving
22:11:18Ionian_If you have questions in Rust, by all means go ask them!
22:11:23gokrI keep track of it in the corner of my eye, but for my use cases Rust is not it.
22:11:41gokrIonian_: Why should I? I don't even use Rust.
22:11:50gokrI am just trying to give you some input on differences.
22:12:01Ionian_gokr, you are making assumptions of your 0 experience with rust -.-
22:12:31gokrIonian_: Reality check - you are here asking for differences. I try to help you.
22:13:13*flaviu joined #nim
22:13:16Ionian_differences based on actual experience
22:13:45*davidhq quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:14:06gokrOh, why didn't you say so - then I don't have to waste time trying to help you.
22:14:15Triplefoxi did write a little bit of rust code myself but it put me off, i got into a situation where i did have to rely on IRC for help
22:14:29Ionian_I understand you are trying to help, thanks for that, but I cant be misled based on assumptions like that
22:14:59bjz_Ionian_: there is only so much you can learn on IRC
22:15:20Ionian_TripleFox, is common, stabilizing the language involves talking to the people that work on the language itself
22:15:24gokrIonian_: I am giving you hints on what the major differences are. I don't think I have said anything that isn't fairly well known.
22:17:06fizzboozegokr: you shouldn't be judging Rust when you said yourself that you have 0 experience it in
22:17:13Ionian_^
22:17:31gokrRegarding C++ interop (which is something very different from C) I do have a small bird in my ear telling me that Nim very shortly will show excellent results there.
22:17:57*Triplefox reviews what he had encountered...right, it was that he didn't know that "iter_mut" existed and he needed it to mutate things within an iteration
22:18:01gokrfizzbooze: I am not judging Rust - in fact - I love the fact that Rust (and other languages) are beating the path forward.
22:18:39Ionian_Rust and C/C++ interop is thematic, so there wont be such a big difference between the 2
22:18:41Ionian_since they are similar
22:19:14*sampwing joined #nim
22:19:40Ionian_I rely and go to their IRC alot because of the amount of poeple willing to help, and the sort of straight talk to the devs
22:19:49gokrMmmm, my bird says different. What about C++ templates for example?
22:19:54fizzboozesubl
22:20:02fizzbooze^ oops , ignore plz
22:20:10sdwIonian_: where are your benchmarks/code? I'd be interested in seeing them
22:20:12gokrIs there any big C++ library wrapped for Rust? (honest question here)
22:20:20EXetoCfizzbooze: your nickserv password? ;)
22:20:47bjz_gokr: if it doesn't have a C wrapper, then no
22:20:58bjz_gokr: spidermonkey and such I think
22:21:00fizzboozeEXetoC: subl from the terminal brings up the sublime editor
22:21:13gokrfizzbooze: Do point out where I "judged" Rust also. I tried to be fair.
22:21:26bjz_gokr: but the mismatch in semantics is challenging
22:21:52gokrI know, but check back here in a week or so - and I suspect you will be amazed by what Nim can do with C++.
22:21:58fizzboozegokr: you mentioned that you've never tried rust, but at the same time you said its error handling is primitive
22:22:13fizzboozegokr: i find rust's error handling to be the most advanced shit i've ever seen imho
22:22:39Triplefoxfrom what i recall rust's _runtime_ error model is pretty simplistic
22:22:50Triplefoxthe compiler does do an impressive job though
22:22:51gokrfizzbooze: I wrote "error handling in Rust seems very primitive IMHO.". I didn't say *is*. Its my perception from what I have read.
22:23:35fizzboozerust doesn't have a c++ ffi tho, that's something nim excels that. rust can only ffi C code
22:24:04gokrfizzbooze: This may be interesting to read: http://lucumr.pocoo.org/2014/10/16/on-error-handling/
22:24:16Ionian_Also, Rust, even though its not as fast as its supposed to be right now, is faster than Nim
22:24:27sdwIonian_: show
22:24:32fizzbooze: i've read that. have you read the updated article?
22:24:33gokrIonian_: Ok, yeah, show.
22:24:56fizzboozehttp://arthurtw.github.io/2015/01/12/quick-comparison-nim-vs-rust.html
22:25:00Ionian_^
22:25:05Ionian_beat me to it
22:25:14Ionian_reddi thread, created yesterday
22:25:14gokrfizzbooze: Ah, no I haven't read the updated article on errors. I will.
22:25:15Ionian_http://www.reddit.com/r/rust/comments/2tksc2/updatedread_updates_quick_comparison_between_nim/
22:26:20Triplefoxi don't think there's anything that stops each from being at parity when hand-optimized sufficiently, however i would offer that there would be differences in idiomatic code
22:26:34*hasenj quit (Quit: hasenj)
22:26:52Ionian_Atm, Rust isnt as fast is it _should_ be
22:27:24gokrYou can always find benchmarks saying this or that, here is one where Nim beats Rust: https://github.com/logicchains/LPATHBench/blob/master/writeup.md
22:27:29gokr(search for "756" on that page)
22:27:41gokrWhich is why I wrote - that performance probably is fairly equal.
22:28:03*sampwing quit (Ping timeout: 252 seconds)
22:28:58Triplefoxif the performance is dependent on hand-tuned allocation then rust would be more likely to come out ahead, just because it's built around doing exactly that
22:29:03fizzboozeare there plans to add nim to the language benchmark game?
22:29:44Ionian_think there is
22:29:48fizzboozei hope nim and rust will complete replace golang. i've been severely disappointed with go lately
22:29:50Ionian_but gokr: http://prntscr.com/5x2cxl
22:30:23gokrIonian_: Sorry?
22:30:27bjz_fizzbooze: would be nice to see nim taking a chunk out of go
22:30:29Ionian_especially since that Code he is using can be optimized
22:30:58Ionian_Rust 1.0 would chnage its LLVM IR output to be similar to clang's
22:31:01bjz_fizzbooze: and Rust out of C++
22:31:15Ionian_so that Rust would be literally as fast or faster than idomatic C code
22:31:21Ionian_post 1.0
22:31:21bjz_fizzbooze: and abit of overlap
22:31:32Ionian_gokr, he said himself the Rust section is outdated
22:32:28*meanfish joined #nim
22:32:35gokrOk, fine. My point is, I suspect you can find small benchmarks where either come out on top - since they are fairly close to each other on performance.
22:33:09bjz_Ionian_: I think this is an unproductive line of questions - #nim has no idea about Rust's code gen, and arguing over numbers over IRC is a black hole of wasted energy
22:33:16EXetoCIonian_: got specific applications in mind?
22:33:24fizzboozebjz_: agreed
22:33:41fizzboozeit'll be more fruitful to compare perf when both are 1.0
22:34:10Ionian_maybe even more post 1.0
22:34:13Ionian_but who knows
22:34:20Ionian_lots of room ahead for both langs
22:34:23sdwI don't see on the page. What backend is it using for nim?
22:35:30*asdfghjkl joined #nim
22:35:32bjz_Ionian_: yes, so could you stop harassing them? they are reasonable questions, but the format is not conducive to a good quality debate
22:36:14bjz_(format == IRC)
22:36:31*Ionian_ left #nim (#nim)
22:36:45flaviugokr: There is a C backend for LLVM being made.
22:38:18*cjbest quit (Quit: Textual IRC Client: www.textualapp.com)
22:38:27asdfghjklDoes anyone know of any official or unoffcial packages that would let me do cryptographic signing and verification?
22:38:28wtwis there a preferred way to convert/import c macros to nim? can c2nim do it?
22:39:17EXetoCwtw: yes, they are turned into templates
22:39:21def-asdfghjkl: openssl?
22:39:36EXetoCc2nim does have problems with ## and multiline macros atm
22:39:43gokrfizzbooze: Skimmed that error article for Rust... and I am sorry, but a) it doesn't look that simple and b) does this mean that every piece of code calling some code that may raise errors need to use this macro etc? Call me daft, perhaps I just don't get it.
22:40:00wtwthe macro I need to use is very simple
22:40:01asdfghjkldef-: The wrapper doesn't have rsautl
22:40:11wtw#define WIFEXITED(x) (_WSTATUS(x) == 0)
22:40:19wtwso just a check for 0
22:40:32gokrfizzbooze: To me it seems that this Result thingy will totally invade every code path. Or?
22:40:33EXetoCwtw: just make it a proc if you want to wrap it manually
22:40:56EXetoCor not if you can't be bothered to look up the types in question
22:41:00wtwmy problem is, a thing with this name is already present in lib/posix/posix.nim
22:41:11wtwWIFEXITED* {.importc, header: "<sys/wait.h>".}: cint
22:41:23wtwbut I feel it doesn't work ;)
22:41:50wtwexpression 'WIFEXITED(status)' cannot be called
22:41:55wtwis the error
22:42:32wtwtherefore my feeling is the import doesn't handle macros? is this correct?
22:42:38EXetoCwtw: I assume it's a variable, in which case you can't call it
22:42:50EXetoCI wonder if that works
22:43:21wtwwell, it shouldn't be a variable :/ ok
22:43:40sdwgokr: I think that's the point
22:45:04EXetoCwtw: nah, shouldn't work. report it if you want, and create your own wrapper in the meantime
22:45:07asdfghjklWhelp, I guess I'll try my hand at making an NaCl wrapper.
22:45:18asdfghjklNim really needs some better crypto suport.
22:45:29EXetoCit needs plenty of things
22:46:34EXetoCasdfghjkl: there are 4 libs with the crypto tag
22:46:53asdfghjklBut they all only do hashes
22:47:03EXetoCok
22:47:49fizzboozegokr: it forces to to check whether the result of your function is a valid value or an error. it may seem complicated but it's actually really simple. perhaps it may help you understand it if you write a few programs in it
22:48:03EXetoCflaviu: any plans to add more crypto stuff?
22:48:14EXetoCother than hashing
22:48:50flaviuEXetoC: I'm not sure what you're referencing.
22:49:07flaviueasy-bcrypt won't be getting any more features, it's complete.
22:49:11EXetoCasdfghjkl: anything specific?
22:49:16gokrfizzbooze: But does that mean that every call "level" needs to check? Here is someone that seems to think this is not Heaven at least: http://discuss.rust-lang.org/t/crazy-exception-like-constructs-for-result/587
22:49:31def-asdfghjkl: I'm interested in signify myself, don't think it's there for non-OpenBSD platforms yet: http://www.tedunangst.com/flak/post/signify
22:49:44asdfghjklExetoC: I just want to be able sign and verify data.
22:49:57asdfghjklGeneral public key crypto would be a plus.
22:50:28fizzboozegokr: that's because they added the FromError trait to simplify things
22:50:41*bpr joined #nim
22:50:42fizzboozebefore* they added
22:51:03gokrfizzbooze: But perhaps you have worked with it? How does it work then in practice? Let's say a function can raise several different errors? Or... what if I have 3 levels of callers - and realize I want to be able to raise something "down there". Do I then need to rewrite every call to use try and handle Result etc?
22:51:16*TylerE joined #nim
22:51:26asdfghjklNaCl is supposed to be pretty compact.
22:51:40asdfghjklI'll look into writing a wrapper module for it, I guess.
22:52:19def-asdfghjkl: if the header is clean, it's mostly automatic
22:52:29def-(at least a low level wrapper)
22:52:39asdfghjklOh, that's cool.
22:52:52asdfghjklI haven't made any yet, so I wouldn't know.
22:53:22gokrfizzbooze: I am just saying, perhaps its "all just great", but its not clear to me at least. ;)
22:53:26fizzboozegokr: i have worked with it, yes. a function that may return several differnent error types is common. you would wrap the error types in an enum, which is a algrebraic type
22:53:42EXetoChttp://goran.krampe.se/2014/10/16/nim-wrapping-c/
22:53:44def-asdfghjkl: here's how i did it: http://hookrace.net/blog/what-makes-nim-practical/#wrapping-libraries-with-c2nim
22:54:05fizzboozegokr: it's fine. i don't think it's appropriate to pollute #nim with rust tutorials. you'll find much more help in the rust irc :)
22:54:09gokrasdfghjkl: Yeah, both those articles explain quite a lot.
22:54:55gokrfizzbooze: Sure, I am just slightly amazed that people seem to think its "just fine" - but I don't get it. ;)
22:55:08asdfghjklAlright, I'll see if I can do this.
22:55:26sdwgokr: Do you agree that exceptions are not very useful?
22:55:34asdfghjklDo I just come back here to get it on the unofficial package list?
22:55:47gokrsdw: No, I find them quite useful.
22:55:53def-asdfghjkl: make a PR on https://github.com/nim-lang/packages
22:56:11asdfghjklAlright, great.
22:56:49sdwgokr: That's fine. Consider that for example google's C++ coding standards forbids them.
22:57:45EXetoCisn't there something wrong with C++'s exceptions?
22:58:02sdwYeah. They're exceptions
22:58:02def-asdfghjkl: it's probably even easier now with a foo.c2nim file, but i haven't looked into it
22:58:03gokrWell, C++ in my book is not a very interesting area of comparison. :)
22:58:22gmpreussner_i think C++ exception always incur a cost even when they're not used. that's why many vendors disable them altogether.
22:58:28EXetoCeither way, it's very convenient to just fail hard if necessary without having to do much at all
22:58:31asdfghjkldef-: What do you mean?
22:58:51def-asdfghjkl: for c2nim you don't need to edit the header file directly anymore, you can make a .c2nim file
22:59:36EXetoCgmpreussner_: yes, but how much slower compared to good old return code checking?
23:00:08EXetoCnot much I'd think, at least on x64
23:00:37gmpreussner_i think the impact used to be significant, although modern compilers have gotten much better at it
23:00:58gmpreussner_i remember reading an extensive article on this topic a year or two ago, but i don't have the link handy
23:01:10gokrsdw: I just read Google's reasoning - and it was not just "they suck". It was more complicated than that.
23:01:35*barosl__ joined #nim
23:01:42sdwBottom line: they suck :P
23:02:23*wan quit (Quit: WeeChat 1.1)
23:02:49gmpreussner_sdw: well, i wouldn't generalize like that. they're used with great success in Java in C# for example
23:03:38gmpreussner_the problem there is that they are often used for things other than exceptional states
23:03:42Triplefoxhmm, writing this bmp header seems ugly
23:03:46Triplefoxvar bytes : seq[char] = @[chr(0x42),chr(0x9A)] # BM
23:03:51Triplefoxdiscard outf.writeChars(bytes, 0, bytes.len)
23:04:49*barosl_ quit (Ping timeout: 245 seconds)
23:05:30EXetoCTriplefox: is outf.write(bytes) wrong?
23:05:36sdwgmpreussner_: And that's the tricky part, right?
23:05:51Triplefoxthat implementation doesn't exist
23:05:56Triplefoxbut it's not my worry
23:06:04Triplefoxchr() for every hex value is
23:06:05sdwgmpreussner_: out of memory is exceptional, and likely all I'll do is log it and terminate the program.
23:06:18EXetoCTriplefox: why not int8?
23:06:28EXetoCor uint8
23:06:44Triplefox.eval var a = int8(0x42)
23:07:07*cjbest joined #nim
23:07:24Triplefoxhmm
23:07:25EXetoCvar bytes = [0x48i8, 0x9a]?
23:07:42EXetoCthe first literal dictates the element type
23:07:57Triplefoxit doesn't work in the seq when i try it, unlike every other sequence type
23:08:09Triplefoxconversion from int literal to int8 is invalid
23:08:33EXetoCuint8?
23:08:44EXetoCbecause its outside the range
23:09:18Triplefoxtype mismatch on the writeBytes
23:09:29Triplefoxgot seq[uint8] expected openarray[int8]
23:11:07sdwgokr: What's the situation like in nim in light of restarts?
23:11:10Triplefoxthere's probably something that needs sorting out in system about this...char works except that i have to use chr()
23:11:19EXetoCTriplefox: it works with write, if it's a seq
23:11:25EXetoCstill can't stringify arrays..
23:12:27Triplefoxplease, show me the working code
23:12:44Triplefox(not meant maliciously, i'm just not sure which way is up at this point)
23:12:57def-the standard library just doesn't like unsigneds i guess
23:12:59EXetoCright, it includes @[]. you can use writeBytes and cast
23:13:36*barosl_ joined #nim
23:14:14*matkuki quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0/20150108202552])
23:14:22Triplefoxcast which
23:14:54EXetoCTriplefox: fout.writeBytes(cast[seq[int8]](myseq), 0, myseq.len)
23:15:17Triplefoxokay, yeah, it works
23:15:40Triplefox(writeBytes should have a uint8 version :< )
23:15:45EXetoCI hope I'm not causing too much confusion again
23:16:17Triplefoxfor posterity, the final code
23:16:18def-Triplefox: i agree
23:16:19Triplefoxvar bytes : seq[uint8] = @[uint8(0x42),0x9A]
23:16:19Triplefoxdiscard outf.writeBytes(cast[seq[int8]](bytes), 0, bytes.len)
23:16:39def-var bytes = @[0x42'u8, 0x9a]
23:16:54*barosl__ quit (Ping timeout: 245 seconds)
23:17:01Triplefoxah that's new to me
23:17:40def-actually "const bytes = ..."
23:17:54def-if that's all you need
23:18:16fizzboozehow do i get the underlying bytes of a string?
23:18:32Triplefoxi can inline it in fact and just do a one-liner
23:18:59EXetoCfizzbooze: str[i].int8
23:19:17fizzboozeEXetoC: i mean get the byte array :)
23:19:31fizzboozelike [byte] from string
23:19:42def-addr str[0]
23:19:51fizzboozethankx
23:19:52def-that's a pointer to the array
23:22:43wtwfreebsd parallel build PR is up..., hope this brakes nothing ;)
23:23:33*flaviu quit (Read error: Connection reset by peer)
23:24:39*sillesta quit (Ping timeout: 264 seconds)
23:27:13*flaviu joined #nim
23:31:28*tttt joined #nim
23:32:04*Outlander joined #nim
23:35:33gokrsdw: Granted, I have not yet used the Exceptions much in Nim (but I use them extensively in Smalltalk), but it looks to me that Nim today has no concept of resumable Exceptions. If that was indeed what you wondered? Smalltalk has them, and its pretty slick stuff, but I doubt Nim doesn't unwind when looking for handlers.
23:37:17sdwgokr: that's the main problem with exceptions. All the context is lost at the catch handler. C++ does not have resumable exceptions
23:38:07sdwgokr: This is the problem I suspect Rust is trying to solve. You can't leave where the problem occurred or it becomes more difficult to respond
23:38:46gokrTo me it looks like "error codes" dressed up to satisfy the type system. But I may be wrong.
23:38:53sdwNo, you'
23:38:53bjz_yeah, Rust doesn't have exceptions for safety reasons.
23:38:56sdwre right
23:39:24bjz_It is basically returning error codes, but you have to handle them
23:39:34sdwYeah, which is pretty slick imo
23:39:38dom96In Nim exceptions are tracked and you also have to handle them.
23:39:44gokrFurther, an Exception is a ref object , you can stuff stuff in them to make sure the handler has the context you wish it to have.
23:40:10bjz_also you can chain them together. There is some cool stuff that looks like it'll be in post 1.0 to make the ergonomics nicer
23:40:27dom96If you mark that your procedure with {.raises: [].}
23:40:35dom96*mark your
23:40:45sdwmeh, I would need some examples that make good use of restarts. I know that exceptions do a bad job of replacing errors codes without resumability
23:40:50bjz_yeah, not saying one is better than the other, just informing
23:40:56*lws joined #nim
23:40:56*lws quit (Changing host)
23:40:56*lws joined #nim
23:42:21dom96IMHO that gives you the best of both worlds.
23:42:33sdwrestarts?
23:42:34gokrsdw: I don't follow. Are you saying Rust error handling supports "restarts"? In what way do you mean?
23:42:44dom96What are "restarts"?
23:42:53*lws__ quit (Ping timeout: 245 seconds)
23:43:11gokrI guess resumable Exceptions. Not that common, but Smalltalk, Lisp and Dylan has such things.
23:43:16bjz_"I would need some examples that make good use of restarts"
23:43:17bjz_?
23:43:54gokrIn Smalltalk you can have a handler x levels up that simply tells the Exception to resume, and it will keep on running. Because Smalltalk doesn't unwind the stack when looking for handlers.
23:43:57bjz_Rust used to have conditions, but they were removed - if that is what you were referring to
23:44:41gokrI presume Nim unwinds, at least the manual has no mentions of being able to resume.
23:45:31gokrRight, is it Lisp that calls such "resumable Exceptions" conditions?
23:46:54gokrsdw: I just wonder how a regular error code can be considered to "support restarts"?
23:47:54sdwWhere is the nim docs on restarts? Did those get removed from the langauge?
23:48:23EXetoCgokr: it reduces repetition?
23:48:46gokrdom96: Yeah, from the looks of it I think the Exception model in Nim is quite nice (with the tracking etc). Sure, not resumable, but that's actually not even used much in Smalltalk either.
23:49:16*Matthias247 quit (Read error: Connection reset by peer)
23:49:17gokrEXetoC: You mean... resumable Exceptions?
23:57:33*renesac joined #nim
23:57:43sdwhttp://web.mit.edu/nimrod-lang/arch/i386_linux26/doc/manual.html#onraise-builtin
23:59:53*threewood quit (Ping timeout: 244 seconds)