00:02:47 | FromDiscord | <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:37 | FromDiscord | <treeform> Araq gave me a Christmas present: https://forum.nim-lang.org/t/5734 |
00:36:31 | Araq | yeah. :-) |
00:36:39 | FromDiscord | <treeform> Thanks! |
00:40:27 | Araq | it's been a pleasure to develop, you're welcome |
00:40:37 | Araq | also thank clyybber for his outstanding contributions |
00:41:26 | Araq | and 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:48 | FromDiscord | <slymilano> Thanks Araq and merry Christmas!!! |
01:10:14 | * | uu91 quit (Remote host closed the connection) |
01:15:11 | * | akitoshi joined #nim |
01:16:50 | FromDiscord | <Milerius> A Friend will submit nim to Godbolt pull request tomorrow |
01:16:54 | FromDiscord | <Milerius> @araq |
01:17:10 | FromDiscord | <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:18 | FromGitter | <gogolxdong> Do we exlicitly specify --gc:arc to enable ? |
01:50:38 | FromGitter | <zacharycarter> I like the cobblestones here - |
01:50:43 | FromGitter | <zacharycarter> (https://files.gitter.im/nim-lang/Nim/b8KV/image.png) |
01:50:45 | FromGitter | <zacharycarter> but the dark corners of the terrain look like crap |
01:51:00 | FromGitter | <zacharycarter> and I don't like the grass texture either |
01:51:23 | FromGitter | <zacharycarter> or the forest floor one |
01:52:13 | FromGitter | <Albus70007> Hello guys, I can see this chat is a bit more active than other Nim related ones right? |
01:53:20 | FromGitter | <gogolxdong> What's the default gc now? |
01:53:43 | FromDiscord | <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:44 | FromDiscord | <snluu> Hoping I can master the language more and contribute back in 2020! |
01:55:15 | FromDiscord | <Rika> gogolxdong, still the old gc |
01:56:01 | FromGitter | <gogolxdong> Does the old gc mean boehm? |
01:56:53 | zedeus | no, refc, deferred reference counting |
01:56:55 | * | azed quit (Read error: Connection reset by peer) |
01:57:15 | FromGitter | <gogolxdong> ah, thanks! |
01:58:51 | FromGitter | <gogolxdong> Merry christmas to you all! |
02:00:28 | zedeus | merry 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:13 | FromDiscord | <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:23 | skrylar[m] | probably not |
05:07:11 | FromDiscord | <snluu> I assume that's due to ut8-8 stuff? |
05:07:22 | FromDiscord | <snluu> utf-8 |
05:24:03 | FromGitter | <zacharycarter> (https://files.gitter.im/nim-lang/Nim/S0An/image.png) |
05:29:40 | zedeus | it has a subtle realism to it, looks really nice |
05:32:10 | FromGitter | <zacharycarter> thanks |
05:32:56 | FromGitter | <zacharycarter> ideally I find a way to get rid of the black triangles with no light |
05:32:58 | FromGitter | <zacharycarter> those are an eye sore |
05:36:07 | FromDiscord | <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:08 | FromDiscord | <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:12 | FromDiscord | <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:03 | FromDiscord | <Milerius> Hey |
07:56:35 | FromDiscord | <Milerius> Is it possible from an `array[100, char]` to retrieve a c `char* buf` ? |
07:57:02 | FromDiscord | <Milerius> I would like to pass my nim buffer data to a c function |
07:57:06 | FromDiscord | <Milerius> That take a char* buff. |
07:58:54 | FromDiscord | <Solitude> `addr array[0]` |
07:58:55 | FromDiscord | <Milerius> addr myarray[0] ? |
07:58:58 | FromDiscord | <Milerius> yeah i guess. |
07:59:05 | FromDiscord | <Milerius> Thanks |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:01:28 | FromDiscord | <Milerius> And same question to have the equivalent of `toSeq` but for array ? |
08:01:48 | FromDiscord | <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:18 | solitudesf | you could write a macro for static strings |
08:35:27 | * | NimBot joined #nim |
09:03:48 | FromDiscord | <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:35 | FromDiscord | <Stuffe> If it is only for detecting reference cycles or if it really loads the objects to those places in memory |
09:05:10 | FromDiscord | <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:13 | Araq | Stuffe: marshal.nim translates 'refs' into IDs |
10:19:37 | Araq | you can store it in database I guess |
10:26:29 | FromDiscord | <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:27 | Araq | mfiano: thank you! |
10:43:49 | luis_ | 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:01 | luis_ | https://i.imgur.com/l1swA3M.png |
10:44:04 | luis_ | xmltree.nim(688, 10) `n.k == xnElement` |
10:44:25 | luis_ | my code looks like: |
10:44:34 | luis_ | https://i.imgur.com/yIfadT8.png |
10:44:47 | luis_ | And the raw website is https://gist.github.com/a607b23ddfb7782fd451943301202f7c |
10:49:51 | Araq | luis_: please report it on github |
10:50:20 | Araq | and be aware that the HTML's future lies in a Nimble package, crazy to have that in the stdlib... |
10:50:26 | Araq | er |
10:50:33 | Araq | I mean, the HTML parser's future |
10:51:00 | * | Araq has code improvements for it lying around |
10:53:56 | luis_ | Araq: is it really a bug? I thought I was doing something wrong.... thanks |
11:23:16 | federico3 | an alternative syntax for {. .} pragmas would be nice. Something whitespace sensitive that allows writing pragmas in a dedicated line |
11:28:03 | FromGitter | <mratsim> there’s a RFC for this |
11:31:47 | FromGitter | <mratsim> see: https://github.com/nim-lang/rfcs/issues/15 |
11:31:47 | disbot | ➥ Pragma syntax |
11:32:15 | federico3 | oh 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:36 | FromDiscord | <Milerius> hey |
12:32:50 | FromDiscord | <Milerius> what is the most idiomatic way to clear an array of char in nim ? |
12:33:46 | FromDiscord | <Milerius> (looking for the .clear() equivalent from c++) |
12:33:48 | solitudesf | reset array |
12:34:10 | FromDiscord | <Milerius> my_var.reset() ? |
12:34:17 | solitudesf | yes |
12:34:30 | FromDiscord | <Milerius> Cool ! |
12:34:31 | FromDiscord | <Milerius> Thanks |
12:34:59 | * | gour left #nim ("Leaving") |
12:41:57 | * | luis_ quit (Ping timeout: 260 seconds) |
12:55:10 | FromGitter | <zetashift> Isn't it a little bit too late to change pragma syntax? |
12:55:48 | federico3 | to change it: yes. To add an additional syntax: probably not :) |
12:55:52 | FromGitter | <zetashift> And adding another way wouldn't that be even more ways to do stuff in Nim? Might make it more confusing |
12:57:48 | FromGitter | <zetashift> I'm not a fan of the pragma syntax either but adding this now isn |
12:59:06 | FromGitter | <mratsim> I don’t think so, when you start having {.gcsafe, inline, ….} it gets unwieldy |
13:00:51 | * | chenhq2005 joined #nim |
13:01:03 | FromDiscord | <Rika> I think it's less unwieldy than the other solutions proposed in the rfc |
13:03:50 | FromGitter | <zetashift> I like this one: https://github.com/nim-lang/rfcs/issues/15#issuecomment-568890071 looks clean and whitespace-y |
13:03:50 | disbot | ➥ Pragma syntax |
13:05:53 | FromDiscord | <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:02 | FromDiscord | <Milerius> i tried: `var str = cast[cstring](data.userData)` userData is a var buff = array[256, cchar] buff[0].addr |
13:07:02 | FromDiscord | <Milerius> |
13:07:03 | FromDiscord | <Milerius> Is not valid to do that ? |
13:08:06 | * | nh41 quit (Remote host closed the connection) |
13:10:37 | FromGitter | <zacharycarter> (https://files.gitter.im/nim-lang/Nim/ySGL/image.png) |
13:10:38 | FromGitter | <zacharycarter> Araq: what do you think of this? starting to look any better? |
13:11:25 | FromGitter | <zetashift> I |
13:11:47 | FromGitter | <zetashift> I'm not araq but I like it |
13:11:55 | FromGitter | <zetashift> It's kinda dark though? |
13:13:24 | FromGitter | <zacharycarter> well thanks either way :P |
13:13:34 | FromGitter | <zacharycarter> I don't have any directional light in there yet so that's why it looks really dark |
13:13:39 | FromGitter | <zacharycarter> just one really really powerful point light :P |
13:18:00 | federico3 | I o |
13:18:07 | federico3 | I don't get this comment https://github.com/nim-lang/rfcs/issues/15#issuecomment-568898287 |
13:18:07 | disbot | ➥ Pragma syntax |
13:22:21 | FromGitter | <zetashift> @lqdev friendly ping, cause I don't get it completely either |
13:25:27 | * | Trustable quit (Remote host closed the connection) |
13:30:08 | FromGitter | <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:10 | federico3 | (if you ask me I would even have proc arguments on independent lines) |
13:31:19 | federico3 | isn't "static let" equivalent to "const"? |
13:32:51 | FromGitter | <deech> No, it's like `let x {.compileTime.} = ...`. |
13:34:30 | federico3 | I mean: isn't `let x {.compileTime.} = ...` equivalent to `const x = foo(...)` ? |
13:35:47 | FromGitter | <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:14 | FromGitter | <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:23 | FromGitter | <mratsim> Now compile-time var are accessible at runtime |
13:42:55 | FromGitter | <mratsim> It's pretty new though so there are some bugs |
13:48:07 | FromGitter | <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:19 | Araq | I rushed it for 1.0, it seemed to fix more problems than cause |
14:02:33 | Araq | now it looks like it causes more trouble than it fixes |
14:02:40 | Araq | :-( |
14:05:38 | * | uu91 joined #nim |
14:22:29 | FromDiscord | <Rika> Rip |
14:25:15 | FromDiscord | <Milerius> Is it possible to convert an nim string to a fixed array ? |
14:25:30 | FromDiscord | <Milerius> in C++ i will do strncpy or smth similar |
14:26:57 | FromGitter | <deech> I just tested this in 1.0.4 and a compile time string does indeed show up in the binary. :( |
14:28:13 | FromGitter | <deech> What problems does this fix? |
14:30:58 | FromGitter | <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:11 | FromGitter | <mratsim> I agree, we should remove that |
14:36:33 | * | couven92 quit (Ping timeout: 260 seconds) |
14:38:02 | FromGitter | <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:48 | FromGitter | <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:25 | Araq | all of it, I think |
15:01:05 | FromDiscord | <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:08 | FromDiscord | <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:08 | FromDiscord | <snluu> 1. Does the default global dispatcher use multiple threads (if so, from threadpool?) or just one single thread? |
16:11:08 | FromDiscord | <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:08 | FromDiscord | <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:25 | FromDiscord | <Rika> Single thread afaik |
17:12:44 | * | endragor quit (Remote host closed the connection) |
17:12:50 | FromDiscord | <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:34 | FromDiscord | <snluu> So that doing IO doesn't block one of the (optimal) 4 threads, for example |
18:00:36 | FromDiscord | <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:50 | solitudesf | araq, any reason why this haven't been merged? its just a bugfix + example. https://github.com/nim-lang/x11/pull/31 |
18:04:51 | disbot | ➥ Make MIT-SHM bindings link with libXext instead of libX11 |
18:41:39 | Yardanico | Is `tuple` a valid type to be specified in a proc? Does it get converted to some generic tuple automagically or what? |
18:42:14 | Yardanico | the thing is that a Nim newbie tried this out (in telegram) and it worked https://play.nim-lang.org/#ix=25tm |
18:42:31 | FromDiscord | <mars> hey everyone |
18:42:35 | FromDiscord | <mars> can I ask newb questions here? |
18:42:35 | Yardanico | so I'm not sure if this is a bug or an intended feature |
18:42:59 | Yardanico | @mars yeah, go ahead, but don't forget to paste big amounts of code (>3 lines) on paste services :) |
18:43:03 | Yardanico | or on play.nim-lang.org |
18:43:09 | lqdev[m] | @Yardanico it's intended, you can use fieldPairs on it |
18:43:17 | lqdev[m] | @mars don't ask to ask |
18:43:24 | Yardanico | oh, ok, didn't know that, and didn't see it mentioned anywhere |
18:43:59 | lqdev[m] | it's an implicit generic |
18:44:01 | FromDiscord | <mars> https://play.nim-lang.org/#ix=25tm |
18:44:17 | FromDiscord | <mars> I'm not sure how to use map correctly in nim |
18:44:23 | Yardanico | You mean Table? |
18:44:35 | FromGitter | <deech> Yardanico, wow. |
18:44:57 | Yardanico | @mars simplest example https://play.nim-lang.org/#ix=25to |
18:45:01 | FromGitter | <deech> lqdev, what does implicit generic mean and is that documented? |
18:45:23 | lqdev[m] | @deech I think it's documented somewhere let me take a look |
18:45:42 | Yardanico | https://nim-lang.org/docs/manual.html#generics-type-classes |
18:45:44 | FromDiscord | <mars> Thanks Yardanico, that looks like a dictionary/hashmap, I'm looking at the "map" function like mapping a seq |
18:45:44 | lqdev[m] | but basically it declares a generic param `T: tuple` implicitly |
18:45:58 | Yardanico | @mars ah, that's in sequtils - mapIt |
18:46:04 | FromDiscord | <mars> ah okay thank you |
18:46:16 | Yardanico | !eval import sequtils; echo @[1, 2, 3, 4, 5].mapIt(it + 1) |
18:46:19 | NimBot | @[2, 3, 4, 5, 6] |
18:47:04 | FromDiscord | <mars> great example |
18:47:06 | FromDiscord | <mars> thank you |
18:48:53 | FromGitter | <deech> Yardanico, thanks! |
18:51:22 | FromDiscord | <mars> .mapIt($(&",\t{it}") |
18:51:26 | FromDiscord | <mars> exactly what I was looking for |
18:55:42 | Zevv | looks like perl |
18:58:42 | lqdev[m] | @mars that extra $ is redundant, & already returns a string |
19:00:17 | federico3 | urgh |
19:14:31 | * | fanta1 joined #nim |
19:16:17 | * | azed joined #nim |
19:26:04 | * | Hideki_ joined #nim |
19:27:28 | Yardanico | @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:03 | disruptek | also not a fan of the compile-time var change, for whatever that's worth. |
20:21:50 | disruptek | hope everyone is enjoying the holiday and writing lots of strange arc tests. 😁 |
20:22:17 | Zevv | why not? compile time vars spilling over to runtime is something you would expect to "just work" |
20:22:36 | disruptek | then they arent compile-time, right? |
20:22:55 | disruptek | they are all-time or long-time or any-time. |
20:23:01 | Zevv | yes, but thinning the lines between compile time and run time is where the power comes in |
20:23:50 | disruptek | that's a semantic we already have, isnt it? |
20:24:03 | Zevv | and I'm pretty impressed this works at all |
20:24:07 | disruptek | okay, thumbs and proper apostrophes do not mix. forgive me. |
20:24:58 | disruptek | what is this mysteriously powerful example enabled by the change? |
20:25:12 | disruptek | i never understood. |
20:26:20 | Zevv | got me there |
20:26:38 | Zevv | I do know that I run into this a few times when it didn't work and sat there scratching my head |
20:26:46 | Zevv | but in the end always find a way around |
20:28:07 | disruptek | so it didnt need to change. |
20:28:13 | disruptek | say it with me. |
20:28:28 | Zevv | otoh: what is so *bad* about it then? |
20:28:56 | disruptek | its unexpected, for one thing. hard to reason about. |
20:29:33 | Zevv | you have a point there |
20:29:34 | FromGitter | <Varriount> @Zevv: Great work on NPeg! |
20:29:43 | Zevv | thanks! |
20:30:20 | Zevv | I was pleasantly surprised by how easy it was to fit in, in the end |
20:30:22 | disruptek | one small step for a man, one giant leap for nimkind. |
20:30:41 | Zevv | we'll see - first I want to see someone actually use it |
20:30:53 | disruptek | the holiday is full of gifts. |
20:31:06 | FromGitter | <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:43 | FromGitter | <Varriount> Although, I'm wondering whether I should introduce precedence for command operators (&&, ||, and ;) |
20:33:42 | FromGitter | <Varriount> Then I would be able to take advantage of the precedence operators NPeg offers |
20:34:42 | * | azed joined #nim |
20:35:39 | FromGitter | <Varriount> Any thoughts on streams? |
20:35:55 | Zevv | dude |
20:36:19 | Zevv | i just gave you this terrific new feature! |
20:36:21 | Zevv | :) |
20:36:37 | Zevv | but, sorry, no... |
20:37:01 | FromGitter | <Varriount> Ah, I'm sorry if I offended you. |
20:37:22 | Zevv | yeah I'm easy to offend, ask disruptek! |
20:37:25 | Zevv | :) |
20:37:38 | Zevv | no, joking aside, streams is harder then I expected. |
20:37:55 | Zevv | I have this vague notion of how it could work, but I'm having a terrible time putting it into code |
20:38:03 | disruptek | zevv has very soft hands, so it works out. |
20:38:58 | Zevv | Im also not sure how important it would be in practice to support streaming |
20:39:50 | Zevv | I can see there are cases where it would be *handy* to have it, but never essential |
20:40:50 | Zevv | memfiles 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:07 | Zevv | parsing pipes would be cool, though. |
20:41:14 | disruptek | it would be cheaper to just document a good pattern for stream parsing using existing npeg. |
20:41:28 | Zevv | "it depends" |
20:42:00 | Zevv | in some cases you might get away with splitLines() and then parse each line |
20:42:31 | disruptek | i was thinking just a debounce... |
20:43:48 | Zevv | the 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:18 | Zevv | the 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:16 | disruptek | maybe the user can mark a boundary during parsing, or indicate that a token signifies a boundary. |
20:49:02 | Zevv | or 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:15 | Zevv | "trust me i know what im doing" |
20:49:47 | Zevv | If I can avoid adding api complexity I would prefer that |
20:50:00 | Zevv | and I feel 99% of the times resuming or streams are not needed |
20:50:46 | Zevv | it 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:20 | Zevv | no complicated logic for keeping track of absolute and relative offsets and keeping track of buffers |
20:51:53 | Zevv | but it will limit the use, because you can not just feed arbritary sized blocks |
20:52:21 | Zevv | the magic tokens is what lexbase does - typically newlines will refeed the buffers |
20:52:36 | Zevv | which is ok for a lexer, since you are not likely to lex a single token over newlines |
20:53:15 | FromGitter | <Varriount> I really *am* impressed with all the work you've done. |
20:54:06 | FromGitter | <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:12 | Zevv | i gave it a few tries, but i was always put off by the complexity it pulls in |
20:55:33 | Zevv | which might not be worth it for these few use cases |
20:56:38 | Zevv | i 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:48 | disruptek | its not usually accidental, but a side-effect of proper design decisions that precede the development. |
21:02:44 | Zevv | yeah Im just that good |
21:05:52 | Zevv | (deafening silence) |
21:06:32 | disruptek | i think so. |
21:09:09 | Zevv | ha! :) |
21:09:42 | Zevv | anyway varriount, Id love to discuss this further one time |
21:09:44 | * | azed quit (Quit: WeeChat 2.7) |
21:10:58 | Zevv | lateral thinking works best while discussing |
21:11:00 | Zevv | for me |
21:21:39 | * | nsf joined #nim |
21:42:29 | Araq | lexbase is unbeatable :P |
21:51:53 | FromDiscord | <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:53 | FromDiscord | <snluu> 1. Does the default global dispatcher use multiple threads (if so, from threadpool?) or just one single thread? |
21:51:54 | FromDiscord | <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:54 | FromDiscord | <snluu> 3. What goes into the “global dispatcher”? Like, when does work get scheduled in there implicitly? |
21:52:47 | FromDiscord | <snluu> 4. What would be a use case where someone calls setGlobalDispatcher to replace the one that comes out of the box? |
21:56:47 | Araq | 1. single thread. |
21:58:18 | Araq | 2. I never tried to use a "different dispatcher" and I consider it misguided. |
21:58:39 | Araq | 3. async tasks go into the dispatcher |
22:01:05 | Araq | 4. 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:23 | FromDiscord | <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:24 | disbot | https://github.com/nim-lang/Nim/issues/2 -- 5Compiler segfaults ; snippet at 12https://play.nim-lang.org/#ix=22vr |
22:01:34 | Araq | hint: I did DB migrations, there is more to it than changing the connection strings... |
22:02:16 | Araq | likewise alternative dispatchers will likely have different dispatching mechanisms so you're in a world of pain/debugging |
22:03:07 | FromDiscord | <snluu> That makes sense. |
22:04:12 | Araq | however, the dispatcher is thread local so you can have multiple dispatchers indeed |
22:04:25 | Araq | but they are all identical |
22:04:27 | FromDiscord | <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:29 | disbot | https://github.com/nim-lang/Nim/issues/2 -- 5Compiler segfaults ; snippet at 12https://play.nim-lang.org/#ix=22vr |
22:04:51 | FromDiscord | <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:52 | disbot | https://github.com/nim-lang/Nim/issues/2 -- 5Compiler segfaults ; snippet at 12https://play.nim-lang.org/#ix=22vr |
22:05:52 | Araq | here is my advice: |
22:06:45 | Araq | - use 'async' as it is if you are looking for non-blocking IO |
22:07:16 | Araq | - 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:05 | Araq | it works, async is built on top of these "closure iterators" too |
22:10:07 | * | casaca quit (Ping timeout: 265 seconds) |
22:10:54 | FromDiscord | <mratsim> closure iterators don't work on multiple threads though |
22:11:28 | * | nsf quit (Quit: WeeChat 2.6) |
22:11:34 | FromDiscord | <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:16 | FromDiscord | <snluu> That does require a shared heap, however. |
22:12:52 | * | dddddd quit (Ping timeout: 258 seconds) |
22:14:15 | FromDiscord | <mratsim> that's what you should do in Nim as well |
22:14:45 | FromDiscord | <mratsim> but you need something for IO (asyncdispaatch) and something for compute (i;e. a threadpool or something like Weave) |
22:17:30 | FromDiscord | <snluu> I guess I can just have N threads pull N channels and queue requests into them. |
22:17:39 | Araq | --gc:arc gives us a shared heap |
22:19:14 | FromDiscord | <mratsim> link to weave btw: https://github.com/mratsim/weave |
22:19:32 | FromDiscord | <mratsim> not production ready, but can be played with |
22:19:55 | FromDiscord | <snluu> Oooh nice! Let me take a look |
22:20:10 | Araq | mratsim: a perfect fit for --gc:arc then ;-) |
22:21:02 | FromDiscord | <mratsim> I can try adding gc:arc to my CI |
22:21:33 | FromDiscord | <mratsim> so somehow I managed to get a nims file merged (the temporary thing that nimble creates ...) |
22:22:20 | Araq | lol |
22:23:52 | * | Hotbees quit () |
22:24:04 | * | Hotbees joined #nim |
22:24:17 | FromDiscord | <mratsim> mmmh I would need to write some binary tree managed by arc that needs some aprallelization |
22:24:37 | FromDiscord | <mratsim> I think I'm gonna play with coroutines this week :p |
22:25:35 | * | dddddd joined #nim |
22:26:56 | FromDiscord | <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:45 | FromDiscord | <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:12 | FromDiscord | <snluu> Just interested in the differences |
22:30:24 | FromDiscord | <mratsim> Have a link? |
22:31:51 | FromDiscord | <snluu> https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html |
22:32:16 | FromDiscord | <snluu> It's an interesting write up about the trade offs and changes they had to make to their language and runtime |
22:32:44 | FromDiscord | <mratsim> Oh looks like Crystal is using Boehm |
22:32:49 | FromDiscord | <snluu> Ya |
22:33:43 | FromDiscord | <snluu> They are more opinionated for sure. For example it's really hard to write code that's heap allocation free. |
22:34:42 | FromDiscord | <mratsim> from what I'm reading, there are in the same state as Nim |
22:34:49 | FromDiscord | <mratsim> i.e. a basic threadpool |
22:35:26 | FromDiscord | <mratsim> they are laying down an API but they didn't tackle the scheduler part |
22:36:17 | FromDiscord | <yewpad> They didn't even tackle Windows support ha |
22:36:20 | FromDiscord | <yewpad> sorry |
22:36:21 | FromDiscord | <snluu> Wait no. They've had fibers (think goroutine) for a while. It was single threaded. |
22:36:52 | FromDiscord | <snluu> They model themselves after go lang |
22:38:01 | FromDiscord | <mratsim> I'll see if I can test a simple recursive parallel fibonacci 😛 |
22:38:09 | FromDiscord | <mratsim> apparently everyone chokes on it 😄 |
22:40:11 | Araq | snluu: 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:23 | FromDiscord | <snluu> 😍😍 |
22:40:40 | Araq | with tiny improvements |
22:41:05 | FromDiscord | <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:13 | Araq | it's however better hidden from you, I don't expect the users to know that much about it |
22:41:38 | FromDiscord | <yewpad> When is --gc:arc fully released? |
22:41:45 | FromDiscord | <yewpad> Estimated time |
22:41:51 | FromDiscord | <yewpad> Estimated date* |
22:43:03 | Araq | good question, I'm looking for milestones |
22:43:28 | Araq | the old milestone was that it must support "async" |
22:43:49 | FromDiscord | <mratsim> If you want to sell Nim to C++ devs, you need to talk about compile-time 😉 |
22:44:53 | FromDiscord | <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:33 | FromDiscord | <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:39 | FromDiscord | <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:10 | FromDiscord | <mratsim> Fibonacci example: https://github.com/mratsim/weave/tree/master/benchmarks/fibonacci |
22:46:24 | FromDiscord | <snluu> RE compile time, too fking real. |
22:46:49 | FromDiscord | <mratsim> the important part is to do "n < 2", and not "n <= 2" that's a 2x workload difference |
22:47:01 | FromDiscord | <mratsim> due to fibonacci spawning tasks exponentially |
22:47:04 | Araq | supporting "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:38 | FromDiscord | <mratsim> split stack? I know segmented stack/cactus stack but I don't know about split stacks |
22:47:58 | Araq | https://gcc.gnu.org/wiki/SplitStacks |
22:48:48 | FromDiscord | <mratsim> ha, interesting |
22:49:03 | FromDiscord | <mratsim> does LLVM supports this as well? does it work on ARM? |
22:49:13 | Araq | I think so, yes |
22:49:49 | FromDiscord | <mratsim> mmm bad feedback: https://news.ycombinator.com/item?id=13871803 |
22:50:36 | Araq | yeah I've read it |
22:51:09 | * | sam647254 joined #nim |
22:51:24 | FromDiscord | <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:37 | Araq | yewpad: adding stuff to the stdlib is hard these days |
22:52:47 | FromDiscord | <yewpad> why> |
22:52:49 | FromDiscord | <yewpad> ? |
22:52:57 | Araq | everything we add must be maintained for a long time |
22:53:15 | FromDiscord | <yewpad> because of breaking changes like syntax etc.? |
22:53:45 | Araq | we don't change the syntax anymore but again --gc:arc is the perfect example |
22:53:47 | FromDiscord | <mratsim> That means that the algorithm must be understandaable and maintainable by more than 1 person |
22:53:54 | FromDiscord | <yewpad> well, if you make some thing airtight you don't have to maintain nothing |
22:54:10 | Araq | when is --gc:arc ready? what parts of the stdlib needs to work with it? |
22:54:17 | FromDiscord | <mratsim> even "Tables" had bugs due to the hash functions |
22:54:21 | FromDiscord | <yewpad> oof |
22:54:38 | Araq | mratsim: not really |
22:54:47 | Araq | but they had performance problems |
22:54:55 | FromDiscord | <mratsim> for me it's a bug 😉 |
22:55:03 | FromDiscord | <yewpad> so --gc:arc will be available in a few months time? like something between 6-12 months? |
22:55:04 | Araq | hint: hashing always has them |
22:55:09 | FromDiscord | <mratsim> 100x slowdown is problematic |
22:55:19 | FromDiscord | <mratsim> it's available now |
22:55:39 | FromDiscord | <yewpad> no no no, i mean available in a sense that it does not cause any bugs or crashes |
22:55:59 | FromDiscord | <mratsim> 1à years from now? :p |
22:56:02 | FromDiscord | <mratsim> 10* |
22:56:06 | FromDiscord | <yewpad> oooooof |
22:56:08 | Araq | Q1 of 2020 |
22:56:08 | FromDiscord | <yewpad> welp |
22:56:16 | FromDiscord | <yewpad> nice |
22:57:28 | Araq | would I bet all my money on it, today? yes. why? because it works with valgrind |
22:57:33 | FromDiscord | <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:25 | FromDiscord | <yewpad> this 'return' statement lol |
22:58:43 | Araq | so you can write your program, ensure it doesn't trigger codegen bugs and keep growing it |
22:59:05 | Araq | the harder part is when you don't start from scratch :P |
22:59:32 | FromDiscord | <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:31 | FromDiscord | <snluu> That line is just if n < 2 return n |
23:00:45 | FromDiscord | <snluu> They can have question marks in function names |
23:01:09 | FromDiscord | <snluu> Lol I'll give it a try tonight. Fattening up on Christmas food 😁 |
23:01:26 | Araq | time 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:54 | FromDiscord | <snluu> @mratsim why do you only spawn for n-1? https://github.com/mratsim/weave/blob/master/benchmarks/fibonacci/stdnim_fib.nim |
23:11:56 | FromGitter | <mratsim> So that there is actual work in all tasks |
23:12:32 | FromDiscord | <snluu> Oh I see. |
23:13:10 | FromGitter | <mratsim> AFAIK the original Cilk benchmark is like that as well |
23:15:23 | FromGitter | <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:03 | FromDiscord | <snluu> Well we’ll see what my overpriced Mac mini i7 can do? |
23:16:16 | FromDiscord | <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 |