<< 25-12-2019 >>

00:02:47FromDiscord<slymilano> Built my own library today, still unpublished because I'm fixing some issues with the tests and floating points. Would love some help getting the tests to pass this is probably a trivial project for a Nim intermediate programmer haha https://github.com/sergiotapia/filesize
00:05:22*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:12:27*couven92 joined #nim
00:16:26*couven92 quit (Ping timeout: 240 seconds)
00:29:49*seerix quit (Quit: Leaving)
00:33:37FromDiscord<treeform> Araq gave me a Christmas present: https://forum.nim-lang.org/t/5734
00:36:31Araqyeah. :-)
00:36:39FromDiscord<treeform> Thanks!
00:40:27Araqit's been a pleasure to develop, you're welcome
00:40:37Araqalso thank clyybber for his outstanding contributions
00:41:26Araqand cooldome too
00:53:38*ng0 quit (Ping timeout: 240 seconds)
00:56:29*ng0 joined #nim
00:56:46*ng0 quit (Client Quit)
00:56:58*ng0 joined #nim
00:56:58*ng0 quit (Changing host)
00:56:58*ng0 joined #nim
00:58:13*drewr quit (Ping timeout: 245 seconds)
01:00:44*ng0 quit (Client Quit)
01:05:48FromDiscord<slymilano> Thanks Araq and merry Christmas!!!
01:10:14*uu91 quit (Remote host closed the connection)
01:15:11*akitoshi joined #nim
01:16:50FromDiscord<Milerius> A Friend will submit nim to Godbolt pull request tomorrow
01:16:54FromDiscord<Milerius> @araq
01:17:10FromDiscord<Milerius> https://godbolt.org/
01:19:51*Tyresc quit (Quit: WeeChat 2.7-dev)
01:26:59*dwdv quit (Ping timeout: 265 seconds)
01:50:18FromGitter<gogolxdong> Do we exlicitly specify --gc:arc to enable ?
01:50:38FromGitter<zacharycarter> I like the cobblestones here -
01:50:43FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/b8KV/image.png)
01:50:45FromGitter<zacharycarter> but the dark corners of the terrain look like crap
01:51:00FromGitter<zacharycarter> and I don't like the grass texture either
01:51:23FromGitter<zacharycarter> or the forest floor one
01:52:13FromGitter<Albus70007> Hello guys, I can see this chat is a bit more active than other Nim related ones right?
01:53:20FromGitter<gogolxdong> What's the default gc now?
01:53:43FromDiscord<snluu> I've had a lot of fun working on some personal projects using Nim. It makes programming a lot more enjoyable. Thanks all the language contributors and people on this channel that have been so helpful so far. Merry Christmas (if that's your thing) and happy holidays!
01:54:44FromDiscord<snluu> Hoping I can master the language more and contribute back in 2020!
01:55:15FromDiscord<Rika> gogolxdong, still the old gc
01:56:01FromGitter<gogolxdong> Does the old gc mean boehm?
01:56:53zedeusno, refc, deferred reference counting
01:56:55*azed quit (Read error: Connection reset by peer)
01:57:15FromGitter<gogolxdong> ah, thanks!
01:58:51FromGitter<gogolxdong> Merry christmas to you all!
02:00:28zedeusmerry christmas :)
02:01:38*luis_ joined #nim
02:17:39*luis_ quit (Quit: luis_)
02:30:06*luis_ joined #nim
02:39:53*luis_ quit (Ping timeout: 245 seconds)
03:14:22*muffindrake quit (Ping timeout: 260 seconds)
03:16:36*muffindrake joined #nim
03:17:18*endragor joined #nim
03:51:59*gangstacat quit (Remote host closed the connection)
03:56:31*gangstacat joined #nim
04:04:01*zedeus quit (Quit: WeeChat 2.6)
04:08:00*zedeus joined #nim
04:17:13FromDiscord<Rika> is it recommended to cast a seq[char] into a string?
04:35:23*dddddd quit (Remote host closed the connection)
04:48:30*akitoshi quit (Quit: Connection closed for inactivity)
04:50:02*chemist69 quit (Ping timeout: 260 seconds)
04:51:55*chemist69 joined #nim
04:55:23skrylar[m]probably not
05:07:11FromDiscord<snluu> I assume that's due to ut8-8 stuff?
05:07:22FromDiscord<snluu> utf-8
05:24:03FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/S0An/image.png)
05:29:40zedeusit has a subtle realism to it, looks really nice
05:32:10FromGitter<zacharycarter> thanks
05:32:56FromGitter<zacharycarter> ideally I find a way to get rid of the black triangles with no light
05:32:58FromGitter<zacharycarter> those are an eye sore
05:36:07FromDiscord<Rika> what does it mean when the compiler complains that i cannot capture a var T in an async proc? what does capture mean in this sense?
05:40:08FromDiscord<Rika> disregard that, im just dumb
05:45:28*uu91 joined #nim
06:19:40*seerix joined #nim
07:04:55*seerix quit (Remote host closed the connection)
07:05:51*gour joined #nim
07:35:55*solitudesf joined #nim
07:41:12FromDiscord<mfiano> For the newbies out there (read: me) that are following along for bits of knowledge, it'd be nice to know - dumb is relative 🙂
07:56:03FromDiscord<Milerius> Hey
07:56:35FromDiscord<Milerius> Is it possible from an `array[100, char]` to retrieve a c `char* buf` ?
07:57:02FromDiscord<Milerius> I would like to pass my nim buffer data to a c function
07:57:06FromDiscord<Milerius> That take a char* buff.
07:58:54FromDiscord<Solitude> `addr array[0]`
07:58:55FromDiscord<Milerius> addr myarray[0] ?
07:58:58FromDiscord<Milerius> yeah i guess.
07:59:05FromDiscord<Milerius> Thanks
08:00:00*gmpreussner quit (Quit: kthxbye)
08:01:28FromDiscord<Milerius> And same question to have the equivalent of `toSeq` but for array ?
08:01:48FromDiscord<Milerius> array = nimString.toArray() ?
08:04:50*gmpreussner joined #nim
08:12:07*ng0 joined #nim
08:12:07*ng0 quit (Changing host)
08:12:07*ng0 joined #nim
08:12:14*ng0 quit (Client Quit)
08:12:29*ng0 joined #nim
08:20:18solitudesfyou could write a macro for static strings
08:35:27*NimBot joined #nim
09:03:48FromDiscord<Stuffe> Does anyone have experience with the "Marshall" module? I am trying to store Nim objects in a database but I am unsure what the pointers in the object do
09:04:35FromDiscord<Stuffe> If it is only for detecting reference cycles or if it really loads the objects to those places in memory
09:05:10FromDiscord<Stuffe> (Tried using Json, but get an error about reference cycles not being supported, even though I don't have those)
09:16:47*Vladar joined #nim
09:36:07*ng0 quit (Quit: leaving)
09:42:04*Trustable joined #nim
09:43:04*ng0 joined #nim
09:43:10*ng0 quit (Client Quit)
09:43:22*nsf joined #nim
09:43:23*ng0 joined #nim
09:43:23*ng0 quit (Changing host)
09:43:23*ng0 joined #nim
09:44:37*chemist69 quit (Ping timeout: 260 seconds)
09:45:09*chemist69 joined #nim
09:51:20*seerix joined #nim
10:00:51*dwdv joined #nim
10:19:13AraqStuffe: marshal.nim translates 'refs' into IDs
10:19:37Araqyou can store it in database I guess
10:26:29FromDiscord<mfiano> I just want to thank Araq and the rest of the Nim contributors for a language that finally appeals to me that is not Lisp, after trying dozens in the last 20 years. This is going to be a fun ride. Thank you, and happy holidays!
10:28:51*luis_ joined #nim
10:31:11*luis_ quit (Client Quit)
10:31:37*luis_ joined #nim
10:38:16*Jjp137 quit (Ping timeout: 258 seconds)
10:43:27Araqmfiano: thank you!
10:43:49luis_Hi everyone, I have been facing a problem trying to fetch some links from a website. Perhaps someone could take a look? The error I am getting is
10:44:01luis_https://i.imgur.com/l1swA3M.png
10:44:04luis_xmltree.nim(688, 10) `n.k == xnElement`
10:44:25luis_my code looks like:
10:44:34luis_https://i.imgur.com/yIfadT8.png
10:44:47luis_And the raw website is https://gist.github.com/a607b23ddfb7782fd451943301202f7c
10:49:51Araqluis_: please report it on github
10:50:20Araqand be aware that the HTML's future lies in a Nimble package, crazy to have that in the stdlib...
10:50:26Araqer
10:50:33AraqI mean, the HTML parser's future
10:51:00*Araq has code improvements for it lying around
10:53:56luis_Araq: is it really a bug? I thought I was doing something wrong.... thanks
11:23:16federico3an alternative syntax for {. .} pragmas would be nice. Something whitespace sensitive that allows writing pragmas in a dedicated line
11:28:03FromGitter<mratsim> there’s a RFC for this
11:31:47FromGitter<mratsim> see: https://github.com/nim-lang/rfcs/issues/15
11:31:47disbotPragma syntax
11:32:15federico3oh thanks
11:36:36*luis_ quit (Ping timeout: 248 seconds)
11:37:03*chenhq2005 joined #nim
12:05:46*luis_ joined #nim
12:07:58*chenhq2005 quit (Ping timeout: 258 seconds)
12:11:28*nh41 joined #nim
12:19:33*NimBot joined #nim
12:26:01*couven92 joined #nim
12:32:36FromDiscord<Milerius> hey
12:32:50FromDiscord<Milerius> what is the most idiomatic way to clear an array of char in nim ?
12:33:46FromDiscord<Milerius> (looking for the .clear() equivalent from c++)
12:33:48solitudesfreset array
12:34:10FromDiscord<Milerius> my_var.reset() ?
12:34:17solitudesfyes
12:34:30FromDiscord<Milerius> Cool !
12:34:31FromDiscord<Milerius> Thanks
12:34:59*gour left #nim ("Leaving")
12:41:57*luis_ quit (Ping timeout: 260 seconds)
12:55:10FromGitter<zetashift> Isn't it a little bit too late to change pragma syntax?
12:55:48federico3to change it: yes. To add an additional syntax: probably not :)
12:55:52FromGitter<zetashift> And adding another way wouldn't that be even more ways to do stuff in Nim? Might make it more confusing
12:57:48FromGitter<zetashift> I'm not a fan of the pragma syntax either but adding this now isn
12:59:06FromGitter<mratsim> I don’t think so, when you start having {.gcsafe, inline, ….} it gets unwieldy
13:00:51*chenhq2005 joined #nim
13:01:03FromDiscord<Rika> I think it's less unwieldy than the other solutions proposed in the rfc
13:03:50FromGitter<zetashift> I like this one: https://github.com/nim-lang/rfcs/issues/15#issuecomment-568890071 looks clean and whitespace-y
13:03:50disbotPragma syntax
13:05:53FromDiscord<Milerius> I send a cchar array as a pointer to a C Function which represents my user data, inside my callback i have to cast back the pointer to the array of char, but idk why when i do it i retrieve an empty array, or i lost my buffer
13:07:02FromDiscord<Milerius> i tried: `var str = cast[cstring](data.userData)` userData is a var buff = array[256, cchar] buff[0].addr
13:07:02FromDiscord<Milerius>
13:07:03FromDiscord<Milerius> Is not valid to do that ?
13:08:06*nh41 quit (Remote host closed the connection)
13:10:37FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/ySGL/image.png)
13:10:38FromGitter<zacharycarter> Araq: what do you think of this? starting to look any better?
13:11:25FromGitter<zetashift> I
13:11:47FromGitter<zetashift> I'm not araq but I like it
13:11:55FromGitter<zetashift> It's kinda dark though?
13:13:24FromGitter<zacharycarter> well thanks either way :P
13:13:34FromGitter<zacharycarter> I don't have any directional light in there yet so that's why it looks really dark
13:13:39FromGitter<zacharycarter> just one really really powerful point light :P
13:18:00federico3I o
13:18:07federico3I don't get this comment https://github.com/nim-lang/rfcs/issues/15#issuecomment-568898287
13:18:07disbotPragma syntax
13:22:21FromGitter<zetashift> @lqdev friendly ping, cause I don't get it completely either
13:25:27*Trustable quit (Remote host closed the connection)
13:30:08FromGitter<deech> While we're discussing pragmas I re-iterate my proposal that `{.compileTime.}` should go away and be replaced with, eg `static proc f(...)...` and `static let x = ...`.
13:30:10federico3(if you ask me I would even have proc arguments on independent lines)
13:31:19federico3isn't "static let" equivalent to "const"?
13:32:51FromGitter<deech> No, it's like `let x {.compileTime.} = ...`.
13:34:30federico3I mean: isn't `let x {.compileTime.} = ...` equivalent to `const x = foo(...)` ?
13:35:47FromGitter<deech> I don't *think* so? `const x` means `x` is available at runtime and baked into the resulting binary/library, `let x {.compileTime.} = ...` is compile time only.
13:37:14FromGitter<deech> AFAIK it's like: ⏎ ⏎ ```static: ⏎ let x = ...``` ⏎ ⏎ except `x` is available outside the scope of the `static` block. [https://gitter.im/nim-lang/Nim?at=5e03660a090f1379684babaa]
13:42:23FromGitter<mratsim> Now compile-time var are accessible at runtime
13:42:55FromGitter<mratsim> It's pretty new though so there are some bugs
13:48:07FromGitter<deech> Oh no! Why? Isn't that what const is for?
13:53:50*uu91 quit (Remote host closed the connection)
13:57:24*chenhq2005 quit (Read error: Connection reset by peer)
14:01:50*endragor quit (Remote host closed the connection)
14:02:19AraqI rushed it for 1.0, it seemed to fix more problems than cause
14:02:33Araqnow it looks like it causes more trouble than it fixes
14:02:40Araq:-(
14:05:38*uu91 joined #nim
14:22:29FromDiscord<Rika> Rip
14:25:15FromDiscord<Milerius> Is it possible to convert an nim string to a fixed array ?
14:25:30FromDiscord<Milerius> in C++ i will do strncpy or smth similar
14:26:57FromGitter<deech> I just tested this in 1.0.4 and a compile time string does indeed show up in the binary. :(
14:28:13FromGitter<deech> What problems does this fix?
14:30:58FromGitter<deech> There's some odd semantics as well, this currently echoes `1`: ⏎ ⏎ ```var x {.compileTime.} = 1 ⏎ inc x ⏎ echo x``` [https://gitter.im/nim-lang/Nim?at=5e0372a2b1701e50ca8407c3]
14:33:57*freddy92 joined #nim
14:35:11FromGitter<mratsim> I agree, we should remove that
14:36:33*couven92 quit (Ping timeout: 260 seconds)
14:38:02FromGitter<mratsim> Even where I would want runtime access to compile-time var I *need* to statically reassign them: https://github.com/status-im/nim-beacon-chain/blob/148527c71664d00c6c7ad286d98f1cef3b6a7c9b/nbench/bench_lab.nim#L55
14:39:33*couven92 joined #nim
14:39:48*couven92 quit (Remote host closed the connection)
14:40:18*couven92 joined #nim
14:42:58*freddy92 quit (Ping timeout: 260 seconds)
14:53:01*dddddd joined #nim
14:56:48FromGitter<deech> Does this import all of `myModule` or just x,y,z? ⏎ ⏎ ```from myModule import x,y,z ⏎ import myModule ⏎ ...``` [https://gitter.im/nim-lang/Nim?at=5e0378af8dfce538b5089c6c]
15:00:25Araqall of it, I think
15:01:05FromDiscord<Rika> It should do all, at least that's what my logic thinks
15:05:27*ng0_ joined #nim
15:06:32*uu91 quit (Remote host closed the connection)
15:09:05*ng0 quit (Ping timeout: 268 seconds)
15:14:29*ng0_ quit (Quit: Reconnecting)
15:14:45*ng0 joined #nim
15:16:48*couven92 quit (Ping timeout: 260 seconds)
15:38:17*Hideki_ joined #nim
15:41:47*ng0 quit (Quit: leaving)
15:42:54*ng0 joined #nim
15:45:39*ng0 quit (Client Quit)
15:45:55*ng0 joined #nim
15:45:55*ng0 quit (Changing host)
15:45:55*ng0 joined #nim
15:49:47*ng0 quit (Client Quit)
15:50:03*ng0 joined #nim
15:50:03*ng0 quit (Changing host)
15:50:03*ng0 joined #nim
15:51:40*ng0 quit (Client Quit)
15:51:54*ng0 joined #nim
15:56:35*endragor joined #nim
16:05:01*endragor quit (Remote host closed the connection)
16:05:46*endragor joined #nim
16:11:08FromDiscord<snluu> hi all! is there a doc somewhere that i can read more indepth about the asyncdispatch module? A few questions on top of my head, for example:
16:11:08FromDiscord<snluu> 1. Does the default global dispatcher use multiple threads (if so, from threadpool?) or just one single thread?
16:11:08FromDiscord<snluu> 2. I see that we have the ability to create a new dispatcher. I assume that means I can throw it into a new thread and just have it loop forever? If so, what is the pragmatic way to schedule work on that specific dispatcher?
16:11:08FromDiscord<snluu> 3. What goes into the “global dispatcher”? Like, when does work get scheduled in there implicitly?
16:16:04*endragor quit (Remote host closed the connection)
16:33:25*endragor joined #nim
17:05:27*Hideki_ quit (Remote host closed the connection)
17:06:08*Hideki_ joined #nim
17:11:11*Hideki_ quit (Ping timeout: 268 seconds)
17:12:25FromDiscord<Rika> Single thread afaik
17:12:44*endragor quit (Remote host closed the connection)
17:12:50FromDiscord<Rika> Other questions dunno, though I don't see why you'd need async with threading
17:17:55*endragor joined #nim
17:34:17*Vladar quit (Quit: Leaving)
17:39:55*Hideki_ joined #nim
17:58:34FromDiscord<snluu> So that doing IO doesn't block one of the (optimal) 4 threads, for example
18:00:36FromDiscord<snluu> Or put it another way, let's say I have the max 256 threads. If each request is IO heavy and they do IO synchronously (aka blocking) then I can only serve max 256 concurrent requests
18:01:24*Hideki_ quit (Ping timeout: 258 seconds)
18:04:50solitudesfaraq, any reason why this haven't been merged? its just a bugfix + example. https://github.com/nim-lang/x11/pull/31
18:04:51disbotMake MIT-SHM bindings link with libXext instead of libX11
18:41:39YardanicoIs `tuple` a valid type to be specified in a proc? Does it get converted to some generic tuple automagically or what?
18:42:14Yardanicothe thing is that a Nim newbie tried this out (in telegram) and it worked https://play.nim-lang.org/#ix=25tm
18:42:31FromDiscord<mars> hey everyone
18:42:35FromDiscord<mars> can I ask newb questions here?
18:42:35Yardanicoso I'm not sure if this is a bug or an intended feature
18:42:59Yardanico@mars yeah, go ahead, but don't forget to paste big amounts of code (>3 lines) on paste services :)
18:43:03Yardanicoor on play.nim-lang.org
18:43:09lqdev[m]@Yardanico it's intended, you can use fieldPairs on it
18:43:17lqdev[m]@mars don't ask to ask
18:43:24Yardanicooh, ok, didn't know that, and didn't see it mentioned anywhere
18:43:59lqdev[m]it's an implicit generic
18:44:01FromDiscord<mars> https://play.nim-lang.org/#ix=25tm
18:44:17FromDiscord<mars> I'm not sure how to use map correctly in nim
18:44:23YardanicoYou mean Table?
18:44:35FromGitter<deech> Yardanico, wow.
18:44:57Yardanico@mars simplest example https://play.nim-lang.org/#ix=25to
18:45:01FromGitter<deech> lqdev, what does implicit generic mean and is that documented?
18:45:23lqdev[m]@deech I think it's documented somewhere let me take a look
18:45:42Yardanicohttps://nim-lang.org/docs/manual.html#generics-type-classes
18:45:44FromDiscord<mars> Thanks Yardanico, that looks like a dictionary/hashmap, I'm looking at the "map" function like mapping a seq
18:45:44lqdev[m]but basically it declares a generic param `T: tuple` implicitly
18:45:58Yardanico@mars ah, that's in sequtils - mapIt
18:46:04FromDiscord<mars> ah okay thank you
18:46:16Yardanico!eval import sequtils; echo @[1, 2, 3, 4, 5].mapIt(it + 1)
18:46:19NimBot@[2, 3, 4, 5, 6]
18:47:04FromDiscord<mars> great example
18:47:06FromDiscord<mars> thank you
18:48:53FromGitter<deech> Yardanico, thanks!
18:51:22FromDiscord<mars> .mapIt($(&",\t{it}")
18:51:26FromDiscord<mars> exactly what I was looking for
18:55:42Zevvlooks like perl
18:58:42lqdev[m]@mars that extra $ is redundant, & already returns a string
19:00:17federico3urgh
19:14:31*fanta1 joined #nim
19:16:17*azed joined #nim
19:26:04*Hideki_ joined #nim
19:27:28Yardanico@mars uhh, did you want to add \t to every element? What about "join"?
19:31:10*Hideki_ quit (Ping timeout: 268 seconds)
19:38:19*nsf quit (Quit: WeeChat 2.6)
19:58:46*Hideki_ joined #nim
19:59:21*fanta1 quit (Quit: fanta1)
20:02:50*Hideki_ quit (Ping timeout: 240 seconds)
20:21:03disruptekalso not a fan of the compile-time var change, for whatever that's worth.
20:21:50disruptekhope everyone is enjoying the holiday and writing lots of strange arc tests. 😁
20:22:17Zevvwhy not? compile time vars spilling over to runtime is something you would expect to "just work"
20:22:36disruptekthen they arent compile-time, right?
20:22:55disruptekthey are all-time or long-time or any-time.
20:23:01Zevvyes, but thinning the lines between compile time and run time is where the power comes in
20:23:50disruptekthat's a semantic we already have, isnt it?
20:24:03Zevvand I'm pretty impressed this works at all
20:24:07disruptekokay, thumbs and proper apostrophes do not mix. forgive me.
20:24:58disruptekwhat is this mysteriously powerful example enabled by the change?
20:25:12disrupteki never understood.
20:26:20Zevvgot me there
20:26:38ZevvI do know that I run into this a few times when it didn't work and sat there scratching my head
20:26:46Zevvbut in the end always find a way around
20:28:07disruptekso it didnt need to change.
20:28:13disrupteksay it with me.
20:28:28Zevvotoh: what is so *bad* about it then?
20:28:56disruptekits unexpected, for one thing. hard to reason about.
20:29:33Zevvyou have a point there
20:29:34FromGitter<Varriount> @Zevv: Great work on NPeg!
20:29:43Zevvthanks!
20:30:20ZevvI was pleasantly surprised by how easy it was to fit in, in the end
20:30:22disruptekone small step for a man, one giant leap for nimkind.
20:30:41Zevvwe'll see - first I want to see someone actually use it
20:30:53disruptekthe holiday is full of gifts.
20:31:06FromGitter<Varriount> Zevv: If I remember, I'll update Commandant to use the new features
20:32:26*azed quit (Ping timeout: 258 seconds)
20:32:43FromGitter<Varriount> Although, I'm wondering whether I should introduce precedence for command operators (&&, ||, and ;)
20:33:42FromGitter<Varriount> Then I would be able to take advantage of the precedence operators NPeg offers
20:34:42*azed joined #nim
20:35:39FromGitter<Varriount> Any thoughts on streams?
20:35:55Zevvdude
20:36:19Zevvi just gave you this terrific new feature!
20:36:21Zevv:)
20:36:37Zevvbut, sorry, no...
20:37:01FromGitter<Varriount> Ah, I'm sorry if I offended you.
20:37:22Zevvyeah I'm easy to offend, ask disruptek!
20:37:25Zevv:)
20:37:38Zevvno, joking aside, streams is harder then I expected.
20:37:55ZevvI have this vague notion of how it could work, but I'm having a terrible time putting it into code
20:38:03disruptekzevv has very soft hands, so it works out.
20:38:58ZevvIm also not sure how important it would be in practice to support streaming
20:39:50ZevvI can see there are cases where it would be *handy* to have it, but never essential
20:40:50Zevvmemfiles on 64 bit allow you to parse any file you could possible want to parse, so I guess we're talking network protocol streams then
20:41:07Zevvparsing pipes would be cool, though.
20:41:14disruptekit would be cheaper to just document a good pattern for stream parsing using existing npeg.
20:41:28Zevv"it depends"
20:42:00Zevvin some cases you might get away with splitLines() and then parse each line
20:42:31disrupteki was thinking just a debounce...
20:43:48Zevvthe parser part is already nearly completely resumable, so it would be trivial to resume parsing be calling match() on an existing parser. As long as captures dont spill over match() boundaries I guess it already works
20:44:18Zevvthe problem is that captures might want to refer to data in the past, and who is then responsible for keeping this data around?
20:47:16disruptekmaybe the user can mark a boundary during parsing, or indicate that a token signifies a boundary.
20:49:02Zevvor just make sure you dont try to access data in captures that is not there, and allow npeg to throw when that happens
20:49:15Zevv"trust me i know what im doing"
20:49:47ZevvIf I can avoid adding api complexity I would prefer that
20:50:00Zevvand I feel 99% of the times resuming or streams are not needed
20:50:46Zevvit would also simplify the implementation: I just need to keep track of the parse FSM state, but all the buffers and offsets can start over every round
20:51:20Zevvno complicated logic for keeping track of absolute and relative offsets and keeping track of buffers
20:51:53Zevvbut it will limit the use, because you can not just feed arbritary sized blocks
20:52:21Zevvthe magic tokens is what lexbase does - typically newlines will refeed the buffers
20:52:36Zevvwhich is ok for a lexer, since you are not likely to lex a single token over newlines
20:53:15FromGitter<Varriount> I really *am* impressed with all the work you've done.
20:54:06FromGitter<Varriount> I was asking more out of curiosity, since I've been trying to think of a good way to implement it as well
20:55:12Zevvi gave it a few tries, but i was always put off by the complexity it pulls in
20:55:33Zevvwhich might not be worth it for these few use cases
20:56:38Zevvi alwas *love* when I find a new feature just fitting into place as if it was designed there from the start, like with templates or libraries or generics parsing.
20:58:48disruptekits not usually accidental, but a side-effect of proper design decisions that precede the development.
21:02:44Zevvyeah Im just that good
21:05:52Zevv(deafening silence)
21:06:32disrupteki think so.
21:09:09Zevvha! :)
21:09:42Zevvanyway varriount, Id love to discuss this further one time
21:09:44*azed quit (Quit: WeeChat 2.7)
21:10:58Zevvlateral thinking works best while discussing
21:11:00Zevvfor me
21:21:39*nsf joined #nim
21:42:29Araqlexbase is unbeatable :P
21:51:53FromDiscord<snluu> hi all! is there a doc somewhere that i can read more indepth about the asyncdispatch module? A few questions on top of my head, for example:
21:51:53FromDiscord<snluu> 1. Does the default global dispatcher use multiple threads (if so, from threadpool?) or just one single thread?
21:51:54FromDiscord<snluu> 2. I see that we have the ability to create a new dispatcher. I assume that means I can throw it into a new thread and just have it loop forever? If so, what is the pragmatic way to schedule work on that specific dispatcher?
21:51:54FromDiscord<snluu> 3. What goes into the “global dispatcher”? Like, when does work get scheduled in there implicitly?
21:52:47FromDiscord<snluu> 4. What would be a use case where someone calls setGlobalDispatcher to replace the one that comes out of the box?
21:56:47Araq1. single thread.
21:58:18Araq2. I never tried to use a "different dispatcher" and I consider it misguided.
21:58:39Araq3. async tasks go into the dispatcher
22:01:05Araq4. use cases are comparable to "what if you want to use a different database? you can simply switch to a different implementation then!"
22:01:23FromDiscord<snluu> Thanks Araq. More on #2, what I have in mind is something like a web server backed with multiple threads, each thread having its own dispatcher. As requests come in, one of those threads will handle the request.
22:01:24disbothttps://github.com/nim-lang/Nim/issues/2 -- 5Compiler segfaults ; snippet at 12https://play.nim-lang.org/#ix=22vr
22:01:34Araqhint: I did DB migrations, there is more to it than changing the connection strings...
22:02:16Araqlikewise alternative dispatchers will likely have different dispatching mechanisms so you're in a world of pain/debugging
22:03:07FromDiscord<snluu> That makes sense.
22:04:12Araqhowever, the dispatcher is thread local so you can have multiple dispatchers indeed
22:04:25Araqbut they are all identical
22:04:27FromDiscord<snluu> I guess one of the use cases could be having a dispatcher that wraps around multiple dispatcher underneath and round robin them like I mentioned the usecase for #2?
22:04:29disbothttps://github.com/nim-lang/Nim/issues/2 -- 5Compiler segfaults ; snippet at 12https://play.nim-lang.org/#ix=22vr
22:04:51FromDiscord<snluu> I guess one of the use cases could be having a dispatcher that wraps around multiple dispatchers underneath and round robin them like I mentioned the usecase for #2?
22:04:52disbothttps://github.com/nim-lang/Nim/issues/2 -- 5Compiler segfaults ; snippet at 12https://play.nim-lang.org/#ix=22vr
22:05:52Araqhere is my advice:
22:06:45Araq- use 'async' as it is if you are looking for non-blocking IO
22:07:16Araq- if you want game objects etc, write your own task system, see https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators for an example
22:08:05Araqit works, async is built on top of these "closure iterators" too
22:10:07*casaca quit (Ping timeout: 265 seconds)
22:10:54FromDiscord<mratsim> closure iterators don't work on multiple threads though
22:11:28*nsf quit (Quit: WeeChat 2.6)
22:11:34FromDiscord<snluu> Thank you! I don’t specifically need to have multiple threads backing async. Just wondering what the story is like on there. I come from C++/eventbase where it’s common to throw futures between threads. For example, one thread handling db stuff, and when the db comes back throw the CPU heavy operations to a different event loop (a different dispatcher)
22:11:59*casaca joined #nim
22:12:16FromDiscord<snluu> That does require a shared heap, however.
22:12:52*dddddd quit (Ping timeout: 258 seconds)
22:14:15FromDiscord<mratsim> that's what you should do in Nim as well
22:14:45FromDiscord<mratsim> but you need something for IO (asyncdispaatch) and something for compute (i;e. a threadpool or something like Weave)
22:17:30FromDiscord<snluu> I guess I can just have N threads pull N channels and queue requests into them.
22:17:39Araq--gc:arc gives us a shared heap
22:19:14FromDiscord<mratsim> link to weave btw: https://github.com/mratsim/weave
22:19:32FromDiscord<mratsim> not production ready, but can be played with
22:19:55FromDiscord<snluu> Oooh nice! Let me take a look
22:20:10Araqmratsim: a perfect fit for --gc:arc then ;-)
22:21:02FromDiscord<mratsim> I can try adding gc:arc to my CI
22:21:33FromDiscord<mratsim> so somehow I managed to get a nims file merged (the temporary thing that nimble creates ...)
22:22:20Araqlol
22:23:52*Hotbees quit ()
22:24:04*Hotbees joined #nim
22:24:17FromDiscord<mratsim> mmmh I would need to write some binary tree managed by arc that needs some aprallelization
22:24:37FromDiscord<mratsim> I think I'm gonna play with coroutines this week :p
22:25:35*dddddd joined #nim
22:26:56FromDiscord<snluu> Yeah part of the reason I'm asking is because Crystal just landed a fancy ads multi thread fiber runtime. 😁
22:27:02*solitudesf quit (Ping timeout: 265 seconds)
22:27:45FromDiscord<snluu> Again, I'm sure for all I've planned to use Nim for so far, one thread would suffice. Not even needing async lol
22:28:12FromDiscord<snluu> Just interested in the differences
22:30:24FromDiscord<mratsim> Have a link?
22:31:51FromDiscord<snluu> https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html
22:32:16FromDiscord<snluu> It's an interesting write up about the trade offs and changes they had to make to their language and runtime
22:32:44FromDiscord<mratsim> Oh looks like Crystal is using Boehm
22:32:49FromDiscord<snluu> Ya
22:33:43FromDiscord<snluu> They are more opinionated for sure. For example it's really hard to write code that's heap allocation free.
22:34:42FromDiscord<mratsim> from what I'm reading, there are in the same state as Nim
22:34:49FromDiscord<mratsim> i.e. a basic threadpool
22:35:26FromDiscord<mratsim> they are laying down an API but they didn't tackle the scheduler part
22:36:17FromDiscord<yewpad> They didn't even tackle Windows support ha
22:36:20FromDiscord<yewpad> sorry
22:36:21FromDiscord<snluu> Wait no. They've had fibers (think goroutine) for a while. It was single threaded.
22:36:52FromDiscord<snluu> They model themselves after go lang
22:38:01FromDiscord<mratsim> I'll see if I can test a simple recursive parallel fibonacci 😛
22:38:09FromDiscord<mratsim> apparently everyone chokes on it 😄
22:40:11Araqsnluu: if you know C++ well, Nim 2020 is giving you almost exactly the same building blocks: destructors and move semantics and also move-only types
22:40:23FromDiscord<snluu> 😍😍
22:40:40Araqwith tiny improvements
22:41:05FromDiscord<snluu> Yeah I saw something about "owned ref" in Araq's musing while searching around for some of the questions I had this morning. Very excited for it
22:41:13Araqit's however better hidden from you, I don't expect the users to know that much about it
22:41:38FromDiscord<yewpad> When is --gc:arc fully released?
22:41:45FromDiscord<yewpad> Estimated time
22:41:51FromDiscord<yewpad> Estimated date*
22:43:03Araqgood question, I'm looking for milestones
22:43:28Araqthe old milestone was that it must support "async"
22:43:49FromDiscord<mratsim> If you want to sell Nim to C++ devs, you need to talk about compile-time 😉
22:44:53FromDiscord<snluu> @mratsim if you haven't figured out the parallel fibonacci thing in Crystal, I can give it a stab tonight. Do you have a snippet in nim for it to make sure we are on the same page? Is that the example in your weave repository?
22:45:33FromDiscord<yewpad> @Araq: btw. what's your take on extending the std lib? like adding a whole lotta more convenience stuff. i don't know what that would be but it could something like more string utilities or else. Searching for things to work on in the Nim repository.
22:45:39FromDiscord<mratsim> I have found this repo which says that there are some example in a crystal thread and got lost in the thread: https://github.com/drhuffman12/bench_vs/blob/master/threads/README.md
22:46:10FromDiscord<mratsim> Fibonacci example: https://github.com/mratsim/weave/tree/master/benchmarks/fibonacci
22:46:24FromDiscord<snluu> RE compile time, too fking real.
22:46:49FromDiscord<mratsim> the important part is to do "n < 2", and not "n <= 2" that's a 2x workload difference
22:47:01FromDiscord<mratsim> due to fibonacci spawning tasks exponentially
22:47:04Araqsupporting "async" is super hard though and at the same time the technology works out of the box with GCC's "split stack" or fibers ...
22:47:38FromDiscord<mratsim> split stack? I know segmented stack/cactus stack but I don't know about split stacks
22:47:58Araqhttps://gcc.gnu.org/wiki/SplitStacks
22:48:48FromDiscord<mratsim> ha, interesting
22:49:03FromDiscord<mratsim> does LLVM supports this as well? does it work on ARM?
22:49:13AraqI think so, yes
22:49:49FromDiscord<mratsim> mmm bad feedback: https://news.ycombinator.com/item?id=13871803
22:50:36Araqyeah I've read it
22:51:09*sam647254 joined #nim
22:51:24FromDiscord<mratsim> I think I'll go the fibril way for coroutines + with the stack on the heap allocated by my multithreaded memory pool
22:51:31*sam647254 left #nim (#nim)
22:52:37Araqyewpad: adding stuff to the stdlib is hard these days
22:52:47FromDiscord<yewpad> why>
22:52:49FromDiscord<yewpad> ?
22:52:57Araqeverything we add must be maintained for a long time
22:53:15FromDiscord<yewpad> because of breaking changes like syntax etc.?
22:53:45Araqwe don't change the syntax anymore but again --gc:arc is the perfect example
22:53:47FromDiscord<mratsim> That means that the algorithm must be understandaable and maintainable by more than 1 person
22:53:54FromDiscord<yewpad> well, if you make some thing airtight you don't have to maintain nothing
22:54:10Araqwhen is --gc:arc ready? what parts of the stdlib needs to work with it?
22:54:17FromDiscord<mratsim> even "Tables" had bugs due to the hash functions
22:54:21FromDiscord<yewpad> oof
22:54:38Araqmratsim: not really
22:54:47Araqbut they had performance problems
22:54:55FromDiscord<mratsim> for me it's a bug 😉
22:55:03FromDiscord<yewpad> so --gc:arc will be available in a few months time? like something between 6-12 months?
22:55:04Araqhint: hashing always has them
22:55:09FromDiscord<mratsim> 100x slowdown is problematic
22:55:19FromDiscord<mratsim> it's available now
22:55:39FromDiscord<yewpad> no no no, i mean available in a sense that it does not cause any bugs or crashes
22:55:59FromDiscord<mratsim> 1à years from now? :p
22:56:02FromDiscord<mratsim> 10*
22:56:06FromDiscord<yewpad> oooooof
22:56:08AraqQ1 of 2020
22:56:08FromDiscord<yewpad> welp
22:56:16FromDiscord<yewpad> nice
22:57:28Araqwould I bet all my money on it, today? yes. why? because it works with valgrind
22:57:33FromDiscord<mratsim> @snluu I'l let you have a stab at crystal fibonacci I'm already lost at this syntax lol: https://github.com/drhuffman12/bench_vs/blob/master/threads/crystal/bench.cr#L4
22:58:25FromDiscord<yewpad> this 'return' statement lol
22:58:43Araqso you can write your program, ensure it doesn't trigger codegen bugs and keep growing it
22:59:05Araqthe harder part is when you don't start from scratch :P
22:59:32FromDiscord<snluu> Lol I'll give it a try tonight. Fattening up on Christmas good 😁
22:59:39*Hideki joined #nim
22:59:45*ng0 quit (Quit: leaving)
23:00:03*Hideki is now known as Guest965
23:00:31FromDiscord<snluu> That line is just if n < 2 return n
23:00:45FromDiscord<snluu> They can have question marks in function names
23:01:09FromDiscord<snluu> Lol I'll give it a try tonight. Fattening up on Christmas food 😁
23:01:26Araqtime anomaly detected
23:04:14*Guest965 quit (Ping timeout: 258 seconds)
23:04:29*letto quit (Quit: Konversation terminated!)
23:05:14*letto joined #nim
23:07:54FromDiscord<snluu> @mratsim why do you only spawn for n-1? https://github.com/mratsim/weave/blob/master/benchmarks/fibonacci/stdnim_fib.nim
23:11:56FromGitter<mratsim> So that there is actual work in all tasks
23:12:32FromDiscord<snluu> Oh I see.
23:13:10FromGitter<mratsim> AFAIK the original Cilk benchmark is like that as well
23:15:23FromGitter<mratsim> Note that Nim threadpool in the standard library will quickly choke, for some it's starting from fib 12 and on my PC from fib 16 (it's high end i9-9980XE)
23:16:03FromDiscord<snluu> Well we’ll see what my overpriced Mac mini i7 can do?
23:16:16FromDiscord<snluu> Well we’ll see what my overpriced Mac mini i7 can do 😩
23:37:20*Jjp137 joined #nim
23:50:53*uu91 joined #nim