<< 28-08-2017 >>

00:30:02*jinshil quit (Quit: Good-bye!)
00:56:45*ludocode quit (Ping timeout: 240 seconds)
00:56:54watzonI can't remember how to get the size of a openArray
00:57:16watzonIs it just `size(array)`?
01:08:50*mahmudov joined #nim
01:15:24watzonNvm, I found it
02:14:59*Ven`` joined #nim
02:18:54*endragor joined #nim
02:30:01*ludocode joined #nim
02:31:43*gangstacat quit (Quit: Leaving)
02:37:00*relax joined #nim
02:38:13*Ven`` quit (Ping timeout: 246 seconds)
02:46:45*Tanger joined #nim
02:50:37*endragor quit (Remote host closed the connection)
02:59:06*couven92 quit (Read error: Connection reset by peer)
03:21:03*BitPuffin|osx quit (Ping timeout: 248 seconds)
03:26:03*endragor joined #nim
03:29:15*relax quit (Ping timeout: 240 seconds)
03:30:39*endragor quit (Ping timeout: 248 seconds)
03:40:06*vivus quit (Quit: Leaving)
03:48:05*mahmudov quit (Remote host closed the connection)
04:00:47*mahmudov joined #nim
04:02:56*endragor joined #nim
04:07:27*endragor quit (Ping timeout: 252 seconds)
04:21:57*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
04:30:10*mahmudov quit (Remote host closed the connection)
04:31:21*mahmudov joined #nim
04:34:50*francisl joined #nim
04:39:06*endragor joined #nim
04:43:07*dddddd quit (Remote host closed the connection)
04:43:45*endragor quit (Ping timeout: 248 seconds)
05:21:22*miran joined #nim
05:26:01*miran quit (Ping timeout: 255 seconds)
05:38:24*mahmudov quit (Remote host closed the connection)
05:38:52*miran joined #nim
05:39:35*mahmudov joined #nim
05:51:27*endragor joined #nim
05:52:19*Vladar joined #nim
05:55:45*endragor quit (Ping timeout: 240 seconds)
06:08:03*francisl quit (Quit: francisl)
06:09:26*fridgeseal joined #nim
06:12:47*ludocode quit (Ping timeout: 260 seconds)
06:27:30*endragor joined #nim
06:32:10*endragor quit (Ping timeout: 255 seconds)
06:32:21*miran quit (Ping timeout: 240 seconds)
06:36:09*nsf joined #nim
06:41:38*Vi- joined #nim
06:44:19*ludocode joined #nim
06:49:47*gangstacat joined #nim
06:52:22FromGitter<Varriount> dom96: There are some posts on the forum that need to be approved
06:55:23*rauss quit (Quit: WeeChat 1.9)
06:55:35*ludocode quit (Ping timeout: 240 seconds)
06:58:50*ludocode joined #nim
07:03:25*Vi- quit (Quit: Leaving)
07:20:38*PMunch joined #nim
07:23:44*fridgeseal quit (Ping timeout: 260 seconds)
07:31:39*yglukhov joined #nim
07:32:30*yglukhov quit (Read error: Connection reset by peer)
07:32:40*yglukhov joined #nim
07:34:01*yglukhov quit (Remote host closed the connection)
07:34:14*yglukhov joined #nim
07:39:10*BitPuffin|osx joined #nim
07:39:59*endragor joined #nim
07:44:26*endragor quit (Ping timeout: 246 seconds)
07:57:24*mahmudov quit (Remote host closed the connection)
07:59:40*Yardanico joined #nim
08:16:15*endragor joined #nim
08:21:00*endragor quit (Ping timeout: 252 seconds)
08:27:51*nattefrost joined #nim
08:36:17*nattefrost quit (Ping timeout: 260 seconds)
08:36:32*nattefrost joined #nim
08:44:59*Arrrr joined #nim
08:48:04YardanicoAraq, is there a limitation for naming procedures? E.g. I have a proc "range", and if I import it from another module - Nim tries to use range from system.nim, not from my module https://gist.github.com/Yardanico/a16f6e93b300edb34d474104fe6d4618
08:48:14Yardanicoso I can only use "range" from another module using include
08:53:13Yardanicohmm, maybe I can solve this by creating small file which would import my other module and create templates to change names
09:03:30Araqtypes and procs cannot be overloaded
09:03:49Araqand actually the compiler should error with a "requires disambiguation" message
09:04:04Araqyou can always use mymodule.range
09:05:55*dom96|w joined #nim
09:29:16*endragor joined #nim
09:33:21*endragor quit (Ping timeout: 240 seconds)
09:37:22YardanicoCan I use string in nim for the same purpose as "bytearray" in Python?
09:37:37Yardanicoor it's better to use a sequence?
09:39:52*couven92 joined #nim
09:46:54PMunchYardanico, probably a seq[uint8] would be best
09:47:10PMunchAfter all that is what a bytearray is
09:47:42YardanicoPMunch, well I want to port a python package for querying minecraft server, and I'm firstly porting this file: https://github.com/Dinnerbone/mcstatus/blob/master/mcstatus/protocol/connection.py
09:47:56Yardanicomaybe I should use "streams" here
09:48:16Yardanicoimplement my own SocketStream (because I'll need to unpack stuff)
09:48:27Yardanicowell I can just use struct.nim
09:49:11PMunchAh, so he uses a bytearray to hold either a string, or something from a Connection
09:49:35PMunchIsn't that also a string though, or does Minecraft use a binary format over their sockets?
09:49:47PMunchbrb, lunch
09:52:59*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
09:54:35*dom96|w joined #nim
10:04:24*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
10:05:41*endragor joined #nim
10:10:07*endragor quit (Ping timeout: 248 seconds)
10:14:54Arrrrstring is used a lot in nim as a bytearray
10:22:24*Xe quit (Ping timeout: 248 seconds)
10:27:30*Xe joined #nim
10:31:55PMunchback now
10:32:26PMunchYardanico, did you figure out a way to port it?
10:39:49*endragor joined #nim
10:44:30FromGitter<AjBreidenbach> Is it ever useful to create a ref/obj pair when a type is only ever passed by value? I don't really understand the documentation.
10:48:04*nattefrost quit (Remote host closed the connection)
10:55:03FromGitter<krux02> @AjBreidenbach what do you mean with ref/obj pair?
10:55:55FromGitter<krux02> I personally don't use ref types at all, because objects are already passed by reference
10:55:59FromGitter<AjBreidenbach> For example in the dom module ⏎ ⏎ ``` Node* = ref NodeObj ⏎ NodeObj {.importc.} = object of EventTargetObj``` [https://gitter.im/nim-lang/Nim?at=59a3f6bfc101bc4e3a647a28]
10:56:30Yardanicodom96, lol https://twitter.com/NateTheFinch/status/899730215957561344
10:56:38Yardanicothis is the reason why I don't like go
10:56:43Yardanico(error handling)
10:56:45FromGitter<krux02> well that is just style and I don't like that style
10:58:13FromGitter<krux02> I prefer to not declare a type with the Obj postfix.
10:58:55FromGitter<AjBreidenbach> so, it's not functional?
10:59:13FromGitter<krux02> I just declare the object type without the postfix, and if I would use the ref type, I would use it litterally
10:59:14FromGitter<AjBreidenbach> it would just be if you want to pass a value, right?
10:59:18FromGitter<krux02> type MyType = object
10:59:25FromGitter<krux02> proc foo(arg: MyType)
10:59:30FromGitter<krux02> proc bar(arg: ref MyType)
10:59:51FromGitter<krux02> But as I said I figuerd out that I don't need "ref" at all
11:00:00*dom96|w joined #nim
11:00:11*arnetheduck joined #nim
11:00:31FromGitter<AjBreidenbach> ok, I understood. it's only relevant for how the object is passed, thought, right?
11:00:42FromGitter<krux02> well wen you pass an object in Nim, the argument is probably pass by const reference
11:00:56FromGitter<krux02> not rally
11:01:02Araqref MyType and MyType are completely differetn things
11:01:09Araqfyi: https://blog.regehr.org/archives/1307
11:01:45FromGitter<krux02> what you mean is probably proc baz(arg: var MyType)
11:01:57FromGitter<krux02> bas passes the argument by mutable reference
11:02:20FromGitter<krux02> the "var" parameter is what you might know from c++ as the "reference"
11:02:34FromGitter<krux02> the "ref" is more like the "std::shared_ptr"
11:03:20FromGitter<krux02> and foo is in c++ terms `void foo(const MyType& arg)`
11:03:52FromGitter<krux02> probably, because the compiler could also decide to copy the arg for ``foo``
11:04:12arnetheduckAraq, https://github.com/nim-lang/Nim/pull/5818 should be good to go - fails windows tests because of test suite being too slow it seems
11:05:17Araqwell it used to be "not too slow"
11:05:31Araqif your PR makes it too slow, guess what, it indicates a problem
11:06:07Yardanicohmm, I looked at generated C source and it seems there's no difference between "let" and "var" if object is not changed. is that true?
11:06:35YardanicoI thought "let" makes some optimisations too
11:07:10arnetheduckor it just randomly got assigned a slower appveyor host
11:07:47Yardanicowell, https://github.com/nim-lang/Nim/pull/6190 would speed it up a bit
11:07:55Yardanico~1.3-1.7 on 2 core I think
11:08:14Yardanicoboth travis and appveyor have 2 cores
11:08:50arnetheducka successful test takes 57mins for a random succeeding branch, and the cutoff is at 60 mins.. that's 3mins of grace t ime
11:08:57*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
11:09:19arnetheduck57:42 mins, so 2:something mins
11:09:31Araqappveyor said they changed the timeouts to 1 hour and 30 mins
11:09:52FromGitter<krux02> Yardanico, well in the backend let and var is the same afaik
11:09:53arnetheducknot when the test for that branch ran
11:10:14Yardanicokrux02: ok, so "let" is only useful for not making mistakes?
11:10:15FromGitter<krux02> it is just to ensure that a value doesn't change anymore
11:10:20Yardanicook
11:10:24FromGitter<krux02> I would assume so
11:10:48arnetheduckany easy way to rerun the test?
11:11:06FromGitter<krux02> I like to use as few var states as possible, because managing state is kind of hard
11:11:14*endragor quit (Remote host closed the connection)
11:11:34arnetheduck" Failed 10 days ago in 1 hr "
11:11:44FromGitter<krux02> and when you see a let you can safely assume nobody changes that value
11:12:22FromGitter<krux02> local state is ok though, like mutating the result
11:15:37Araqlet IS used for optimization purposes already
11:16:01Araqbut not in all cases
11:17:34FromGitter<krux02> but is it used for a lot of optimizations, so that using a lot of let can significantly improve performance?
11:18:30FromGitter<krux02> but yes let should be used for performance optimization, but I still think the most important thing about ``let`` is to aid the programmer. Ant least right now.
11:19:01Araqactually it is wrongly used for optimization :-)
11:19:32Araqand should be replaced by a better optimizer, you're right that 'let' is about the programmer's intend
11:24:09*dddddd joined #nim
11:33:49PMunchIt's good practice though to mark things you don't plan on changing with let. That way future optimizations in the compiler will actually benefit your code :)
11:34:08PMunchPlus of course you show your intent with the variable which is always nice.
11:36:52*dom96|w joined #nim
11:37:03Araqwell yes but my point is that "future optimizations in the compiler" won't rely on var vs. let, it can compute that the 'var' is in fact a 'let'
11:37:27PMunchAh, that's a fair point
11:42:14*Snircle joined #nim
11:44:20*endragor joined #nim
11:53:04FromGitter<krux02> @Araq: seems like you could produce a "hint" in the compiler that says "this var could be a let" :P
11:55:15Yardanicowell why not? there's a warning "Warning: 'l' should not be used as an identifier; may look like '1' (one)"
11:55:21FromGitter<andreaferretti> +1
12:00:07*haha_ joined #nim
12:00:33Yardanicohmm, https://design.perl6.org/S15.html#Numbers
12:00:43Yardanicosay 42 + ٤٢; # ascii digits + arabic indic
12:01:55def-@krux02 that can be annoying when it's just temporarily used as immutable, for example because you just started the implementation, commented out some code, or potentially something hidden under a when. At least these kinds of warnings sometimes annoy me because of that, especially if they're enforced as errors
12:02:41*tdc joined #nim
12:03:19Yardanicowell if this will be added, it should be a "hint", not a warning
12:08:05FromGitter<krux02> First of all, it's like unused variable. When you just declared a variable of course it is usused
12:08:21FromGitter<krux02> but I don't think it's important right now
12:09:59FromGitter<andreaferretti> Still, it could be used to let newbies learn about var vs let
12:10:09FromGitter<andreaferretti> which is a topic which comes about extremely often
12:10:24FromGitter<andreaferretti> A hint is rather unobstrusive
12:11:13FromGitter<krux02> I am not saying it shouldn't be done nor it is not useful, because it is. All I say is, it is not important right now.
12:11:51FromGitter<krux02> I think Nim still has a few ugly things under the hood that need to go away and would introduce breaking changes
12:12:32FromGitter<krux02> like the removal of the distinct nil value for seq and string
12:12:55FromGitter<krux02> anything that breaks backwardscompatibility should get out of the door as fast as possible
12:13:15FromGitter<krux02> before too much code relies on it
12:15:27*haha_ quit (Quit: haha_)
12:16:01FromGitter<andreaferretti> agreed
12:17:05*gangstacat quit (Quit: Leaving)
12:23:45*haha_ joined #nim
12:34:34dom96|wyep, we need to focus on backwards compatibility breaking changes for now
12:34:46dom96|wagree as well
12:38:19Yardanicoyeah
12:38:40Yardanicoafter 1.0 we can't just do stuff like changing behaviour of "quote do"
12:39:04Yardanicolike all compatibility stuff
12:42:28*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
12:45:27*dom96|w joined #nim
13:02:50*rauss joined #nim
13:04:22demi-hmm; is there any way I could get an AsyncFile handle of `stdout`?
13:12:26*dddddd quit (Quit: Hasta otra..)
13:12:45*dddddd joined #nim
13:13:55arnetheduckAraq, lo and behold, the same code for https://github.com/nim-lang/Nim/pull/5818 now passes in 56 minutes
13:23:54*endragor quit (Remote host closed the connection)
13:28:38*BitPuffin|osx quit (Read error: Connection reset by peer)
13:33:36*BitPuffin|osx joined #nim
13:36:31dom96|wdemi-: yes, but it won't work on Windows.
13:38:50Araqarnetheduck: nice :-)
13:39:26*couven92 quit (Read error: Connection reset by peer)
13:39:36*endragor joined #nim
13:43:45*endragor quit (Ping timeout: 240 seconds)
13:47:52Yardanicoarnetheduck, a typo: in lib/system.nim at 272 - boudns
13:47:58Yardanicoshould I make a mini-PR?
13:48:12*haha_ quit (Quit: haha_)
13:49:01arnetheduckYardanico, pls yes, if you can
13:49:26*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
13:49:33Yardanicoarnetheduck, well I always can :)
13:49:35Yardanicohttps://github.com/nim-lang/Nim/pull/6285
13:49:47*haha_ joined #nim
13:51:44FromGitter<dandevelop> Do you use a debugger to debug your nim code?
13:52:57YardanicoI don't, there was no need to use it (at least for me)
13:57:11*relax joined #nim
14:17:14*william1 joined #nim
14:17:25*william1 left #nim (#nim)
14:18:42demi-dom96: that is fine; i don't care about windows
14:19:16*loc8 joined #nim
14:27:31*PMunch quit (Quit: Leaving)
14:36:30*haha_ quit (Quit: haha_)
14:40:10*haha_ joined #nim
14:40:28GertmWhen using the parsecfg module, how can I make sure the strings I write to the config are quoted in the config?
14:41:55GertmDoes it figure out itself?
14:43:43Gertmfigure it* out itself?
14:43:53GertmMy tests do indicate that it figures it out itself.
14:45:50*arnetheduck quit (Ping timeout: 246 seconds)
14:51:34Araqyeah I don't think you can influence this
14:51:46Araqit "simply works (tm)" (unless it doesn't)
15:00:19loc8Does Nim have a format for build scripts? Like Makefiles, for example.
15:01:09*kier quit (Quit: No Ping reply in 180 seconds.)
15:01:34Yardanicoloc8, create .nims file?
15:02:04*dom96|w joined #nim
15:02:07Yardanicoloc8, https://github.com/nim-lang/nimble#creating-packages
15:02:13YardanicoYou can place any Nim code inside these tasks. As long as that code does not access the FFI. The nimscript module in Nim's standard library defines additional functionality such as the ability to execute external processes which makes this feature very powerful.
15:02:29loc8Thank you!
15:06:33*kier joined #nim
15:11:23*oaao quit (Read error: Connection reset by peer)
15:13:54Demos[m]One of the things I love about nim. You just write build scripts in nim!
15:14:07*Trustable joined #nim
15:25:42dom96|wyay, that talk went well :)
15:26:16Araqdom96|w: tell me! :D
15:27:01dom96|wSome concerns about having to handle the AST directly
15:27:32dom96|wAnd also one person mentioned that they checked Nim out a long time ago and found the style insensitivity odd.
15:28:42Araqaha
15:29:12Araqwell I just fixed yet another critical codegen bug, #6279
15:30:28FromGitter<ephja> there are still bugs? :p
15:30:55FromGitter<dandevelop> @Araq do you use any debuggers to debug Nim?
15:31:50Araqno.
15:33:06Araqand I haven't used C#'s debugger much either back then when I used C# extensively
15:33:08ZevvI bet you're single stepping your way through your code all day :)
15:33:40*haha_ quit (Quit: haha_)
15:33:46dom96|wSome also asked about the readability of the generated C code
15:33:55Yardanicowell ask them for readability of LLVM :D
15:34:13Yardanicoalso PyPy uses C as backend
15:34:16dom96|wAlthouh there was some love for compiling to C actually :)
15:34:22dom96|w*although
15:34:34Yardanicobut PyPy C code is a lot more obfuscated
15:35:09Yardanicoand compiling is a lot slower (because their compiler is written in python)
15:35:25YardanicoPyPy can take 30-90 minutes to compile
15:35:33dom96|w:o
15:36:22Yardanicoso I actually like nim compilation times
15:36:46dom96|wI think it would be a good idea to investigate how long compilers take to compile
15:36:49dom96|wand create a little chart
15:37:05dom96|wbecause I thought 6 seconds is long (that's how long Nim takes)
15:37:06dom96|wBut I guess it really isn't
15:37:29Yardanicodom96|w, it's very fast actually
15:37:54FromGitter<ephja> roughly how much faster can the compilation of nim code get?
15:38:08FromGitter<ephja> can the processing of unchanged modules be sped up?
15:38:22Yardanicowell nim processes them very fast actually
15:38:28Araqit was, that feature is called --symbolFiles
15:38:48Araqgot bootstrapping times of 0.1s on what's now old hardware
15:39:25FromGitter<ephja> yeah that's pretty good
15:39:34dom96|wyeah, I'm sure there is plenty of optimisations that could be done
15:39:40FromGitter<ephja> it doesn't take long by all means, but it's noticeable when you have lots of modules
15:40:35YardanicoAraq, does it work now?
15:40:44FromGitter<ephja> I'm looking at you, nimx :D
15:41:15AraqI doubt it, recently made some old tests work again
15:41:53YardanicoAraq, well yeah it's giving me some internal compiler error
15:41:59YardanicoError: internal error: (filename: evaltempl.nim, line: 45)
15:42:08Yardanicowhile processing parseutils
15:42:46FromGitter<ephja> I'll compare compiling nimx code with and without symbol files
15:43:31Yardanicowell it seems to fail for me
15:44:09YardanicoError: internal error: could not serialize some forwarded symbols/types
15:44:31Araqfix it :P
15:45:41Yardanicowell I don't really need faster compilation times :)
15:47:53Yardanicoah, it's already on github issues
15:47:59Yardanicohttps://github.com/nim-lang/Nim/issues/1031
15:50:48Araqyeah, I'd like to rewrite large parts of the compiler to use "pointer free" programming :P
15:51:19Araqpointers suck...
15:54:56FromGitter<ephja> replacing pointers with option types?
15:58:24Araqkind of and with IDs
16:03:44*Matthias247 joined #nim
16:05:58Yardanicowell symbolFiles work for system.nim
16:14:18Yardanicoisn't there a way to tell to compiler to "skip" failed generation of symbol files?
16:14:21*yglukhov quit (Remote host closed the connection)
16:14:45*Matthias247 quit (Read error: Connection reset by peer)
16:15:04*yglukhov joined #nim
16:17:18FromGitter<ephja> is it worth the effort compared to just fixing the bug in question? :p
16:18:04*yglukhov quit (Read error: Connection reset by peer)
16:18:17*yglukhov joined #nim
16:18:31FromGitter<ephja> to whoever implements the bug circumvention mechanism lol
16:19:43Araqit's not a single bug
16:20:26Araqmany of the data structures and AST passes are not re-entrant in the sense that you can load partial results from disk
16:23:10*yglukhov quit (Ping timeout: 276 seconds)
16:29:17*haha_ joined #nim
16:31:38FromGitter<BigEpsilon> Hi Araq, just a little question: Are integer template parameter not supported in c2nim (just making sure because it seems so) ? is it because of an intrinsic difficulty or just that there was no need for it until now ? I'm trying to write a wrapper for opencv combining the python wrapper generator and c2nim
16:36:38*haha_ quit (Quit: haha_)
16:40:36*haha_ joined #nim
16:50:58*haha_ quit (Quit: haha_)
16:51:15*couven92 joined #nim
16:51:19*ipjk joined #nim
16:53:23loc8What's the current state of coroutines in Nim?
16:56:32*vivus joined #nim
16:58:04Yardanicoloc8, well there's async if you want it
16:58:31Yardanicoalso there are coroutines - https://nim-lang.org/docs/coro.html
16:58:39Yardanicobut it's not very portable
16:58:58loc8I was taking a look at that...
16:59:28loc8I'm using Jester for a web server, and `runForever()` seems to block other code from running
16:59:39loc8Does it support starting the server on a separate thread?
17:01:25dom96|wloc8: indeed, async await is single threaded
17:01:38dom96|wMight be able to advise if you tell me your use case
17:03:44*tdc_ joined #nim
17:06:41*tdc quit (Ping timeout: 248 seconds)
17:06:53*huonw quit (Ping timeout: 246 seconds)
17:08:56*huonw joined #nim
17:09:37*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
17:10:39loc8Gotta start the Jester server, keep it running, and run other code after it has started
17:12:48Yardanicoloc8, asyncCheck anotherAsyncProc() ?
17:13:15Yardanico(unless your other code is computationally intensive)
17:14:18Yardanicoif it is, use threads :)
17:18:38*oaao joined #nim
17:30:50dom96loc8: what does the other code do?
17:32:31*miran joined #nim
17:42:52Yardanicooh wait, symbolFiles actually worked for one of my small apps!
17:43:10Yardanicooh
17:44:45Yardanicowell it generated symbol files successfully
17:44:49Yardanicobut it can't read them :)
17:45:25Yardanicobut honestly this is a very cool feature
17:49:00*vendethiel- joined #nim
17:50:01Yardanicoif we make it work some time, it would be another cool feature :)
17:54:06*nsf quit (Quit: WeeChat 1.9)
17:56:34Demos[m]what's the procedure for renaming a package in nimble?
17:57:42YardanicoDemos[m], make a PR to nim-lang/packages :)
17:57:46Yardanicobut firstly change your .nimble file
17:59:08Demos[m]yeah I'm gunna up the version and make some major changes :D
18:00:20*Yardanico quit (Remote host closed the connection)
18:05:16*enthus1ast__ joined #nim
18:06:14dom96read the nim-lang/packages readme
18:06:21dom96There is a bit more to it than that
18:06:23enthus1ast__dom96, can i let the javascript backend generate the "await" keyword?
18:06:36dom96elaborate
18:06:55enthus1ast__should i play with emit?
18:07:25Araqenthus1ast__: yes
18:07:27*Ven joined #nim
18:07:34enthus1ast__yes to emit?
18:07:50*Ven is now known as Guest73037
18:08:10FromGitter<stisa> enthus1ast_ I'd use something like `{.importcpp: "await #".}`
18:08:37enthus1ast__ahh
18:08:45enthus1ast__ty ill try that
18:10:45*PMunch joined #nim
18:15:50enthus1ast__1. how can i export (global) variables in javascript? Withouth defineing a getter for each?
18:15:55enthus1ast__2. what is the prefered way to the converted jsffi JsObject to an json JsonNode?
18:17:47Araqvar myglobal {.exportc.}: T
18:19:59*Arrrr1 joined #nim
18:19:59*Arrrr quit (Disconnected by services)
18:20:03*Arrrr1 quit (Client Quit)
18:22:17enthus1ast__Aray, ty works!
18:22:24enthus1ast__-.-
18:22:27enthus1ast__Araq
18:26:20*yglukhov joined #nim
18:30:49*yglukhov quit (Ping timeout: 255 seconds)
18:36:41*haha_ joined #nim
18:43:35*enthus1ast__ quit (Ping timeout: 240 seconds)
18:50:16loc8I'm having a bit of a problem using Jester together with nimongo
18:50:57loc8Trying to call `db.find(...)` inside a route causes the code to stop compiling
18:51:25loc8Thought it could be something with async and having to wait for the call, changed to the async version of nimongo
18:51:36loc8Still gives me a compile error
18:53:42FromGitter<Yardanico> Well can you give source and full traceback?
18:54:28loc8Sure
18:57:35*Vladar quit (Quit: Leaving)
18:59:16loc8Yardanico, https://pastebin.com/Fa0t3pVP
19:01:48*Matthias247 joined #nim
19:04:13*Guest73037 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:05:37*yglukhov joined #nim
19:16:13*BigEpsilon joined #nim
19:17:05*ipjk quit (Quit: Leaving)
19:17:56BigEpsilonHi Araq, just a little question: Are integer template parameter not supported in c2nim (just making sure because it seems so) ? is it because of an intrinsic difficulty or just that there was no need for it until now ? I'm trying to write a wrapper for opencv combining the python wrapper generator and c2nim
19:19:24FromGitter<Varriount> BigEpsilon: What trouble are you running into?
19:19:30Araqwhat are integer template parameters? oh ... yeah, c2nim only supports type parameters
19:20:22FromGitter<Varriount> Araq, dom96: Might be worth looking at Python's unified TLS proposal for ideas on the Nim library: https://www.python.org/dev/peps/pep-0543/#interfaces
19:20:53*nsf joined #nim
19:22:03Araqvarriount: thanks, but I cannot abstract over things I do not understand
19:24:07Araqin fact, I don't even understand sockets. open/read/write/close, what was wrong with that? ;-)
19:29:25BigEpsilon@Varriount: c2nim is unable to parse template that have integer parameter. Ex: template <int N> foo(...)
19:29:33*BigEpsilon left #nim ("Quit")
19:29:46*BigEpsilon joined #nim
19:30:41FromGitter<Varriount> BigEpsilon: Ah, gotcha. I was getting templates confused with C macros.
19:32:11dom96loc8: You should be using 'await' instead of 'waitFor'
19:32:20dom96But the error you're seeing is likely due to thread analysis
19:32:34dom96Try compiling with --threadAnalysis:off and report this as a bug on Nim's repo
19:32:51*Trustable quit (Remote host closed the connection)
19:34:25BigEpsilonAraq, do you think it needs alot of work to add the support for integer type template arguments to c2nim
19:34:27BigEpsilon?
19:36:12BigEpsilonIm considering doing that
19:38:55loc8dom96: I've changed back to the synchronous nimongo and added the '--threadAnalysis:off' option and it does compile now
19:39:25dom96why synchronous?
19:39:31dom96use asynchronous nimongo if you can
19:40:45loc8It tells me `await` doesn't exist. I have imported `asyncdispatch`
19:43:48dom96You need to mark your proc with {.async.}
19:44:39loc8Ah, forgot about that part. Thx
19:47:30*tdc_ quit (Ping timeout: 240 seconds)
19:47:42*dom96|w joined #nim
19:52:51*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:16:05*rosshadden joined #nim
20:17:01*rauss quit (Ping timeout: 240 seconds)
20:18:07loc8Yardanico: It fails to compile with `--gc:boehm --threads:on`
20:19:52AraqBigEpsilon: give it a try please :-)
20:20:28BigEpsilonI will :)
20:21:58FromGitter<dandevelop> Taking a look at the generated C code I see something like: TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].kind = ⏎ TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].offset = ⏎ TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].typ = ⏎ TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].name = "functionName" [https://gitter.im/nim-lang/Nim?at=59a47b65c101bc4e3a671e3c]
20:22:17Araqso?
20:22:22FromGitter<dandevelop> Is there any option to not generate these? I am interested in the name part
20:22:40FromGitter<dandevelop> It gets written in the executable
20:22:56FromGitter<dandevelop> Is there any way for "functionName" not to be written in the executable?
20:23:30FromGitter<dandevelop> More specific, I am looking for a way not to include variables, fields and function names in the executable
20:24:40Araqfunction names are not part of the RTTI
20:24:53Araqneither are variable names
20:25:12FromGitter<dandevelop> So is there any way for them not to be written in the executable?
20:25:15Araqonly enum and object fields are affected and I think we can do without object fields
20:25:33Araqcurrently, no, you need to patch compiler/ccgtypes.nim
20:25:44FromGitter<Varriount> @dandevelop Generally function names and variables names in the source code are erased once the C compiler translates them into object files.
20:26:07FromGitter<dandevelop> @Varriount that's what I would also expect but it looks like they are not
20:26:16FromGitter<dandevelop> @Varriount that is why I am asking
20:26:31FromGitter<Varriount> What tool are you using to examine the binaries?
20:27:31FromGitter<dandevelop> Any text editor can be used
20:27:34FromGitter<Varriount> And are you compiling in release mode, without stack trace information?
20:28:09FromGitter<dandevelop> @Varriount like this: -d:release --opt:speed -d:noAutoGLerrorCheck --stackTrace:off --lineTrace:off --lineDir:off
20:28:18dom96loc8: Ahh yes, no wonder this happens, you've got a global variable.
20:28:26dom96The error message could be better IMO
20:28:43dom96In any case, for boehm you still need to explicitly turn off thread analysis.
20:29:20FromGitter<dandevelop> @Araq: are those strings needed in the release mode?
20:30:30relax@dandevelop: When you say, "Any text editor can be used," it makes me suspect you're inspecting the .c source files, not the actual binary
20:30:37*haha_ quit (Quit: haha_)
20:30:55Araqno, as I said, only enum field names are required for $ and there is a PR to change that iirc
20:31:22Araqrelax: why? you can open binaries with text editors because "text" is a lie
20:31:35Araqthere is only bytes.
20:32:24FromGitter<ephja> @dandevelop do you need conditional extension loading?
20:32:42dom96dandevelop: I'm curious, why are you concerned about func/var names being present in the binary?
20:33:11*haha_ joined #nim
20:33:19FromGitter<dandevelop> @relax I am looking at the binary believe me :-)
20:33:28relaxaraq: agreed, just wanted to make sure
20:33:58FromGitter<Varriount> @dandevelop I'm not seeing any strings in my test code. I see the calls to the frame functions, but those are just dummy macros.
20:34:26Araqyou might need to use some "strip" linker command
20:34:41Araqoh!
20:35:03Araqif you use .dynlib then yes, the string is generated as part of the loading sequence
20:35:44*yglukhov quit (Remote host closed the connection)
20:37:01loc8dom96: So accessing a global variable from an async proc will cause this?
20:37:15loc8Because it's trying to access stuff from another thread, right?
20:37:36dom96accessing it from any proc will
20:37:44dom96if you have threads enabled
20:37:58dom96well, no I'm wrong, sorry, any `gcsafe` proc.
20:38:38dom96And jester expects to get a gcsafe proc.
20:40:35*miran quit (Ping timeout: 240 seconds)
20:41:47FromGitter<dandevelop> @Varriount create a nim file with this content:
20:41:50FromGitter<dandevelop> proc SpecialFunctionName() = ⏎ ⏎ ```echo "Hello"``` ⏎ ⏎ SpecialFunctionName() [https://gitter.im/nim-lang/Nim?at=59a4800dba0f0f6e38f1c0b5]
20:42:05FromGitter<dandevelop> Save it as test.nim
20:42:09FromGitter<dandevelop> And then compile it
20:42:11FromGitter<dandevelop> nim c -d:release --opt:speed -d:noAutoGLerrorCheck --stackTrace:off --lineTrace:off --lineDir:off ./test.nim
20:42:25FromGitter<dandevelop> The open the binary in any text editor
20:42:25FromGitter<Varriount> What's with the define?
20:43:24FromGitter<dandevelop> You can leave that one out
20:43:25FromGitter<dandevelop> nim c -d:release --opt:speed --stackTrace:off --lineTrace:off --lineDir:off ./test.nim
20:43:39FromGitter<dandevelop> It was from another project
20:43:58FromGitter<dandevelop> Ok, once the binary is built
20:44:13FromGitter<dandevelop> You can open the binary in any text editor and search for the string: SpecialFunctionName
20:47:45FromGitter<Varriount> Dan: I see. Well running 'strip' seems to make the symbols go away.
20:47:55Araqdandevelop: that's a C compiler toolchain issue
20:50:19Araquse 'strip' or similar as varriount suggested
20:50:19*haha_ quit (Quit: haha_)
20:51:43*couven92 quit (Ping timeout: 248 seconds)
20:52:29FromGitter<dandevelop> @Araq strip works indeed for function names. what about fields in objects?
20:54:25FromGitter<Yardanico> So you want to make disassembling your file harder?
20:54:43FromGitter<Yardanico> *of your program
20:55:24Araqdandevelop: told you, that requires a compiler patch, but it is not hard
20:56:01FromGitter<dandevelop> Thank you @Araq. Is that something planned?
20:56:30*rosshadden quit (Quit: WeeChat 1.9)
20:56:32dom96hrm, didn't answer my question I guess the answer is "I'm writing a virus" :P
20:56:48FromGitter<ephja> too many things in the pipeline
20:57:12FromGitter<Yardanico> Well you can also use xor'ed strings if you want to (I mean for string literals)
20:58:27FromGitter<Yardanico> But for virus - pls be careful, or antiviruses will detect any nim program :D
20:58:56FromGitter<Varriount> Oh gosh, imagine the GC being used as the hueristic.
20:59:13Araqdandevelop, no but PRs are welcome and it's not hard to do
20:59:34FromGitter<Yardanico> Also - would it be harder for someone to disassemble and understand nim than C (I mean both compiled to native)?
20:59:40FromGitter<dandevelop> @Araq: wish I could help with that but i don't know where to start
21:00:10FromGitter<dandevelop> @dom96: I worked in the antivirus industry for many years, I guess my brain is wired in a certain way :) Now seriously I am looking at protecting IP and binary size
21:00:10Araqcompiler/ccgtypes.nim
21:00:34dom96dandevelop: interesting :)
21:00:55FromGitter<Yardanico> @dandevelop also you may be interested in:
21:01:49FromGitter<Yardanico> https://forum.nim-lang.org/t/1305/1
21:02:25Araqyardanico: probably about even, C is more cumbersome that means you need to wade through lots of asm's version of 'if (err) goto insanity' but Nim compensates this via its template expansions :P
21:03:22FromGitter<dandevelop> @dom96: if you are storing an user object with a password hash field and you check that in your app, you wouldn't want anyone to open your binary and simply look for the password field in your binary that is conveniently named: "password" as a member of the User object
21:03:41FromGitter<dandevelop> @dom96: that would make reversing even easier
21:04:07dom96good point :)
21:04:52Araqreally? I can just run the app and trace it when I type in some random password
21:05:22FromGitter<Yardanico> Well it would be the same in C, maybe you need to use an obfuscator?
21:05:57FromGitter<dandevelop> @Yardanico class members don't get stored as strings in the binary when using C afaik
21:06:37FromGitter<dandevelop> @Araq the password example is just an example. In general, field names make for easier reversing when they are visible in the binary
21:07:02FromGitter<Yardanico> @dandevelop well C doesn't have classes :)
21:07:07FromGitter<dandevelop> @Yardanico sorry, struct members, we are talking about C here
21:07:16FromGitter<Yardanico> Hmm, ok
21:07:58FromGitter<dandevelop> @Araq they also make binaries larger :D
21:08:29Araqas I said, PRs are welcome.
21:09:00FromGitter<dandevelop> @Araq ok, I will take a look at compiler/ccgtypes.nim
21:09:01Araqonce you need deserialization, field names are hard to avoid though and C's solution ends up with field names too
21:09:22Araqit's just that you would need to write it manually
21:09:38FromGitter<dandevelop> @Araq true
21:10:37FromGitter<dandevelop> @Yardanico this link (https://forum.nim-lang.org/t/1305/1) looks interesting indeed :)
21:12:29Araqand as far as I can tell professionals trace the running program instead of looking at the assembly :P
21:13:17FromGitter<dandevelop> @Araq sometimes you can't trace the program under a debugger due to anti debugging mechanisms
21:13:34*relax quit (Ping timeout: 264 seconds)
21:14:26Araqhow would that work? if all else fails, I can run it with an x86 emulator
21:15:52FromGitter<dandevelop> @Araq here is a link with more info: http://antukh.com/blog/2015/01/19/malware-techniques-cheat-sheet/
21:16:17Araqah, thanks
21:18:06*nsfw_ joined #nim
21:18:11nsfw_hello
21:18:24nsfw_may I ask somethinh as a complete newbie ?
21:18:33FromGitter<dandevelop> @Araq thank you for being so present in the community!
21:19:13FromGitter<Yardanico> nsfw_
21:19:25FromGitter<Yardanico> Yes, you can
21:20:21FromGitter<Yardanico> Unless you use smuxi irc client :)
21:22:28nsfw_okay: I can't understand about poll, asyncCheck etc etc - imagine you see something like asyncCheck connect(socket,...) and right after it something like socket.send(data) - wouldn't it be possible that send() be called before connect() finished it's work ? I ask because I'm reading Nim in Action
21:22:44nsfw_its* work
21:23:29dom96That's what 'await' is for :)
21:23:33FromGitter<Yardanico> Well if you need to wait for a coroutine, you should use await
21:24:10Araqdandevelop: you're welcome. it looks my "patched x86 emulator" would fare pretty well, avoiding most of the issues listed in your link :-)
21:24:27nsfw_I don't need to: I see that in an example code that's correct but it bothers me
21:24:39nsfw_because of this reasoning
21:25:11FromGitter<dandevelop> @Araq sounds good! Is the emulator available somewhere to try?
21:25:13FromGitter<Yardanico> Well asyncCheck is like running new coroutine independently
21:26:13FromGitter<Yardanico> I'm Python you have stuff like this as well
21:26:25FromGitter<Yardanico> Await as await, and
21:27:40Araqbochs and qemu come to mind, I don't understand
21:27:58Araqboth open source, you can patch them for your cracker purposes
21:28:14FromGitter<Yardanico> ensure_future as asyncCheck
21:28:19Araqwhen I said "my patched x86 emulator" I was only talking about an idea
21:28:36nsfw_but I can't see how it's different from a thread either (in brief I'm lost)
21:28:41FromGitter<dandevelop> @Araq oh, I thought you were talking about an existing project. my bad
21:29:45FromGitter<Yardanico> nsfw_: well you should read about async programming in general
21:30:32nsfw_Yardanico: do you know good resources ?
21:31:34*PMunch quit (Quit: leaving)
21:31:43FromGitter<Yardanico> Sadly I don't :( because firstly I leaned async in python (by trial and error lol)
21:32:21nsfw_I'm prcticing Python too so I will throw an eye
21:32:37FromGitter<dandevelop> @Araq any pointers for the function I should start with in compiler/ccgtypes.nim ?
21:33:29AraqgenTypeInfo iirc
21:33:41FromGitter<dandevelop> @Araq thanks!
21:33:42dom96nsfw_: which part is confusing you?
21:34:41dom96the book has a table that explains the difference between 'asyncCheck' and 'await'
21:34:49nsfw_I know
21:35:37dom96I'm the author, I'd be happy to help
21:36:12nsfw_This isn't what bothers me: it's just that I can't understand how poll, await and asyncCheck work together
21:36:16nsfw_oh thanks
21:36:32nsfw_in listing 3.36:
21:36:49dom96Is the table not giving a sufficient explanation? :(
21:37:41nsfw_nope cause it tells what there being used for but not what it does (at least in myview as a beginner in Nim)
21:38:26nsfw_also I don't know anything about async programming maybe I should read about this before as suggested by Yardanico?
21:39:25dom96That might make things clearer, if you want to do then go ahead.
21:39:32dom96But if you're still stuck then let us know :)
21:39:39dom96*to do that
21:40:49nsfw_the fact is that there is a asyncCheck connect(socket,...) directly followed by asyncCheck socket.send(...) and I wonder if it could be possible for the second asyncCheck to be run before the previous one completes (or does it have to do with the behaviour of soket.send which would wait for a connecton ?)
21:41:09dom96in listng 3.36?
21:41:13dom96*listing
21:41:15nsfw_3.26*
21:41:29nsfw_sorry - page 98
21:41:32*couven92 joined #nim
21:42:20dom96ahh yes.
21:42:26dom96You are in fact correct. :)
21:42:55dom96It's a bit of a bug with my implementation I suppose. But this can only happen if you start sending messages immediately.
21:43:41dom96Sorry that it's confusing :\
21:44:02nsfw_anyway I understand it better now - thanks !
21:45:01dom96No problem :)
21:46:25dom96I will create a FAQ on the wiki here: https://github.com/dom96/nim-in-action-code/wiki
21:46:30dom96And add this as one of the questions :)
21:48:27nsfw_and so the connect proedure is fully executed in the background ? or is it executed in the main thread and the 'rest' of the prgram is executed when connect is paused by await ?
21:48:42nsfw_oh cool
21:49:20FromGitter<Yardanico> dom96: a side note - Wikipedia stopped creating new versions of pagecount archives for some reason
21:49:34dom96That's fine.
21:49:47dom96As long as the old ones are there :)
21:49:58dom96I should probably keep a backup of them though
21:50:24dom96nsfw_: It's executed when the event loop is `poll`-ed
21:50:51FromGitter<Yardanico> dom96: don't worry, they are
21:50:51dom96Which actually only happens here: https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L54
21:51:03FromGitter<Yardanico> https://lists.wikimedia.org/pipermail/analytics/2016-August/005339.html
21:51:19dom96So if you type really fast, or pipe data into the process it may fail
21:52:02*enthus1ast- joined #nim
21:52:57nsfw_okay thank you !
21:54:26nsfw_so it could be solved by placing another call to poll just before while true: ?
21:55:08FromGitter<Yardanico> Ah, it seems they replaced these files with web
21:55:13FromGitter<Yardanico> API
21:55:39dom96https://github.com/dom96/nim-in-action-code/wiki/FAQ#confusing-use-of-asynccheck-in-listing-326
21:56:03dom96My FAQ entry explains the best solution
21:56:13dom96A single `poll` doesn't guarantee that the connection will be completed
21:58:23nsfw_thanks it's understood
21:59:30dom96Awesome, let me know if you have any other questions :)
22:01:46*nsfw_ is now known as nsfw
22:01:58*nsfw is now known as nsfw_
22:06:47*nsfw_ quit (Quit: Leaving.)
22:07:43FromGitter<Varriount> Anyone done any research on the best time to submit something to Hacker News?
22:08:03dom96I've seen many articles about that
22:09:04*nsfw_ joined #nim
22:09:21*enthus1ast- quit (Ping timeout: 240 seconds)
22:11:40*enthus1ast- joined #nim
22:12:27nsfw_dom96: forgot to ask: and we are sure that connect and send will be processed by poll in order in which we want them to be ?
22:14:02dom96not necessarily
22:14:13dom96But like I said, you're not sending things immediately.
22:14:21dom96So it's only the `connect` call that is pending
22:14:59dom96If you're writing it properly though, you should likely use `await`.
22:15:48dom96oh wait
22:15:53dom96I missed something.
22:16:07dom96`connect` is actually defined above
22:16:33dom96You need `asyncCheck` for this case
22:16:47dom96Because the `connect` procedure includes a loop that reads the messages from the socket
22:16:51dom96So it never completes
22:21:25dom96So in order to really fix this you would need to separate the while loop into a separate procedure
22:21:29dom96and call it with asyncCheck
22:29:42nsfw_lurking in the doc and I see that asyncCheck takes a Future[T] as argument: so connect(_,_) is bel et bien executed - do poll trigger the execution of await'ed procedures instead ? - like this: the execution stop after echo("Connecting to"...) and is resumed by poll at the next line
22:32:38dom96yep
22:32:43dom96the execution stops at await
22:33:13dom96unless `await connect` connects immediately, which can happen
22:33:23nsfw_thaaaaaaaanks! I have the big picture
22:33:51nsfw_immediatly ? how is that possible
22:36:28loc8Also, why do Nim programmers love to make operators so much? Why not `json.serialize({...})` instead of `%*{...}`?
22:36:59loc8It's much more readable and less confusing. It's also easier to avoid conflicts
22:39:06Araq"serialize" is the wrong name for it
22:40:45*mahmudov joined #nim
22:41:11Araq%* applies % "deeply" and % is 'toJsonNode', in retrospect we could have used that, but *shrug*, common things deserve shortcuts
22:43:10loc8I believe they deserve readable shortcuts, though
22:43:32loc8Some things should be understandable without having the need to search in the docs
22:44:59Araq"toJson" is more common than "modulo" in many applications...
22:48:28*nsf quit (Quit: WeeChat 1.9)
22:48:45*loc8_ joined #nim
22:51:06*loc8 quit (Ping timeout: 252 seconds)
22:53:35*enthus1ast- quit (Ping timeout: 240 seconds)
22:55:28*vendethiel- quit (Ping timeout: 240 seconds)
22:57:17dom96There is a good reason why %* is used IMO
22:57:25dom96It stems from the reason that `%` was chosen
22:57:57dom96You don't want to have to write toJsonNode{"field": toJsonNode(5), "field2": toJsonNode(4.5)}
22:57:58dom96Do you ?
22:58:08dom96So `%` was used
22:58:14dom96and then `%*` is only natural
23:00:31*enthus1ast- joined #nim
23:01:22*rauss joined #nim
23:02:42FromGitter<ephja> it won't be that verbose if you have another name for the macro
23:02:45*Matthias247 quit (Read error: Connection reset by peer)
23:03:08FromGitter<ephja> isn't it only the prefix that needs to be changed?
23:03:22*gangstacat joined #nim
23:07:56FromGitter<barcharcraz> Wrote the first nim code that'll be used at my job today!
23:10:06dom96:D
23:12:29FromGitter<barcharcraz> It's actually amazing how productive nim is even when I'm pretty much just calling out to C
23:21:14*nsfw_ left #nim (#nim)
23:25:05*loc8_ quit (Ping timeout: 240 seconds)
23:25:24FromGitter<FridgeSeal> Same: I'm attempting to re-write some python lambda functions in Nim, it's going well so far (admittedly my functions are pretty simple)
23:26:04*loc8_ joined #nim
23:27:59*couven92 quit (Read error: Connection reset by peer)
23:30:14*rauss quit (Quit: WeeChat 1.9)
23:35:13loc8_It does make sense, yes
23:35:20loc8_It feels a bit weird though
23:35:34loc8_Same thing with `marshal` using `$$` for their serializing procedure
23:36:22*sz0 joined #nim
23:38:20Demos[m]Side note: my code for work is actually hard real time
23:39:02*fridgeseal joined #nim
23:39:17Demos[m]Well sorta. It's controlling cameras that must be synchronized to like the nanosecond
23:59:27*Sentreen quit (Ping timeout: 248 seconds)