00:00:17 | FromDiscord | <Quibono> Dom we're not the fastest in that benchmark, tis a problem. :p |
00:00:32 | FromDiscord | <Quibono> 21st place smh |
00:00:37 | disruptek | pathetic. |
00:00:40 | * | klaufir_ joined #nim |
00:01:06 | disruptek | i didn't even know it went up to 20. |
00:01:36 | FromDiscord | <Quibono> Disruptek they added a 21st spot because everyone is a winner. ๐ฆ |
00:01:58 | disruptek | the decay of civilization, right here. |
00:03:17 | FromDiscord | <dom96> You'll never be the fastest |
00:03:54 | FromDiscord | <dom96> Unless you want to spend your life tweaking to adjust your code to fit the specific CPUs they run the benchmarks on |
00:04:31 | disruptek | i think i'd rather document async. |
00:04:32 | FromDiscord | <Quibono> I'm mostly joking because I can't code right now. ๐ฎ |
00:04:44 | FromDiscord | <dom96> Not to mention you won't even get close to these RPS numbers |
00:04:56 | FromDiscord | <Quibono> How come? |
00:05:01 | FromDiscord | <dom96> Once you do you'll be able to pay a team of software engineers to tweak the code and get those last percentages |
00:05:17 | disruptek | that sounds about as likely, yeah. |
00:07:23 | FromDiscord | <dom96> That said, something definitely happened to our performance |
00:07:35 | FromDiscord | <dom96> Round 17 https://media.discordapp.net/attachments/371759389889003532/790007450161643530/unknown.png |
00:07:53 | FromDiscord | <dom96> Round 19 https://media.discordapp.net/attachments/371759389889003532/790007526250119188/unknown.png |
00:08:49 | FromDiscord | <dom96> So actually, we can get to the top performance. The JSON benchmark is probably due to how we serialise JSON |
00:08:49 | disruptek | yer movin' in the wrong direction there, sport. |
00:09:23 | FromDiscord | <fwsgonzo> would it be possible to make Nim not zero things that can be zeroed with a fused malloc+memset (calloc) ? |
00:09:57 | disruptek | well, you can tell it not to zero stuff. |
00:10:17 | FromDiscord | <fwsgonzo> that's fine - I like that it's not adding to the heap of undefined behavior |
00:10:38 | FromDiscord | <fwsgonzo> i just happen to be in a situation where individual memory writes are super costly compared to calloc |
00:12:01 | FromDiscord | <dom96> Either the new httpbeast is to blame or the new Nim https://github.com/TechEmpower/FrameworkBenchmarks/commit/227880491e47718f4d6a0ba380948ee2b0df5b7c#diff-74c2ce5ad03c51d2b4cb7f1eaf18912f1e99c972c5a206f6a91db8da225b277a |
00:12:58 | * | klaufir_ quit (Ping timeout: 256 seconds) |
00:13:15 | FromGitter | <gogolxdong> poll waits 500ms everytime right? |
00:13:19 | disruptek | yeah, it's probably that patchlevel release. |
00:14:21 | FromDiscord | <Quibono> So dom what would you need to do to get into top 5? |
00:14:29 | FromDiscord | <dom96> wat |
00:14:49 | FromDiscord | <Recruit_main707> the benchmark |
00:14:53 | FromDiscord | <Quibono> httpbeaaaast |
00:16:00 | FromGitter | <gogolxdong> or 50ms ,dont quite remember |
00:16:13 | FromDiscord | <dom96> poll changes shouldn't affect it |
00:17:19 | disruptek | leorize: i just noticed that the binary on windows for, say, 1.4, is 1.4.3. also, it doesn't feature the git hash in the --version. i'm rendering this from github ci, so... setup-nim. |
00:17:20 | FromDiscord | <dom96> Very interesting though, I'll have to take a look tomorrow |
00:17:50 | disruptek | gogolxdong: it's 500ms but it doesn't always consume 500ms, obs. |
00:17:53 | disruptek | obviously. |
00:18:19 | * | tane quit (Quit: Leaving) |
00:18:20 | FromDiscord | <dom96> > So dom what would you need to do to get into top 5?โตFind and fix the regression ๐ |
00:18:35 | disruptek | learn concurrency. |
00:18:57 | FromDiscord | <dom96> I might even change the `$(%{"message": "Hello, World!"})` line |
00:19:00 | disruptek | leorize: and 1.2 is 1.2.9; same hash problem. |
00:19:11 | FromDiscord | <dom96> although hm, that might actually be a rule in the benchmark |
00:19:18 | disruptek | even devel doesn't have the hash. wtf. |
00:21:28 | FromDiscord | <dom96> huh, that's pretty interesting |
00:21:47 | FromDiscord | <dom96> Pretty much all the benchmarks that were in the top 10 in 2018 are now in the top 50 |
00:21:47 | leorize[m] | disruptek: that's a nightlies bug then |
00:21:50 | FromDiscord | <dom96> including tokio-minihttp |
00:21:57 | leorize[m] | hmm, did something change in the compiler :/ |
00:22:17 | FromDiscord | <dom96> ulib-json seems to be the exception |
00:27:28 | FromDiscord | <shadow.> FINALLY |
00:27:31 | FromDiscord | <shadow.> aoc part one done |
00:28:07 | FromDiscord | <shadow.> that was quite hard not gonna lie |
00:30:31 | FromDiscord | <bark> is it parsing |
00:31:45 | FromDiscord | <shadow.> yeah |
00:31:49 | FromDiscord | <shadow.> parsing and then pattern matching |
00:31:56 | FromDiscord | <shadow.> that took me a few hours ngl- |
00:33:35 | FromDiscord | <KingDarBoja> `browserOptions = %{}` when a proc has this typing, how I must pass the "json" object to this? o.o |
00:34:03 | FromDiscord | <ElegantBeef> That'd be an empty jsonified object |
00:34:09 | FromDiscord | <ElegantBeef> so any jsonNode should work |
00:34:48 | FromDiscord | <ElegantBeef> !eval import json; echo (%{}).typeof |
00:34:50 | NimBot | Compile failed: /usercode/in.nim(1, 21) Error: invalid token: (\29) |
00:34:54 | FromDiscord | <ElegantBeef> Shit |
00:35:20 | leorize[m] | just pass it? |
00:35:20 | FromDiscord | <KingDarBoja> https://nim-lang.org/docs/json.html#%25%2A.m%2Cuntyped says it is untyped |
00:35:26 | FromDiscord | <KingDarBoja> I tried passing it |
00:35:30 | leorize[m] | it's just a default arg |
00:35:36 | FromDiscord | <ElegantBeef> It's untyped cause it's a macro |
00:35:39 | FromDiscord | <KingDarBoja> sent a code paste, see https://play.nim-lang.org/#ix=2IMF |
00:35:40 | FromDiscord | <ElegantBeef> !eval import json; echo (% {}).typeof |
00:35:42 | NimBot | Compile failed: /usercode/in.nim(1, 21) Error: invalid token: (\29) |
00:35:46 | FromDiscord | <ElegantBeef> ok |
00:35:50 | FromDiscord | <ElegantBeef> Eval doesnt want to play nice |
00:36:14 | FromDiscord | <Quibono> What's the equivalent of [:-1] in nim? |
00:36:31 | FromDiscord | <ElegantBeef> `[^1]` |
00:36:44 | FromDiscord | <Quibono> Thanks |
00:36:46 | FromDiscord | <ElegantBeef> iirc that's the backwards index in python? |
00:37:02 | FromDiscord | <Quibono> Everything but the last element |
00:37:12 | FromDiscord | <ElegantBeef> oh then you want `[0..^2]` |
00:37:15 | FromDiscord | <Quibono> Thanks |
00:37:23 | FromDiscord | <KingDarBoja> Still no idea how to pass what I want |
00:37:28 | FromDiscord | <ElegantBeef> You pass a json node |
00:37:38 | FromDiscord | <KingDarBoja> Ah |
00:37:38 | FromDiscord | <ElegantBeef> What's the proc signature? |
00:37:52 | FromDiscord | <KingDarBoja> sent a code paste, see https://play.nim-lang.org/#ix=2IMG |
00:38:01 | FromDiscord | <KingDarBoja> (edit) "https://play.nim-lang.org/#ix=2IMG" => "https://play.nim-lang.org/#ix=2IMH" |
00:38:25 | FromDiscord | <ElegantBeef> yea browser options is just a empty jsonNode, so if you jsonify your input with either `toJson` or `% object` it'll work |
00:38:57 | FromDiscord | <ElegantBeef> The reason the macro says "untyped" is that it is expanded before type checking is done and can be used on any object |
00:39:15 | FromDiscord | <KingDarBoja> ok, thanks! |
00:39:41 | FromDiscord | <KingDarBoja> ElegantBeef +rep |
00:40:06 | FromDiscord | <ElegantBeef> Hey i just pretend i know anything |
00:52:10 | * | firegem joined #nim |
00:53:26 | * | firegem quit (Client Quit) |
01:07:20 | FromDiscord | <juliuskiesian> anyway to make nimble put binary output in a specific folder? |
01:07:30 | FromDiscord | <juliuskiesian> for example, in $project/bin? |
01:08:25 | FromDiscord | <ElegantBeef> `-o` `--out` allows you to change the name and `--outDir` the path |
01:08:45 | FromDiscord | <ElegantBeef> So you can make your own build path using a nimble task |
01:09:19 | FromDiscord | <ElegantBeef> https://github.com/ftsf/nico/blob/master/exampleApp/exampleApp.nimble#L15 |
01:09:21 | FromDiscord | <ElegantBeef> Example of that |
01:10:18 | FromDiscord | <ElegantBeef> Is it possible for Zippy to archive an entire folder? |
01:16:13 | FromDiscord | <ElegantBeef> @guzba hopefully you dont mind the ping ^? |
01:21:32 | FromDiscord | <guzba> hey, no problem. are you hoping to create a zip archive (zip file) of the folder? if so, currently zippy does not yet have procs for creating zip archives, only the direct compress/uncompress calls sorry! i meant to work on that today earlier but did other nim stuff instead haha. i need to get back to zippy and finish up the zip archive stuff |
01:22:11 | FromDiscord | <ElegantBeef> Ah shucks, was rewriting my unity build system and since i knew you library was pure was going to embed some upload support into it |
01:22:15 | FromDiscord | <guzba> zip archives is mostly just a header + lookup table with zip'ed blobs so i just need to sit down and work on it |
01:22:20 | FromDiscord | <ElegantBeef> Guess i'll put that off for a bit |
01:22:36 | FromDiscord | <guzba> (edit) "zip'ed" => "deflated" |
01:22:58 | FromDiscord | <guzba> yeah ill need a bit longer. i was working on getting zippy to zlib-level perf which ive basically managed at this point |
01:23:09 | FromDiscord | <guzba> so no more excuses not to work on zip archive |
01:23:46 | FromDiscord | <ajusa> wait that's really impressive actually |
01:23:48 | FromDiscord | <guzba> ill ping when ive got things ready and you can be my guinea pig ๐ |
01:24:21 | FromDiscord | <guzba> yeah thanks, its been a lot of work to get there. im still slower in some cases but am a bit faster in others so overall i feel quite good about it |
01:24:34 | FromDiscord | <guzba> i used to be lik 3x slower but now im worst-case like 20% slower |
01:24:36 | FromDiscord | <guzba> big difference |
01:24:39 | FromDiscord | <ElegantBeef> Well eitherway, good job, happy to see pure nim schtuffs |
01:25:13 | FromDiscord | <guzba> yep im all in on pure-nim stuff, its got tons of benefits even over nims great c interop |
01:25:56 | FromDiscord | <ElegantBeef> Well Nimarchive is nice as it works and isnt too hard to compress/uncompress archives, but it requires a dependancy and cannot be build cross platform |
01:26:12 | FromDiscord | <ElegantBeef> I couldnt ever get a windows build to work right, due to it |
01:26:46 | FromDiscord | <guzba> yeah i work on windows nowadays so i feel the "it doesn't work on windows" pain very often, hence i prefer if things are just in nim |
01:29:12 | FromDiscord | <ElegantBeef> Not that it matters much for what i'm doing but do you plan expanding to tarballs and the like eventually? |
01:29:43 | FromDiscord | <ElegantBeef> I only have on user of my build system and he only ships windows/mac builds afaik so zips are fine |
01:29:47 | FromDiscord | <guzba> i do like the idea of supporting tar.gz etc too, it seems very reasonable |
01:30:37 | FromDiscord | <guzba> i think tarballs are not that far from what i already have too, and may even be simpler than zip archives but we'll see when i look closer |
01:31:19 | * | Tanger joined #nim |
01:31:33 | FromDiscord | <guzba> iirc zip archives can be a bit tricky in the file format of like 32 vs 64 bit something and varios compression algorithms for the data, not always straight zlib but i could be mis-remembering |
01:31:43 | FromDiscord | <guzba> (edit) "varios" => "various" |
01:32:13 | FromDiscord | <ElegantBeef> No clue here, i just know they make file transfer easier ๐ |
01:32:33 | FromDiscord | <guzba> haha yeah that's all that should matter anyway. its just a fancy bundle really |
01:33:42 | FromDiscord | <guzba> i did png fully in nim in github.com/treeform/pixie -- png is basically a wrapper of zipped data it turns out |
01:34:28 | FromDiscord | <guzba> i tried jpeg too but that made me mucho angry, its a very complex image format |
01:34:35 | FromDiscord | <guzba> maybe ill get back to it someday |
01:34:52 | FromDiscord | <juliuskiesian> Thanks. that works. |
01:34:53 | FromDiscord | <ElegantBeef> It's 2020, jpeg isnt needed |
01:34:57 | FromDiscord | <ElegantBeef> No problem |
01:35:20 | FromGitter | <gogolxdong> ok , I found it comparing with nextTimer, does this count for a performance issue? |
01:35:37 | FromDiscord | <ElegantBeef> Like does anyone actually use jpeg ๐ |
01:37:29 | FromDiscord | <guzba> if they knew how much of a pain it is to load them they'd reconsider if they are lol |
01:38:26 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2IN8 |
01:40:15 | FromDiscord | <ElegantBeef> Half of Nim is elegant the other have is elegant |
01:40:19 | FromDiscord | <ElegantBeef> (edit) "have" => "half" |
01:41:05 | FromDiscord | <ajusa> it's amazing honestly. Nim is probably the closest to how I express my code, sometimes it just flows with a bunch of beautiful function transforms |
01:41:45 | FromDiscord | <ajusa> sent a code paste, see https://paste.rs/f67 |
01:49:43 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2IN9 |
01:49:54 | Fish-Face | how do you write "sequence containing an empty sequence" |
01:50:03 | Fish-Face | @[@[]] seems to fail |
01:50:39 | Fish-Face | it seems to get parsed as the proc @ applied to [@[]] |
01:51:18 | FromDiscord | <ElegantBeef> You can do `newSeq[seq[int]]()` |
01:51:57 | Fish-Face | it seems to get parsed as the proc @ applied to [@[]] |
01:52:00 | Fish-Face | oops |
01:52:33 | Fish-Face | dang |
01:52:35 | Fish-Face | verbosity |
01:55:48 | FromGitter | <gogolxdong> I think the latency in poll is โ โ ```let t = getMonoTime() โ t - p.timers[0].finishAt``` [https://gitter.im/nim-lang/Nim?at=5fdeaf2393af5216fc506ce9] |
01:56:35 | mipri | it's always a proc @ that's applied to an array. That's not the error. The error is that there's no @ proc that works for an array[1, seq[empty]] |
01:56:38 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2INa |
02:01:45 | FromDiscord | <ElegantBeef> @ajusa yea i didnt know your enum, so had no clue if it could go out of range ๐ |
02:02:36 | FromDiscord | <ajusa> fair enough lol, I didn't post the entire thing. I'm pretty happy with how my code looks now, unfortunately it doesn't actually work so I should probably fix it |
02:03:27 | giaco | sealmove, just started binaryparse to binarylang conversion! |
02:06:21 | FromDiscord | <sealmove> Nice. Do a git pull cause I just pushed some minor fixes. I started dogfooding it just today. |
02:06:55 | FromDiscord | <sealmove> Also it should land on nimble soon, already made a PR for this. |
02:07:52 | FromDiscord | <ajusa> Not sure if this is an issue from my code, but can you not do a map with an operator?โต`toSeq(0..3).map($)` doesn't work |
02:09:29 | FromDiscord | <sealmove> `$it`, not just `$` |
02:09:56 | FromDiscord | <ajusa> toSeq(0..3).mapIt($it)? |
02:10:13 | FromDiscord | <ajusa> (edit) "toSeq(0..3).mapIt($it)? ... " added "yeah that seems to work" |
02:11:03 | FromDiscord | <sealmove> Yup, I always use It versions of the procs in sequtils. |
02:11:11 | giaco | sealmove sure, using #head |
02:12:08 | FromGitter | <gogolxdong> What's the potential benefit from CPS? |
02:13:00 | FromDiscord | <sealmove> giaco so if I push your setup somehow pulls automatically? How do you do this? |
02:14:56 | giaco | sealmove, I didn't get your larst line. What do you mean. I'm just saying that I'm using "requires "https://github.com/sealmove/binarylang.git#head" in my nimble file |
02:16:18 | FromDiscord | <sealmove> Mm, never used #head in my .nimble, I wonder if it pulls new changes each time you build. |
02:16:42 | FromDiscord | <sealmove> If it works this way that's sweet! |
02:17:26 | giaco | sealmove, I'm a newbie, but I think it depends if you build using nim c or nimble c |
02:18:38 | FromDiscord | <sealmove> Yeah of course, if it does work like this it will only get triggered when building using the nimble command, since the nim command doesn't even check the .nimble file. |
02:19:10 | FromDiscord | <sealmove> I was just not aware that nimble can do this :p |
02:22:30 | FromDiscord | <sealmove> @gogolxdong more readable/safe code for specific code patterns? |
02:25:09 | FromDiscord | <sealmove> So giaco did the 2 things you mentioned yesterday work? I am off to bed and curious to learn :p |
02:31:05 | * | Tanger quit (Remote host closed the connection) |
02:31:54 | FromGitter | <gogolxdong> There is some CPS pattern code in Nim I think. |
02:32:45 | giaco | sealmove, still reading your docs and trying to figure out how to convert things |
02:34:09 | FromDiscord | <sealmove> I guess it's a quite long read, but most things should be identical in syntax. Only strings changed quite radically. |
02:35:21 | giaco | sealmove, yep. I've converted all the parsers in 10 secs, but strings + repetitions are exacly the 2 problems I had and so requires full read and comprehension |
02:36:32 | FromDiscord | <sealmove> I see, happy you are trying it out :-) you're the first one. Gotta sleep now, bb. |
02:38:48 | giaco | sealmove have a nice sleep and thanks! |
03:03:00 | FromGitter | <jrfondren> https://www.bleepingcomputer.com/news/security/bouncy-castle-crypto-authentication-bypass-vulnerability-revealed/ โ they screwed up string equality. |
03:06:23 | FromDiscord | <ElegantBeef> Jesus, looking at that code, as long as the length matches and the last hashed value matches it's a valid password |
03:07:03 | FromDiscord | <ElegantBeef> Ah nvm that's `&=` |
03:12:04 | * | sagax quit (Read error: Connection reset by peer) |
03:13:47 | * | rockcavera is now known as Guest80455 |
03:13:47 | * | tiorock joined #nim |
03:13:47 | * | Guest80455 quit (Killed (rothfuss.freenode.net (Nickname regained by services))) |
03:13:47 | * | tiorock is now known as rockcavera |
03:15:47 | * | tiorock joined #nim |
03:15:47 | * | tiorock quit (Changing host) |
03:15:47 | * | tiorock joined #nim |
03:15:47 | * | rockcavera quit (Killed (verne.freenode.net (Nickname regained by services))) |
03:15:47 | * | tiorock is now known as rockcavera |
03:20:22 | FromDiscord | <KingDarBoja> Still only index checking? What about character checking? O.o |
03:34:16 | * | vicfred quit (Quit: Leaving) |
03:56:21 | disruptek | i find your character wanting. |
04:00:51 | disruptek | leorize: but are we supposed to use odd-numbered releases for testing release branches? |
04:01:27 | * | muffindrake quit (Ping timeout: 260 seconds) |
04:03:48 | * | muffindrake joined #nim |
04:05:21 | ForumUpdaterBot | New thread by Bung: Looper - Another web framework written in Nim, see https://forum.nim-lang.org/t/7271 |
04:07:01 | leorize | disruptek: setup-nim fetch whatever is the latest from the nightly build for those branches |
04:07:30 | disruptek | i guess that makes sense, right? |
04:07:41 | disruptek | because a fix will go into the odd release. |
04:08:01 | leorize | bugs goes there too, as usual :P |
04:08:11 | disruptek | right. |
04:08:30 | leorize | https://github.com/alaviss/setup-nim/issues/4 <- this one tracks version selection for setup-nim |
04:08:30 | disbot | โฅ Allow installation of a specific nightly or released version |
04:08:42 | disruptek | so it's working it's just that the hash isn't getting revealed in the --version. |
04:08:48 | leorize | not all feature in there will get in, setup-nim is meant to have as little code as possible |
04:08:53 | disruptek | good. |
04:10:14 | disruptek | i think i'm going to make testes into a simple test runner that can replace nimble. it doesn't really make sense to put such code in a separate repo and i don't really want to bother with nimscript any more. |
04:26:53 | * | clyybber quit (Quit: WeeChat 3.0) |
04:33:52 | FromDiscord | <shadow.> a <- ("a" a) | "a"โตโตidk how tf npeg figures this out but this is gonna save my aoc part two ty zevv you're a wizard |
04:41:17 | * | narimiran joined #nim |
04:45:44 | * | vicfred joined #nim |
04:51:27 | * | rockcavera quit (Remote host closed the connection) |
04:53:29 | * | spiderstew_ joined #nim |
04:55:16 | * | spiderstew quit (Ping timeout: 240 seconds) |
05:04:28 | * | a_chou joined #nim |
05:17:26 | giaco | hello! newbie question. I do echo(myvar) and I get "@[160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160]". I do "import math" and "sum(myvar)" and I get "224". I was expecting 1760 |
05:18:07 | FromDiscord | <m0nsta> https://news.ycombinator.com/item?id=25464354 |
05:18:26 | FromDiscord | <m0nsta> ^anyone seen this ? |
05:19:51 | FromDiscord | <Rika> It was posted yesterday |
05:20:03 | disruptek | paper date is november. |
05:20:11 | FromDiscord | <Rika> I mean here |
05:20:16 | FromDiscord | <Rika> It was posted here yesterday |
05:20:43 | FromDiscord | <m0nsta> cool |
05:20:58 | FromDiscord | <m0nsta> there's some nim chatter in the comments |
05:21:02 | FromDiscord | <m0nsta> : ) |
05:25:36 | * | narimiran quit (Ping timeout: 240 seconds) |
05:29:12 | giaco | any hint? |
05:30:41 | mipri | !eval import math; echo @[160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160].sum |
05:30:43 | NimBot | 1760 |
05:32:27 | giaco | I get correct result in inim too, but in my exercise program I echo the var and I get that representation, but sum() or .sum returns 224 instead |
05:33:00 | mipri | then there's some unrelated problem in your code |
05:34:09 | giaco | sure, I'm here to ask for some help. the myvar is seq[uint8]> |
05:34:23 | * | a_chou quit (Quit: a_chou) |
05:34:47 | mipri | !eval import math; echo @[160.uint8, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160].sum |
05:34:49 | NimBot | 224 |
05:35:52 | giaco | that's because the return value would be uint8 too and it is overflowing? |
05:36:28 | mipri | !eval import sequtils; echo @[160.uint8, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160].foldl(a.int + b.int, 0) |
05:36:30 | NimBot | 1760 |
05:37:07 | mipri | !eval import sequtils; echo @[160.uint8, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160].foldl(a + b.int, 0) |
05:37:09 | NimBot | 1760 |
05:37:16 | mipri | rather. the 0 there is the first 'a'. |
05:38:34 | giaco | got it, good idea to use reduce. But what's the reason of the problem? Is "sum" using the same variable type of the input array? |
05:38:55 | mipri | !eval import math; echo @[160.uint8, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160].sum.typeof |
05:38:57 | NimBot | uint8 |
05:39:21 | mipri | avoiding that is why I'm using the three-argument form of foldl |
05:39:29 | mipri | !eval import sequtils; echo @[160.uint8, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160].foldl(a.int + b.int) |
05:39:30 | NimBot | Compile failed: /usercode/in.nim(1, 98) Error: type mismatch: got <int> but expected 'uint8' |
05:40:33 | giaco | mipri: thanks! it's working. Now an easy catch for a newcomer |
05:40:49 | mipri | what's strange to me is that there's no overflow check, which I normally expect. math.nim does a {.push checks: off.} |
05:41:07 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
05:42:27 | giaco | interesting |
05:42:52 | mipri | oh, that's not actually why, it's because it's uint8 |
05:44:19 | mipri | well, that's *also* why |
05:44:24 | mipri | https://play.nim-lang.org/#ix=2IOe gets an overflow |
05:45:30 | giaco | so math disables checks, but manual proc would get it. Interesting |
05:45:57 | mipri | math and unsigned types indepedently prevent the overflow check |
05:46:26 | giaco | I wonder why |
05:47:11 | mipri | math? probably speed. unsigned types? the expectation that overflow is what you want |
05:48:08 | giaco | while I can understand why speed matters, I don't get the second item |
05:48:22 | giaco | is it an historical reason? |
05:49:05 | mipri | I think it's pretty common but couldn't tell you about the history. |
05:49:50 | giaco | k, thanks a lot. I'm using nim to learn (actually re-learn) how to program using low level concepts |
06:03:16 | giaco | given a an array of uint8, how can I convert into a char array so that I can perform comparison with human readable stuff like ['h','e','l','l','o']? |
06:07:56 | mipri | https://play.nim-lang.org/#ix=2IOl |
06:10:15 | giaco | thank! Would you go for the cast solution or the mapIt? |
06:11:28 | mipri | I don't know that there's any actual difference. I'd tend to go with the cast. |
06:12:51 | * | NimBot joined #nim |
06:13:06 | giaco | thanks |
06:13:48 | FromDiscord | <Rika> The cast relies on internal representation |
06:14:18 | FromDiscord | <ElegantBeef> There is also `strutils.toHex` for strings to make them actually readable if the internal data isnt actually written strings ๐ |
06:14:36 | FromDiscord | <ElegantBeef> In these parts we tend to use `string` as identical as `seq[byte]` |
06:15:38 | giaco | would you also consider it equal to seq[uint8]? |
06:15:57 | FromDiscord | <ElegantBeef> Byte is just an alias to uint8 |
06:16:24 | FromDiscord | <ElegantBeef> My C# heritage is showing for me defaulting to `byte` instead of `uint8` |
06:16:53 | giaco | k, and what about cstrings? Do I ever have to care about string terminations and stuff like that while staying within nim borders? |
06:17:55 | FromDiscord | <ElegantBeef> Nope |
06:18:59 | giaco | good, good! |
06:19:03 | giaco | thanks |
06:24:15 | giaco | I have an proc that wants a bytestream as input, but I have a uint8 array. What's the right object to deal with that? |
06:25:29 | mipri | stdlib doesn't have a bytestream, so read the docs of whatever module you're working with. or its source. |
06:26:11 | FromDiscord | <ElegantBeef> Yea the closest the stdlib has is a `stringstream` |
06:27:27 | FromDiscord | <ElegantBeef> Assuming you setup your editor, your goto definition should let you see the type it's api |
06:27:52 | giaco | you're right! I though it was taking that function from "streams", but actually comes from another pkg. My fault, sorry |
06:28:26 | FromDiscord | <ElegantBeef> Unforgivable we'll now vote to see if you can stay |
06:28:46 | FromDiscord | <Rika> Why did you change your avatar |
06:28:54 | FromDiscord | <ElegantBeef> Peer pressure |
06:29:07 | FromDiscord | <Rika> I vote beef out |
06:29:09 | FromDiscord | <ElegantBeef> Also known as all my friends had Christmas hats |
06:29:22 | FromDiscord | <ElegantBeef> So changed to my other doggo |
06:29:42 | FromDiscord | <Rika> Out with beef |
06:30:11 | FromDiscord | <ElegantBeef> Fine, i'll leave and use Beeflang just so it makes sense |
06:31:58 | FromDiscord | <ElegantBeef> But remember the name "Beef" can hurt peoples sensibillities |
06:32:42 | FromDiscord | <ElegantBeef> https://github.com/beefytech/Beef/issues/14 context for that joke |
06:32:42 | disbot | โฅ Project name and logo can hurt people's sensibilities |
06:47:44 | giaco | I'm trying to use the seq[char] to string function from user Reactormonk here (second answer) but it seems deprecated (my nim is not accepting the syntax) https://stackoverflow.com/questions/32094567/converting-a-seqchar-to-string |
06:48:07 | giaco | I'm talking about "s.mapIt(string, $it).join" |
06:49:21 | mipri | remove the "string, " from that |
06:50:02 | giaco | it works! Thanks again |
06:50:58 | giaco | oh, I just found that I can just simply call .join on the seq[char] |
06:55:23 | * | j-james[m] joined #nim |
06:59:24 | * | letto quit (Quit: Konversation terminated!) |
07:08:26 | giaco | are body of cases in a "case" statements considered blocks? Can I use defer in them? |
07:12:01 | * | vicfred quit (Quit: Leaving) |
07:19:10 | mipri | https://play.nim-lang.org/#ix=2IOK |
07:24:36 | * | habamax joined #nim |
07:32:46 | * | opal quit (Remote host closed the connection) |
07:59:53 | giaco | mipri: thanks again and again! |
08:08:25 | giaco | sealmove, I've successfully converted my code to binarylang and everything is smooth! Your string implementation correctly parses non-byte-aligned strings saving quite some code. I've failed in two things: 1- modularize my code by moving "createParser" function into a separate file, I guess get and put are not exported (should I wrap them into exported functions?) 2- I'd chain parsers but I failed to |
08:08:27 | giaco | use conditional code inside the macro when I need to select which parser to use based on a previous parsed field or first magic bytes of a field (common case in network protocols, just think udp and different payload) |
08:28:49 | * | narimiran joined #nim |
08:38:32 | * | saem quit (Remote host closed the connection) |
08:38:48 | * | FromDiscord quit (Remote host closed the connection) |
08:39:02 | * | FromDiscord joined #nim |
08:48:02 | FromDiscord | <sealmove> @giaco hey again. You can simply use an export statement. |
08:48:44 | FromDiscord | <sealmove> `export myParser` at the end of your module. |
08:49:47 | FromDiscord | <sealmove> For selecting parser did you try the custom parser API? |
08:51:08 | giaco | sealmove, not yet! |
08:51:44 | FromDiscord | <sealmove> It's quite easy. |
08:52:34 | FromDiscord | <sealmove> Btw non-byte-aligned strings raise an exception :S how did it work for you? Can I see code? |
08:52:50 | * | ex_nihilo joined #nim |
08:53:58 | giaco | sealmove, I mistyped sorry. It is now non-byte-aligned, but custom length (still talking about 8*N bits) |
08:55:51 | giaco | sealmove, can I show you code? I'd be happy to hear your opinion (noob warning ahead) |
08:56:43 | FromDiscord | <sealmove> Yes please |
09:00:27 | giaco | sealmove: here's the parsers > https://termbin.com/fttr , here's the code using them https://termbin.com/9xi7 . It is my very first nim code that goes somewhere after the hello world |
09:01:06 | giaco | please be patient if you see any weird thing in there. I can say that the code works, any suggestion would be appreciated |
09:04:04 | giaco | as you can see I'm converting back strings to buffers to achieve conditional parsers. Dirty way to solve the problem, but I used it as an exercise to handle streams and buffer to strings conversions |
09:04:54 | FromDiscord | <sealmove> did you notice the default parser options? |
09:05:09 | FromDiscord | <sealmove> instead of `lu` everywhere you can make it default to `l` |
09:12:49 | giaco | endian= applied, thanks! |
09:13:03 | FromDiscord | <sealmove> yup. I assume you did `u8: segments[segments_table.foldl(a.int + b.int, 0)]` instead of `s: segments(segments_table.foldl(a.int + b.int, 0))` because there might be some null-byte in the middle? |
09:15:03 | giaco | because thats the buffer I pass to the next parser and contains both strings and binary data |
09:15:50 | FromDiscord | <sealmove> aha correct. let's make the custom parser, give me a sec |
09:15:52 | * | letto joined #nim |
09:15:52 | giaco | so I'm converting it from seq[uint8]->seq[char]->string manually later |
09:16:52 | FromDiscord | <sealmove> yes I think it's the only correct way right now. |
09:19:01 | FromDiscord | <sealmove> hmm, I haven't done TLV in binarylang yet. this is interesting. |
09:19:26 | giaco | TLV? |
09:19:30 | FromDiscord | <sealmove> kaitai struct has a dedicated feature for this https://gist.github.com/sealmove/080f54337a92d24e5ab6c8d61ffe8ecf |
09:20:16 | FromDiscord | <sealmove> Type-Length-Value, it means you are switching types at runtime based on condition |
09:23:03 | FromDiscord | <sealmove> gaico: hmm, how do you wanna do this? would you like to have fields in your oggPageParser that are wrapped into an Option, and only 1 of them gets a value? |
09:23:14 | FromDiscord | <sealmove> have 2 fields |
09:24:29 | giaco | it would be ok, surely better than switching back and forth main code |
09:26:10 | FromDiscord | <sealmove> It would look like this: https://play.nim-lang.org/#ix=2IPC |
09:27:01 | FromDiscord | <sealmove> The other solution is to use a union and have 1 field, which one do you prefer? |
09:28:06 | FromDiscord | <sealmove> when I say union, I mean an object variant type of course |
09:29:19 | giaco | well RFC says that the wrapper (ogg) should be agnostic about it's segmented payload, so ogg parser shouldn't know about it's dealing with opus, not sure if dual field or union is more compatible with the idea |
09:29:49 | giaco | may I ask you how can I do both? I want to think about it |
09:29:55 | FromDiscord | <sealmove> I guess union, which I also find more neat |
09:39:23 | FromDiscord | <sealmove> @giaco here you go: https://play.nim-lang.org/#ix=2IPJ |
09:40:39 | FromDiscord | <sealmove> After the plugin system is complete, you will be able to make a plugin for TLV to avoid such boilerplate. But for now if you hide this boilerplate somehow I think it's pretty sweet. |
09:41:55 | FromDiscord | <sealmove> sorry, autocompletion converted `s` to `sizeof`, here is the corrected one: https://play.nim-lang.org/#ix=2IPK |
09:43:06 | FromDiscord | <sealmove> and in the type I forgot to indent fields. anyway, i haven't run the code so do your tweaking, it shouldn't be hard to run. |
09:50:15 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:55:00 | FromDiscord | <sealmove> @giaco sorry I didn't see you wanted both |
09:55:59 | FromDiscord | <sealmove> sorry I have no time to show you the solution with 2 fields right now |
09:57:04 | FromDiscord | <sealmove> but it's longer and uglier anyway ๐ |
10:02:48 | giaco | sealmove, I'm back I had to eat something I was starving. Thanks for the union solution! I'm going to apply that now |
10:06:09 | giaco | ok this surely is a good topic for today: get to understand lines 4 to 7 :D |
10:06:39 | FromDiscord | <sealmove> yup, object variants is an awesome nim feature, read up the manual ^^ |
10:08:55 | giaco | sure! |
10:09:11 | giaco | I'd like to ask your opinion on same code |
10:11:54 | * | fanta1 joined #nim |
10:12:13 | giaco | rfc says that segments_table is a list of bytes where each byte is the length in bytes of the following segments. I actually sum them up and read all of them as a big unique segment and pass it down to next parser, but that's actually a workaround. A real ogg parser should return an array of arrays as "segments" field instead |
10:13:03 | FromDiscord | <mratsim> @zevv @disruptek any idea if this corresponds to a thing in the CPS POC? https://en.wikipedia.org/wiki/Delimited_continuation |
10:15:51 | giaco | sealmove, do you thing there's a way to achieve that using binarylang? |
10:16:35 | FromDiscord | <sealmove> @giaco: you can do anything with custom parsers, it's just nim code |
10:16:51 | FromDiscord | <sealmove> but binarylang only provides some primitives |
10:17:44 | giaco | sealmove, sure, I mean if there's a way in binarylang to read a list of variable lengths. I guess not, but I wanted to ask. Thanks! |
10:19:03 | FromDiscord | <sealmove> no, list of list is not implemented except with repetition + magic |
10:19:22 | FromDiscord | <sealmove> but i have a snippet in README which explains how to do it in 2 steps |
10:19:37 | FromDiscord | <sealmove> now that I think about it, you don't even need custom parsers for this |
10:22:13 | FromDiscord | <sealmove> it's the snippet under Substeams section |
10:23:53 | * | letto quit (Remote host closed the connection) |
10:26:18 | giaco | sealmove, do you mean the limit = 8 + aux + fixed example? I've considered that, but I don't see how I can use it to handle a list of lengths to read, as it is not to be used for repetition |
10:30:43 | giaco | what I need is segment_table is [3,1,2], I need to read following bytes in chunks of 3,1,2 resulting in something like [[AA,BB,CC],[DD],[EE,FF]]. What I am doing now as workaround is just reading 3+1+2=6 -> [AA,BB,CC,DD,EE,FF] |
10:31:17 | FromDiscord | <mratsim> use tuples |
10:32:08 | FromDiscord | <sealmove> sec, need to finish something first, i'll show you |
10:34:14 | FromDiscord | <sealmove> ok so, what I mean is you can make a subparser that accepts the length of the segment as argument |
10:36:02 | giaco | sealmove but segments have variable lengths |
10:37:34 | FromDiscord | <sealmove> right, hmm, let me think about it |
10:50:32 | giaco | what do you use as IDE per nim? I'm settled into vim and vscode right now. Tried to install aporia but nimble failed in compilation of both version in nim packages and head |
10:52:32 | FromDiscord | <sealmove> i also use vscode (when on windows) and neovim when on linux. |
10:52:34 | FromDiscord | <Recruit_main707> arporia is outdated, vscode has the best support, intellij got a plugin recently and its actively developed, but its still very new |
10:53:03 | Zevv | mratsim: not quite sure, we dont really return a value |
10:53:33 | FromDiscord | <mratsim> you return a continuation? |
10:53:54 | giaco | thanks for the feedback |
10:56:10 | FromDiscord | <Rika> Neovim actually has the best support |
10:57:42 | FromDiscord | <sealmove> giaco you can do it with until repeat repetition and the implicit `i` symbol to index your `segments_table` array |
10:58:29 | giaco | interesting, let me re-read that section |
10:58:36 | FromDiscord | <sealmove> I am in the middle of a tournament right now so I can't write the example, maybe later |
10:58:49 | giaco | what? :D |
10:58:58 | FromDiscord | <sealmove> shogi tournament |
11:00:09 | FromDiscord | <Rika> Oh man I wanna learn shogi |
11:00:10 | giaco | go get that Gyoku |
11:00:27 | FromDiscord | <sealmove> I've been playing since 2009 |
11:00:37 | Zevv | mratsim: thats an implementation detail, in our current setp we replace te `fn` member in the ref environment |
11:00:57 | FromDiscord | <mratsim> oh interesting |
11:01:01 | FromDiscord | <sealmove> @giaco thanks ๐ |
11:01:17 | FromDiscord | <mratsim> I bought the "Art of Shogi" 10 years ago but i didn't read it :/ |
11:01:28 | FromDiscord | <sealmove> guys you will make me cry |
11:01:31 | Zevv | but disruptek is planning on droopping the fn from the env and passing it around instead, so yes |
11:01:34 | FromDiscord | <sealmove> usually ppl don't even know it exists |
11:01:46 | FromDiscord | <mratsim> also couldn't find a good place to play it online apart from a polish website. |
11:01:56 | FromDiscord | <mratsim> I have a shogi set at home |
11:02:03 | FromDiscord | <sealmove> yeah, it's tough, though poland has a community |
11:02:18 | FromDiscord | <sealmove> oh for online there is 81dojo which is awesome |
11:02:22 | FromDiscord | <sealmove> 81dojo.com |
11:02:42 | FromDiscord | <dom96> Zevv: https://irclogs.nim-lang.org/19-12-2020.html#23:58:58 |
11:04:02 | FromDiscord | <mratsim> @sealmove will keep in bookmarks, but I think I found a new timesink in async/CPS |
11:04:14 | FromDiscord | <sealmove> hehe ^^ |
11:04:34 | FromDiscord | <Rika> ~~I only know it exists because of a manga~~ |
11:04:34 | FromDiscord | <dom96> Also someone should answer https://irclogs.nim-lang.org/20-12-2020.html#02:12:08 ๐ |
11:07:51 | FromDiscord | <mratsim> @dom96 I've been thinking about function colors. I don't see in Nim how it manifest as a problem. |
11:08:55 | Zevv | dom96: the benefit for me is not performance but simplicity |
11:09:10 | Zevv | it allows me do interesting flow control in the language |
11:09:17 | FromDiscord | <dom96> Zevv: I see. That's not what the implication was from the IRC logs ๐ |
11:09:18 | Zevv | my primary goal has been to have lua-style coroutines since day 1 |
11:09:37 | Zevv | the io_uring discussion I guess |
11:10:16 | Zevv | that would be a "nice exercise" to see how far to push it. |
11:10:29 | Zevv | For the mratsim-kind of folks, the benefit is in the memory management. |
11:11:00 | FromDiscord | <dom96> @mratsim I can see it being problematic when you have a synchronous API that you want to use. |
11:11:11 | FromDiscord | <dom96> But once you are able to await a spawned thread this won't be a problem. |
11:11:25 | * | Q-Master quit (Ping timeout: 240 seconds) |
11:11:28 | FromDiscord | <dom96> Awaitability of FlowVars and channels really is the missing piece to all of this. |
11:11:31 | FromDiscord | <mratsim> isn't waitFor sufficient to transform async into sync though? |
11:12:48 | FromDiscord | <dom96> Zevv: if simplicity is the goal then I think it should be sold as a replacement for closure iterators, rather than async/await. |
11:13:03 | * | j-james joined #nim |
11:13:04 | FromDiscord | <dom96> In all likelihood we can have async/await working on top of it without any API changes |
11:13:07 | giaco | sealmove, not sure how you would use repeat-until to solve the problem. "until", just like "for", would return an array, not an array of arrays |
11:13:13 | Zevv | maybe not even a replacement. It's just a library. You can use it to build stuff |
11:13:28 | * | j-james left #nim (#nim) |
11:13:28 | FromDiscord | <mratsim> I've been reading into Lattner Async swift proposal, that's what they propose, and Kotlin does the same as well |
11:13:35 | FromDiscord | <dom96> Sure, once it works well as a library we can adopt it into the compiler. |
11:13:39 | FromDiscord | <sealmove> giaco, encaptulate the parsing of 1 array in a subparser |
11:13:58 | FromDiscord | <sealmove> the subparser should accept a size |
11:14:13 | FromDiscord | <mratsim> give me 1 hour to organize my research because I'm getting lost in it xD |
11:14:17 | * | letto joined #nim |
11:14:22 | FromDiscord | <sealmove> and then use `segments_table[i]` as argument for that size |
11:14:35 | giaco | sealmove, yes, but the size it at the left of the ":", can I use "i" there? |
11:14:36 | FromDiscord | <dom96> @mratsim it's about transforming sync into async though ๐ |
11:14:41 | giaco | oh! |
11:14:45 | giaco | I was not considering that |
11:14:55 | FromDiscord | <mratsim> ah I see |
11:18:37 | FromDiscord | <dom96> Btw if we want to win benchmarks, we could use an efficient async DB driver. This is the missing piece for the Techempower benchmarks. I plan to have a look why httpbeast regressed and fix it today. |
11:18:52 | FromDiscord | <dom96> It can only cover JSON/Plaintext though as the other benchmarks involve DB calls. |
11:19:44 | Zevv | dom96: I see your point and understand your frustration, really. I spend some decen effort already to fix async a year ago with varriount. I don't even remember the details, but we went through the ioselectors, passing stuff around and basically got it to work. In the end it was bikeshedded and reviewed to smithereens, and I just lost interest in the subject. |
11:19:57 | Zevv | It does not solve my personal itch, because I don't care about mixing async and threads |
11:20:12 | Zevv | I don't even care about async performance, since it is just fine as it is now for my pracical purposes. |
11:20:55 | Zevv | The reason why I started with CPS i really the lua coros. I created a working implementation based on ucontext (https://github.com/zevv/nimcoro/) that kind of does what I want |
11:21:06 | Zevv | Araq saw that passing my and mentioned that I should take a look at CPS |
11:21:28 | Zevv | I didn't even know that just a few weeks before that he had already been pushing the CPS on irc and had discussed it with disruptek - I missed that |
11:21:49 | Zevv | I was in a period with some time & air, so I went through the CPS paper, liked the idea and made some initial POC implementation |
11:22:04 | Zevv | After a few weeks I got stuck, and no one was really interested to look at it, so I abandoned |
11:22:21 | Zevv | until - again a few weeks later - disruptek had picked it up and actually got it to work much better |
11:22:22 | giaco | sealmove, the "i" symbol on the left side of the expression returns an error: "*oggSegmentParser(segments_table[i]): segments{i>page_segments}" -> Error: undeclared identifier: 'i' |
11:22:58 | FromDiscord | <sealmove> @giaco use until repetition (curly brackets), not substream |
11:23:29 | FromDiscord | <dom96> Ah, I think we are in agreement then. What frustrates me is the implication that CPS will replace async/await, you could aim to replace async/await by the CPC concept described in the paper but CPS can only realistically be implemented as a replacement for closure iterators specifically. |
11:24:37 | Zevv | I think it's partly philosiphical, not only practical |
11:24:47 | FromDiscord | <sealmove> @giaco never mind, i didn't read your example correctly |
11:25:00 | Zevv | CPS provides the lower building blocks. Closure iterators are limited in what they can do, CPS is more essential |
11:25:18 | FromDiscord | <sealmove> `i` should work, i will give it a try later and see what's wrong |
11:25:30 | Zevv | CPS allows pretty cool tricks, like taking any closure and running it "anywhere" - if you want it on another thread, that's just comes natural |
11:25:51 | giaco | sealmove, np. Thanks |
11:26:01 | Zevv | so I don't think anyone is looking to replace async in the short term, but it is a pretty interesting research project *with the potential* to maybe one data offer something like that |
11:26:09 | FromDiscord | <dom96> Zevv: wouldn't that be possible with closure iterators too? Assuming the heap isn't thread-local? |
11:26:39 | Zevv | Actually, I wouldn't know, I lack knowledge of the details |
11:26:42 | FromDiscord | <dom96> Zevv: no, CPS cannot replace async. You need something on top, I think it's important to make that clear. |
11:26:55 | FromDiscord | <dom96> Async/await is one approach that you can put on top of CPS |
11:26:57 | FromDiscord | <dom96> CSP is another |
11:27:09 | Zevv | sure. CPS is the lego blocks |
11:27:54 | FromDiscord | <dom96> Once CPS is working well we should discuss the next approach. I just don't want the community to give up on async/await thinking that it will be gone soon because CPS will replace it. |
11:28:04 | Zevv | but async does have some kind of problem, because why is no one able to "fix" this flowvar/async problem? Mulitple people have tried, but they all get stuck somehow |
11:30:11 | FromDiscord | <dom96> It has definitely been fixed at least once. The problem as far as I'm concerned was it got stuck in review and then interest was lost to push it forward. |
11:30:32 | Zevv | right, that was my impression as well. |
11:30:46 | FromDiscord | <sealmove> @giaco, `i` only exists inside curly brackets |
11:30:55 | Zevv | So for me, personally, CPS is about the "level 1", cutting up stuff into continuations I can play with |
11:30:56 | FromDiscord | <dom96> But even looking at it as things are right now, you can already mix FlowVars and async. You just need to poll the FlowVar which sucks. |
11:31:10 | Zevv | Right |
11:31:12 | FromDiscord | <dom96> So it really isn't much of a stretch to integrate this with the event loop |
11:31:58 | giaco | sealmove, so it can't help with the problem |
11:32:25 | Zevv | I'm really ambivalent about this. Async is pretty mature and does a good job, but every time I try to work in the implementation I see this pretty massive amount of pretty complicated code. I understand a lot of that is because of the ioselector abstractions and all |
11:32:34 | Zevv | but it's not particulary /fun/ to work on anymore. |
11:33:03 | Zevv | that's no ones fault, that's how it goes with any piece of matureed or aged software |
11:33:13 | FromDiscord | <sealmove> @giaco yes, I should fix this, that's why it's nice when people use your product ๐ expect it done today |
11:33:33 | giaco | :D :D |
11:33:52 | FromDiscord | <dom96> Which parts in particular did you find complex? I'd love to scope out something that could push it into a better state. |
11:34:51 | Zevv | ha good question. I think it's the "overall complexity", but that's a non-answer |
11:34:56 | FromDiscord | <dom96> This stuff is unfortunately complex though, I imagine if I looked at the CPS implementation I would also be very confused. |
11:35:25 | Zevv | Remember that CPS itself is not much more than asyncmacro |
11:35:37 | Zevv | it's just a transformation |
11:35:58 | Zevv | so if anyone would "rebuild" async on top of CPS, it will bring the same level(s) of complexity |
11:36:02 | FromDiscord | <dom96> Of course, but you have splitting steps, lambda lifting steps and what not. That's not even something the async macro does. |
11:36:05 | Zevv | of io selector abstractions, schedulers, etc |
11:36:10 | FromDiscord | <dom96> indeed |
11:37:14 | FromDiscord | <dom96> IO selectors in particular have gone through significant changes by various people, so I'm not surprised if that's complex |
11:37:46 | FromDiscord | <dom96> but the async macro transformation is also probably difficult to understand, especially if you just read the code, you'd need to view how the ASTs get transformed. |
11:38:07 | Zevv | partly yes, partly no |
11:38:40 | Zevv | I really should make a writeup about this, because what happens is not even very complicated |
11:39:40 | * | PMunch joined #nim |
11:39:58 | FromDiscord | <sealmove> @giaco then we should inject an `i` variable not only when using until repetition, but also when using for repetition, so you will be able to do `oggSegmentParser(segments_table[i]): segments[segments_table.len]` |
11:40:01 | FromDiscord | <dom96> What I think would be useful is to get the perspective of those that are intimately familiar with closure iterators. In particular yglukhov who implemented the ability to handle exceptions with yields in the `try`/`except` blocks. |
11:40:23 | Zevv | that makes sense |
11:40:27 | FromDiscord | <dom96> He might very well be the best advocate for simplicity ๐ |
11:40:54 | giaco | sealmove, exactly! |
11:41:05 | Zevv | but still, I think you should see this all as a research thing mostly, at this time |
11:41:22 | FromDiscord | <sealmove> this is very easy to fix, just need to add 2-3 lines of code |
11:41:47 | Zevv | for me personally it's just the fun of it, I like how thinking about programming in new ways like this makes my brain go porridge |
11:42:09 | Zevv | I'm really a low level engineer, and working with these high level CS concepts is just plain fun |
11:42:19 | FromDiscord | <dom96> sure, I understand. I only have a problem with how expectations are being managed with the community about it. |
11:42:29 | Zevv | I don't understand the most of this stuff, and then it's pretty rewarding to get it to work. Just like npeg, I know hell nothing of parsers, but still it works |
11:42:33 | giaco | sealmove, this change opens quite big possibilites |
11:43:38 | FromDiscord | <sealmove> let me be a good programmer and write tests for it before implementing it ๐ |
11:44:03 | * | Q-Master joined #nim |
11:44:56 | Zevv | dom96: part of that comes from ar4q i think, who seems to be actively pushing this |
11:45:41 | giaco | sealmove, take your time. As I said, I'm using this project as a playground to learn nim (and to replace my previous failed attempt with golang) |
11:48:25 | FromDiscord | <dom96> Zevv: possibly, I think it would help us all if it was clearer what exactly he is pushing. |
11:49:00 | * | Q-Master quit (Ping timeout: 256 seconds) |
11:49:00 | Zevv | https://github.com/nim-lang/RFCs/issues/295#issuecomment-744277794 |
11:49:01 | disbot | โฅ next steps for CPS ; snippet at 12https://play.nim-lang.org/#ix=2Gti |
11:49:31 | Zevv | which makes me think he might have missed some of the details, since weave is not the way to go on this |
11:51:34 | PMunch | AoC, day 19 and 20 is now live streaming: https://www.youtube.com/watch?v=GIgx6wpb-zs https://www.twitch.tv/pmunche |
11:51:49 | FromDiscord | <Zevv[IRC]> (edit) https://github.com/nim-lang/RFCs/issues/295#issuecomment-744277794 |
11:51:50 | * | FromDiscord quit (Remote host closed the connection) |
11:51:50 | disbot | โฅ next steps for CPS ; snippet at 12https://play.nim-lang.org/#ix=2Gti |
11:52:03 | * | FromDiscord joined #nim |
11:53:03 | FromDiscord | <dom96> Yeah, that still doesn't explain what his feelings are regarding async/await. I have spoken about it with him a little and I do have an idea of his feelings, but I'd rather leave it up to him to communicate. |
11:53:32 | * | Q-Master joined #nim |
11:54:01 | * | pbb quit (Ping timeout: 268 seconds) |
11:55:01 | * | pbb joined #nim |
12:03:43 | Zevv | dom96: can't argue with that, right |
12:12:29 | * | superbia joined #nim |
12:20:58 | FromDiscord | <mratsim> The macro transformation is ugly, I looked at CHronos's but I assume async dispatch is the same |
12:22:29 | FromDiscord | <mratsim> One thing that Araq was appealed by I guess is also macro composition |
12:23:01 | FromDiscord | <mratsim> I'm looking into CPS for compiler and its clear that for functional language compiler it seems like an excellent compilation target: https://www.gnu.org/software/guile/manual/html_node/Compiling-CPS.html |
12:23:45 | FromDiscord | <mratsim> so you would directly CPSify any macro node and the codegenerator only takes CPS |
12:23:51 | FromGitter | <gogolxdong> CPS is cool from what you have been discucssed. |
12:24:17 | * | tane joined #nim |
12:25:17 | FromGitter | <gogolxdong> What's the problem of async/await for now? |
12:26:54 | FromDiscord | <mratsim> http://www.cs.umd.edu/class/fall2012/cmsc430/compiling_functional_languages.pdf |
12:29:34 | FromDiscord | <Shucks> Anyone a idea how I could check if fields to a object ptr are set? I guess segfaults are not catchable. https://prnt.sc/w6hu7p |
12:30:38 | FromDiscord | <mratsim> import segfault or import signals if you want to |
12:30:46 | FromDiscord | <mratsim> but just test foo.isNil |
12:30:47 | * | Vladar joined #nim |
12:31:12 | FromDiscord | <mratsim> you manage to have debugger suport in VScode? |
12:31:25 | FromDiscord | <Shucks> Yea, works pretty good |
12:42:37 | FromDiscord | <mratsim> Wow the rabbit hole, I just uncovered "continulet" in Stackless Python: https://doc.pypy.org/en/latest/stackless.html#continulet |
12:46:31 | * | krux02 joined #nim |
12:48:51 | mipri | likewise I looked up Ada-style concurrency, and the Ada rendezvouz comes from CSP |
12:52:48 | FromDiscord | <mratsim> Rendez-vous is blocking though |
12:56:02 | * | lum quit (Quit: Lum: Bye!) |
12:56:13 | * | superbia quit (Quit: WeeChat 2.9) |
13:00:50 | * | lum joined #nim |
13:01:31 | * | lum quit (Client Quit) |
13:03:09 | * | lum joined #nim |
13:03:10 | FromDiscord | <alehander42> oo |
13:03:44 | * | lum quit (Client Quit) |
13:04:56 | * | lum joined #nim |
13:05:43 | * | lum quit (Client Quit) |
13:05:50 | * | Q-Master quit (Ping timeout: 256 seconds) |
13:08:35 | * | lum joined #nim |
13:11:23 | * | lum quit (Client Quit) |
13:11:40 | FromDiscord | <sealmove> hum weird error: "'node' is not accessible using discriminant 'kind' of type 'TFullReg' [FieldDefect]" |
13:14:57 | Zevv | well, is it then? |
13:15:02 | mipri | https://play.nim-lang.org/#ix=2IR1 generates that error. |
13:15:32 | FromDiscord | <sealmove> `TFullReg` is not in my code |
13:15:44 | FromDiscord | <sealmove> seems like an internal error |
13:16:12 | mipri | vm code, looks like |
13:16:47 | Zevv | sealmove: not here |
13:16:50 | Zevv | what version? |
13:17:04 | FromDiscord | <sealmove> 1.4.2 |
13:17:07 | Zevv | oh wait it does. wrong cache hit |
13:17:34 | Zevv | it's not compile time |
13:17:57 | Zevv | wait what it's not your code but what is that snippet then? |
13:18:24 | Zevv | the error is totally ok for that code |
13:18:28 | mipri | what snippet? my paste? That was just showing how to replicate that error, assuming that stuff was in his code. |
13:18:48 | Zevv | well that is perfectly fine. It accesses a variant member that's not valid for it's kind |
13:18:55 | Zevv | so it goes *boom* on you |
13:18:57 | Zevv | as it should |
13:18:58 | mipri | right, but that stuff *isn't* in his code |
13:19:10 | mipri | so it's the compiler accessing a field that it shouldn't |
13:19:24 | Zevv | riight, but how do I reproduce it in the compiler then |
13:20:23 | Zevv | https://github.com/nim-lang/Nim/issues/13652 |
13:20:26 | disbot | โฅ Compiler crash with getAst of a resultless macro and adding to a statement list ; snippet at 12https://play.nim-lang.org/#ix=2IR7 |
13:21:58 | FromDiscord | <sealmove> oh |
13:22:02 | FromDiscord | <sealmove> i can reproduce |
13:22:03 | FromDiscord | <sealmove> replaceWith |
13:22:11 | FromDiscord | <sealmove> sorry, here: https://play.nim-lang.org/#ix=2IR9 |
13:23:48 | FromDiscord | <sealmove> is this code correct or am I am missing something? |
13:28:49 | mipri | it's definitely a compiler bug. you can avoid it there by operating on args before constructing MyObj |
13:30:07 | FromDiscord | <sealmove> duh i can't this, myObj is constructed in different place in my code, and I want to modify it |
13:30:29 | FromDiscord | <sealmove> is it because it's a seq[NimNode]? |
13:31:38 | mipri | ok, you can also avoid it by copying args out of MyObj, mutating it, and then setting it back |
13:32:17 | FromDiscord | <sealmove> thanks, i'll do that |
13:32:19 | mipri | https://play.nim-lang.org/#ix=2IRg |
13:32:25 | * | lum joined #nim |
13:33:34 | * | lum quit (Client Quit) |
13:34:30 | * | lum joined #nim |
13:35:05 | * | lum quit (Client Quit) |
13:40:21 | * | clemens3 quit (Quit: WeeChat 2.7) |
13:40:27 | * | lum joined #nim |
13:41:54 | * | Q-Master joined #nim |
13:42:01 | * | lum quit (Client Quit) |
13:42:59 | * | lum joined #nim |
13:44:53 | * | lum quit (Client Quit) |
13:45:22 | * | lum joined #nim |
13:45:28 | FromDiscord | <sealmove> "internal error: environment misses: :tmp" is my new nightmare |
13:46:36 | * | Q-Master quit (Ping timeout: 240 seconds) |
13:47:32 | * | lum quit (Client Quit) |
13:48:24 | * | lum joined #nim |
13:50:22 | mipri | *shrug*. lambda lifting part of compiler that makes those, and :tmp variables I've seen from --expandArc output. |
13:52:24 | * | lum quit (Client Quit) |
13:54:13 | * | lum joined #nim |
13:54:57 | * | lum quit (Client Quit) |
13:55:25 | FromDiscord | <sealmove> can bindSym solve those? Or is it completely unrelated? I never used bindSym and I still don't get what it does. |
13:55:26 | * | lum joined #nim |
13:57:12 | FromDiscord | <Gibson> is the right way to distribute nim binaries that need ssl on windows to statically link them using some cursed compiler options and manual downloads? |
13:58:25 | * | klaufir_ joined #nim |
13:59:29 | FromDiscord | <mratsim> @sealmove the TFullReg happens to me sometimes when I use distinct uint64 |
14:03:14 | FromDiscord | <mratsim> @zevv @dom96 @disruptek, here is a nicely packaged collection of Rabbit Holes: https://github.com/weavers-guild/weave-io/tree/master/research |
14:03:41 | Zevv | no man |
14:03:42 | Zevv | forget it |
14:03:45 | Zevv | I'm not going there |
14:03:47 | FromDiscord | <mratsim> Now I need to put together some primitives design :p |
14:04:11 | Zevv | you're once more *soo* overdoing this |
14:04:54 | * | klaufir_ quit (Remote host closed the connection) |
14:05:16 | * | klaufir_ joined #nim |
14:05:30 | FromDiscord | <mratsim> I'm not, I need to organize my thoughts, and that starts by putting all the stuff I read and found interesting in boxes. |
14:06:25 | FromDiscord | <haxscramper> What is the difference between `proc (a: T0, b: T1){.closure.}` and `proc (this: var string, arg: cint){.closure.}` when passing argument to a function? https://play.nim-lang.org/#ix=2IRE |
14:06:51 | FromDiscord | <mratsim> var string is a pointer |
14:07:03 | FromDiscord | <mratsim> you can't capture var |
14:07:28 | FromDiscord | <mratsim> welcome to the joy of borrow checking |
14:07:55 | FromDiscord | <haxscramper> I don't capture anything, I"m working purely with function signatures |
14:08:27 | FromDiscord | <haxscramper> But using `a: var T0` helped |
14:09:11 | FromDiscord | <haxscramper> And by the way, there is no capturing if I understand everything correctly, I can easily pass mutable arguments to callbacks anyway |
14:09:54 | FromDiscord | <mratsim> ah right |
14:10:06 | FromDiscord | <mratsim> yes you can't capture a var but you can apss it as aprameter |
14:10:38 | * | klaufir_ quit (Ping timeout: 265 seconds) |
14:11:19 | FromDiscord | <haxscramper> I just assumed `var string` can be inferred as `T` |
14:11:55 | FromDiscord | <haxscramper> E.g both `proc (a: int)` and `proc(a: var int)` are valid for passing to `proc(a: T)` |
14:13:42 | FromDiscord | <haxscramper> Though `var` is not a part of the type, so it looks like I need to write overloads for each possible combination of `T` and `var T` |
14:14:22 | Zevv | excellent list of resources mratsim |
14:18:15 | * | Q-Master joined #nim |
14:19:05 | * | Vladar quit (Remote host closed the connection) |
14:19:28 | FromDiscord | <mratsim> The continulet exposed here are quite interesting: https://doc.pypy.org/en/latest/stackless.html |
14:20:58 | FromDiscord | <tiatomee> Yesterday I've talked a bit about dependent types and somebody suggested that even something like sigma types are possible in Nim |
14:21:11 | FromDiscord | <tiatomee> so I now have a problem where that would be useful |
14:21:44 | FromDiscord | <tiatomee> I have a string that contains a "rectangular" data. I want to treat it like an array of width x height |
14:22:18 | FromDiscord | <mratsim> type Matrix[M, N: static int] = object |
14:22:40 | FromDiscord | <mratsim> see: https://github.com/unicredit/linear-algebra/blob/master/linalg/private/types.nim#L14-L23 |
14:22:41 | FromDiscord | <tiatomee> with sigma types I'd like to do something likeโต`proc parse(input: string): (width: int, heigh: int โ array[height, array[width, char]])` |
14:23:19 | FromDiscord | <tiatomee> The issue with that is that the bounds have to be known at compile time, but I only know them at runtime |
14:23:40 | FromDiscord | <tiatomee> but the "sigma type" aka dependent tuple allows me to create dependent types based off runtime values |
14:24:06 | FromDiscord | <tiatomee> I could use `seq[seq[char]]` but then I lose the guarantee that all rows have the same length |
14:25:08 | FromDiscord | <mratsim> array must have a compile-time size so you can't use raw arrays either |
14:25:41 | FromDiscord | <tiatomee> Yes, the implication is that the size is only known at runtime, so I'll have to use something like a `seq` |
14:25:51 | FromDiscord | <mratsim> I don't think that's possible without DrNim / Formal verification right now |
14:26:01 | FromDiscord | <tiatomee> but that's what I meant yesterday with "lifting runtime values into the type system" |
14:26:10 | FromDiscord | <mratsim> Yes, i see now |
14:27:06 | FromDiscord | <mratsim> that said with your own type, you can have all the checks on parsing and know that except at serialization/deserialization boundary your object is internally consistent |
14:28:16 | FromDiscord | <tiatomee> Sure, that's probably also what I'll end up doing |
14:28:24 | FromDiscord | <tiatomee> it's just less of a guarantee than dependent types :) |
14:29:12 | FromDiscord | <mratsim> we'll come here ๐ |
14:29:44 | FromDiscord | <tiatomee> If DrNim becomes more complete and powerful then that's a nice alternative I think |
14:30:02 | FromDiscord | <tiatomee> it's still a bit different than dependent types, but they can both be used for formal verification |
14:30:22 | FromDiscord | <tiatomee> and I'd actually really love to have a language as feature complete as Nim with decent support for formal verification |
14:30:58 | FromDiscord | <mratsim> I don't know if you saw but I posted a way forward to use DrNim / Z3 for formal verification. |
14:31:21 | FromDiscord | <tiatomee> I did not see that, no |
14:31:22 | FromDiscord | <mratsim> basically it's very inspired by Frama C |
14:31:36 | FromDiscord | <mratsim> https://github.com/nim-lang/RFCs/issues/222 |
14:31:38 | disbot | โฅ Correct-by-construction Nim programs ; snippet at 12https://play.nim-lang.org/#ix=2lbm |
14:32:39 | FromDiscord | <tiatomee> That's a bunch to read, but I see you are mentioning model checking |
14:33:19 | FromDiscord | <tiatomee> I don't think Frama-C does model checking by default, does it? There's the Eva plugin for symbolic execution and then the Why3 based one that rely only on deductive reasoning |
14:33:44 | FromDiscord | <tiatomee> Model checking is certainly interesting because it's generally pretty nice to start with but the bounded-ness can be a limitation |
14:34:31 | FromDiscord | <mratsim> Model checking because for embedded, that's one of the most important thing. Also for my own multithreading runtime i'd like to prove that the state machine is correct. |
14:34:48 | FromDiscord | <mratsim> so it's quite practical |
14:35:04 | FromDiscord | <mratsim> once we have that, that also means that we have a way to transform Nim AST into Z3 AST. |
14:35:05 | FromDiscord | <tiatomee> For state machines it really is nice, it would be nice to have |
14:35:58 | FromDiscord | <mratsim> The initial goals for DrNim are: bound checks / invariants (so what you need) and not nil checks. |
14:36:58 | FromDiscord | <tiatomee> I think it's great that DrNim exists at all and that it seems like it's reeeelatively easy to build |
14:37:26 | FromDiscord | <tiatomee> for Rust there are a few projects for formal verification but they are pretty complex to build up because the compiler has pretty complex APIs that are not stable at all |
14:38:23 | FromDiscord | <mratsim> I'm not sure what's the state of DrNim is, I think @Araq is looking for proof of concepts on where to apply it. |
14:41:59 | FromDiscord | <flywind> !eval import math; echo floorMod(8.0, -3.0) |
14:42:02 | NimBot | -1.0 |
14:53:23 | * | Vladar joined #nim |
14:55:32 | Oddmonger | is this the only way to generate wasm bytecode ? https://github.com/arnetheduck/nlvm |
14:56:52 | Oddmonger | except generating C and using emcripten of course |
14:57:21 | FromDiscord | <Rika> ~~you just answered yourself~~ |
14:58:00 | Oddmonger | myself was hoping i was wrong |
14:58:46 | FromDiscord | <Rika> well lets see if someone proves me wrong... |
14:59:11 | FromDiscord | <mratsim> clang can generate wasm from C directly as well |
15:02:43 | FromDiscord | <bark> hello guys. Is it possible to call next() on an iterator? (or use an iterator in any way that's not a for loop) |
15:03:01 | FromDiscord | <bark> or use lua style coroutines |
15:03:03 | FromDiscord | <Rika> yes if it is a closure iterator |
15:03:27 | FromDiscord | <Rika> if it is, then you just "call the variable storing it" |
15:04:50 | FromDiscord | <bark> thank you |
15:07:14 | Oddmonger | for clang->wasm without emscripten, i've found this: https://surma.dev/things/c-to-webassembly/ |
15:08:43 | Oddmonger | but maybe it would be simpler to use emscripten anywayโฆ |
15:12:04 | * | waleee-cl joined #nim |
15:14:04 | Evolver | How do I run an OS process with args? I need to wait for it to finish. Its stdout and stderr can be that of the parent process (of Nim). |
15:15:16 | FromDiscord | <haxscramper> https://nim-lang.org/docs/osproc.html#execProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D |
15:15:33 | FromDiscord | <haxscramper> And use `poParentStreams` to attach stdin/stdout |
15:17:38 | Evolver | haxscramper: I was trying exactly this: `execProcess(myProc, args=args, options={poEchoCmd, poUsePath, poParentStreams})` and then I get: |
15:17:38 | Evolver | Error: unhandled exception: /snap/nim-lang/1051/lib/pure/osproc.nim(1472, 17) `poParentStreams notin p.options` API usage error: stream access not allowed when you use poParentStreams [AssertionDefect] |
15:19:12 | mipri | execProcess collects the output of the child process. It can't use poParentStreams |
15:19:28 | Evolver | mipri: ah, what then can I use? |
15:19:48 | mipri | execProcess, since you don't care about the streams |
15:20:16 | mipri | or if you do care, startProcess with poParentStreams, and then waitForExit |
15:20:18 | Evolver | I need the streams to be streamed to the terminal. |
15:20:30 | FromDiscord | <haxscramper> `startProcess` |
15:20:40 | FromDiscord | <haxscramper> You need `startProces`, not `exec`, sorry |
15:20:53 | FromDiscord | <haxscramper> Because `exec` tries to read from output |
15:21:31 | FromDiscord | <haxscramper> And raises exception because streams are attached to parent process |
15:21:39 | Evolver | mipri , haxscramper : Thanks. I will try `startProcess` followed by `waitForExit`. |
15:23:36 | FromDiscord | <Shucks> Weird. Still with `segfaults` imported I'm not able to catch segfaults |
15:26:23 | mipri | !eval echo cast[ptr int](nil)[] |
15:26:25 | NimBot | Traceback (most recent call last)โต/usercode/in.nim(1) inโตSIGSEGV: Illegal storage access. (Attempt to read from nil?) |
15:26:33 | mipri | !eval import segfaults; echo cast[ptr int](nil)[] |
15:26:35 | NimBot | /usercode/in.nim(1) inโตError: unhandled exception: Could not access value because it is nil. [NilAccessDefect] |
15:26:52 | mipri | it's a Defect, mind. |
15:27:36 | FromDiscord | <Rika> you shouldnt catch segfaults in the first place.. |
15:27:51 | FromDiscord | <Shucks> !eval import segfaults; try: echo castptr int[] except: echo "foobar" |
15:27:52 | NimBot | Compile failed: /usercode/in.nim(1, 29) Error: undeclared identifier: 'castptr' |
15:28:05 | mipri | the bot ate most of what I said. |
15:28:21 | mipri | https://irclogs.nim-lang.org/20-12-2020.html#15:26:23 |
15:28:35 | FromDiscord | <Recruit_main707> lemme try |
15:28:36 | FromDiscord | <Recruit_main707> !eval echo cast[ptr int](nil)[] |
15:28:38 | NimBot | Traceback (most recent call last)โต/usercode/in.nim(1) inโตSIGSEGV: Illegal storage access. (Attempt to read from nil?) |
15:30:01 | FromDiscord | <Shucks> https://play.nim-lang.org/#ix=2ISl |
15:30:06 | FromDiscord | <Shucks> mh yea that works here. >.< |
15:30:16 | FromDiscord | <himu> Where are the nim source code installed after `sudo apt install nim`. I need the location of `nimsuggest.nim`? I am on Ubuntu. |
15:30:22 | FromDiscord | <Rika> are you compiling with --panics:on or something |
15:30:47 | FromDiscord | <Shucks> --threads:on --app:lib --gc:arc |
15:36:27 | * | Fish-Face quit (Ping timeout: 260 seconds) |
15:36:47 | FromDiscord | <haxscramper> @himu I'm not sure if `apt` installs sources, but I suppose it has some way of listing files for a particular package, so you could try this |
15:37:00 | FromDiscord | <haxscramper> Though I'd recommend using `choosenim` |
15:37:56 | mipri | dpkg definitely has something like that. in a pinch just: find /usr -name nimsuggest.nim 2>/dev/null |
15:52:36 | FromDiscord | <shadow.> does ufcs not work in pragmas? |
15:54:09 | FromDiscord | <Rika> what do you mean |
15:58:35 | mipri | like {.128.align.} instead of {.align(128).} I suppose |
15:59:12 | FromDiscord | <shadow.> yeah |
15:59:26 | FromDiscord | <shadow.> {.bot.event, async.} instead of {.event(bot), async.} |
16:03:09 | FromDiscord | <Shucks> So I guess arc is the issue. Compiled with --gc:arc that crashes: https://play.nim-lang.org/#ix=2ISI |
16:05:07 | FromDiscord | <shadow.> hm |
16:05:16 | FromDiscord | <shadow.> how do you make lambdas w macros? |
16:05:19 | FromDiscord | <shadow.> i dont see anything on the docs |
16:08:47 | FromDiscord | <shadow.> nvm got it |
16:12:48 | FromDiscord | <shadow.> how can i check if a nimnode contains a child? |
16:14:50 | FromDiscord | <tiatomee> What does `out T` do and how can it be used? It's quickly mentioned in the manual but not explained anywhere |
16:15:14 | FromDiscord | <haxscramper> It crashes compiler |
16:15:18 | FromDiscord | <shadow.> indeed |
16:15:21 | FromDiscord | <haxscramper> The only use I was able to find |
16:15:22 | FromDiscord | <tiatomee> That I noticed :) |
16:15:36 | FromDiscord | <haxscramper> Though there is an experimental `out` for types |
16:15:56 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual_experimental.html#covariance |
16:17:23 | FromDiscord | <shadow.> should i just make an in overload for nimnode children? |
16:18:24 | disruptek | you mean nimlets? |
16:18:54 | disruptek | the pitter-patter of tiny nimling feet... |
16:19:41 | disruptek | you can use len() on nimnodes, chucklehead. |
16:21:28 | FromDiscord | <shadow.> yes |
16:21:33 | FromDiscord | <shadow.> but how can i check if a nimnode contains a nimlet |
16:21:46 | disruptek | len |
16:21:52 | FromDiscord | <shadow.> no like |
16:21:54 | FromDiscord | <shadow.> a specific nimlet |
16:21:58 | FromDiscord | <shadow.> only john |
16:22:01 | FromDiscord | <shadow.> i dont care if he has steven |
16:22:20 | disruptek | there's a find for recursive, uh, finding. |
16:22:21 | FromDiscord | <shadow.> like `if jimmy in fatherNimNode:` |
16:22:28 | FromDiscord | <shadow.> i only need top level lol |
16:22:28 | FromDiscord | <shadow.> ohh |
16:22:31 | FromDiscord | <shadow.> i suppose that'd still wrok |
16:22:32 | FromDiscord | <shadow.> lol |
16:22:53 | FromDiscord | <shadow.> what does it return if nothing is found? |
16:22:55 | FromDiscord | <haxscramper> `node.anyIt(it.kind in {<necessary kinds>})` |
16:23:07 | disruptek | don't make me read the manual to you. |
16:23:32 | FromDiscord | <shadow.> probably emptyNode() |
16:23:37 | FromDiscord | <shadow.> lol |
16:23:39 | FromDiscord | <haxscramper> Or `node.matches([any is Kind()])` but that is magic |
16:23:42 | FromDiscord | <shadow.> hmmm |
16:23:44 | FromDiscord | <shadow.> thanks |
16:24:19 | disruptek | i hope you're attending to my testes right now. |
16:25:15 | FromDiscord | <shadow.> hmm |
16:25:20 | FromDiscord | <shadow.> after i add this dimscord pragma |
16:27:22 | FromDiscord | <haxscramper> diruptek: about nimph and gitnim |
16:27:30 | FromDiscord | <haxscramper> And discussion from couple days ago etc. |
16:27:53 | disruptek | yeah? |
16:28:02 | FromDiscord | <mratsim> @haxscramper, "out" is supposed to allow both in-place and out-of-place procedure with a single function declaration |
16:28:03 | disruptek | hurry up, 'cause i gotta take a wicked piss. |
16:28:13 | FromDiscord | <haxscramper> If I understand correctly you have these current implementations, but not really working on them right now? |
16:28:51 | disruptek | well, i tend not to work on code that works, has no bugs, and is satisfactorily performant. |
16:29:09 | FromDiscord | <tiatomee> That's what I thought. I tried to use it instead of `var` in a parameter, but all it did was crash the compiler :sweats: |
16:29:20 | FromDiscord | <mratsim> never tried it :p |
16:29:45 | disruptek | gitnim has 9 commits and totals 101 lines. |
16:30:27 | FromDiscord | <haxscramper> Okay, so they are like in 'more or less finished state right now'. I just had some ideas that I might wanbt to imeplemnt, so I just wanted to check if these things are still used |
16:30:30 | FromDiscord | <haxscramper> well, not used |
16:30:47 | FromDiscord | <haxscramper> Alright, good to know |
16:30:47 | disruptek | nimph has a version 2 branch that is more ambitious. |
16:30:55 | disruptek | it is waiting for concepts fixes. |
16:31:03 | disruptek | you can read the PR to see what it targets. |
16:31:19 | FromDiscord | <haxscramper> Yes, I've read it, though not very thoroughly |
16:31:24 | disruptek | gitnim is going to start accumulating a distribution of modules in the next week or so. |
16:31:55 | disruptek | each branch will track a similar set of modules, though perhaps at different versions. |
16:32:14 | disruptek | we're trying to reach araq's "batteries included" valhalla. |
16:32:40 | disruptek | i will probably experiment with moving the stdlib into modules, also. |
16:33:26 | disruptek | i like the idea that the stdlib is a declaration of extant modules, say, by url. |
16:33:46 | disruptek | i'll bundle that shit for you, but you can always mutate the list of submodules. |
16:34:10 | disruptek | what are you thoughts? feel free to type while i drain the main vein. |
16:35:34 | FromDiscord | <haxscramper> I want to fininish C++ thing |
16:35:40 | FromDiscord | <haxscramper> And then start to contribute |
16:35:43 | FromDiscord | <haxscramper> Well |
16:36:07 | FromDiscord | <haxscramper> I have several very proof-of-concept ideas, that you might find interesting, though they are just ... I guess in very disorganized state |
16:37:17 | FromDiscord | <haxscramper> For now, I just wanted to confirm current state of things mostly |
16:38:46 | disruptek | secrets, huh. |
16:39:01 | FromDiscord | <haxscramper> Well, I want to write documentation generator |
16:39:07 | disruptek | oh that thing. |
16:39:12 | FromDiscord | <haxscramper> And just integrate whole |
16:39:18 | FromDiscord | <haxscramper> tests + documentation + atual code |
16:39:27 | FromDiscord | <haxscramper> Because unit test are just goldmine of examples |
16:39:38 | disruptek | hmm. |
16:39:41 | FromDiscord | <haxscramper> And current documentation generator doesn't really cut it |
16:40:16 | disruptek | nice, looking forward to reading about it. |
16:40:24 | FromDiscord | <haxscramper> I've also worked for some time on tree diffing to automatically generate semantic-ast-diffing changelogs |
16:40:35 | Zevv | disruptek: if you want reading material |
16:40:37 | FromDiscord | <haxscramper> Detect API breakages between library versions |
16:40:39 | disruptek | ah, you should talk to leorize about that. |
16:40:46 | disruptek | we've tossed around some ideas. |
16:40:55 | disruptek | zevv: i was able to watch the first half of that talk finally. |
16:41:29 | Zevv | the first half is fine |
16:41:30 | FromDiscord | <haxscramper> And just squeeze every line of nim code in your project for data, and use that data to save time for others when using your library |
16:41:35 | Zevv | its about acquire/release |
16:42:05 | * | ico joined #nim |
16:42:06 | * | Zevv quit (Quit: Lost terminal) |
16:42:14 | * | ico is now known as Zevv |
16:42:14 | FromDiscord | <haxscramper> But that would require keeping some sort of additional metadata in project and solving things like that, and I find it easier to try and base this on nimph and your work |
16:42:17 | FromDiscord | <haxscramper> Than nimble |
16:42:24 | Zevv | no one ever explaind to me its about acquire and release |
16:42:24 | FromDiscord | <haxscramper> But as I already said |
16:42:31 | Zevv | i have been lied to\ |
16:42:53 | FromDiscord | <haxscramper> This is just random smoke in my head |
16:43:15 | FromDiscord | <haxscramper> Though if not for this generic caching but, I'd already have working tree diffing |
16:43:25 | disruptek | i dunno if i talk about it in the nimph-2 thing, but i plan to cache a lot of project metadata to speed things up. |
16:43:47 | disruptek | we can use that to make the git rolling even faster, and enable queries when the project is dirty. |
16:43:50 | FromDiscord | <haxscramper> that is great |
16:45:40 | FromDiscord | <dom96> > Detect API breakages between library versionsโตthat would be awesome, I remember Elixir (IIRC) doing something similar |
16:46:39 | disruptek | nimph should be able to roll your dependencies to the last or first occasion of API breakage, too. |
16:46:56 | disruptek | we can start with it making sure your tests pass and move forward from there. |
16:47:12 | FromDiscord | <Quibono> Hrm, so there is a csources_v1 now, but editing build_all.sh to import it doesnโt seem to be enough for building on M1 |
16:48:02 | * | haxscramper joined #nim |
16:52:45 | Zevv | so did *you* learn anything new disruptek, or was it all old news to you |
16:55:19 | FromDiscord | <mratsim> did you read the PhD Thesis of Kerneis on CPC? |
17:00:31 | * | Fish-Face joined #nim |
17:01:12 | narimiran | Zevv: i'm making my first steps in npeg! damn you and your cryptic stuff! |
17:02:04 | FromDiscord | <mratsim> yeah when I looked at npeg, i was like, hum hum hum, maybe I'll learn EBNF and all that jazz later |
17:02:18 | FromDiscord | <mratsim> I'll just use strscans for now |
17:02:22 | FromDiscord | <Quibono> I look at npeg and pee myself a little |
17:03:54 | narimiran | npeg has some nice useful stuff which strscans don't. the only problem is: i don't know how to use those superpowers just yet |
17:06:24 | FromDiscord | <dom96> parseutils ftw |
17:06:41 | disruptek | zevv: there were little factoids here and there but i'm looking forward to the second half. |
17:07:30 | disruptek | if you want to see npeg in production... |
17:07:32 | disruptek | !requires npeg |
17:07:33 | disbot | npeg: no results ๐ข |
17:07:39 | narimiran | @dom96 i see you never used neither strscans nor npeg :P |
17:07:46 | FromDiscord | <Clyybber> disruptek: that backfired lol |
17:07:46 | disruptek | disbot: wtf, dude, are you high? |
17:07:47 | disbot | yep. ๐ |
17:07:53 | disruptek | oh shoot. |
17:08:08 | FromDiscord | <ache of head> what |
17:08:18 | FromDiscord | <dom96> narimiran: I learned how to parse from the best ๐ |
17:08:34 | narimiran | disruptek: hm, that's strange. i think i saw some packages use npeg |
17:08:34 | disruptek | i think disbot is broken. |
17:09:45 | FromDiscord | <haxscramper> `gcplat`, `atoz`, `openapi`, `bluu`, `wauto` and some other |
17:09:52 | FromDiscord | <haxscramper> Six in total |
17:09:58 | FromDiscord | <haxscramper> `github` |
17:10:06 | disruptek | nimph. |
17:10:19 | disruptek | are you telling me i'm the only person using it? |
17:10:24 | disruptek | that doesn't make any sense. |
17:10:46 | disruptek | and who killed disbot? |
17:10:51 | FromDiscord | <mratsim> @dom96 doing parsing state machines by hand gets old very fast, and you don't get fancy diagrams and nice error messages |
17:11:09 | FromDiscord | <haxscramper> What are the plans for AST construction in npeg, I think I saw some discussion not too long agot |
17:11:18 | FromDiscord | <haxscramper> But can't remember where it lead exactly |
17:11:27 | FromDiscord | <mratsim> It leads to the dark side |
17:11:43 | FromDiscord | <haxscramper> If I only had enough brainpower to finish this earlery parser generator |
17:11:49 | FromDiscord | <haxscramper> Earley' |
17:11:56 | FromGitter | <bung87> I got benchmark result, my framework slower than jester :( |
17:12:42 | FromDiscord | <dom96> @mratsim I prefer it over having to learn a mini-language to do the parsing |
17:12:53 | FromDiscord | <dom96> And then having to debug the mini-language when the parsing isn't how I want it |
17:13:17 | FromDiscord | <dom96> You don't need fancy diagrams, just good old fashioned procedural debugging skills ๐ |
17:13:28 | FromDiscord | <mratsim> are you using wrkbin @Bung87? https://github.com/olliNiinivaara/GuildenStern/tree/master/bench |
17:13:40 | narimiran | ungh. |
17:15:56 | FromGitter | <bung87> I write a benchmark module combine with `ab` , results is here https://github.com/bung87/Looper/runs/1585198581?check_suite_focus=true |
17:16:39 | FromDiscord | <dom96> You should use `wrk` and test it on a dedicated machine, not CI |
17:17:41 | FromDiscord | <mratsim> yeah, kill nimsuggest and test on your own machine |
17:18:10 | disruptek | disbot: do you yet live? |
17:18:11 | disbot | it is certain. |
17:18:19 | disruptek | !requires npeg |
17:18:20 | disbot | npeg: no results ๐ข |
17:18:26 | FromGitter | <bung87> does CI test means something or worth nothing ? |
17:18:32 | * | disruptek ๐คฌ |
17:18:39 | FromDiscord | <mratsim> CI test yes, CI benchmarks no |
17:18:57 | FromGitter | <bung87> if the results already show mine is slower.. |
17:19:17 | Zevv | npeg is a hoax |
17:19:19 | FromDiscord | <mratsim> it could be that there was a load spike |
17:19:45 | FromDiscord | <mratsim> You can make weave slower than serial by having nimsuggest running on the same PC |
17:19:57 | Zevv | its an elaborate GPT2 generated document |
17:20:06 | disruptek | i guess. |
17:20:13 | FromDiscord | <mratsim> so hasbeen, have you heard about GPT3? |
17:20:15 | Zevv | with nonfunctional code |
17:20:24 | Zevv | mpeg predates gpt3 |
17:20:49 | disruptek | maybe github now requires auth to perform queries. |
17:20:50 | FromDiscord | <mratsim> GPT2 can evolve into GPT3 on its own. |
17:21:05 | FromDiscord | <mratsim> you didn't reply btw, have you read Kerneis thesis on CPC? |
17:21:10 | FromGitter | <bung87> ok, haven't try `wrk`, `ab` also has problem on my mac |
17:21:53 | * | klaufir_ joined #nim |
17:21:56 | narimiran | Zevv: ok, now that i have your attention.... you'll recognize what this is: https://play.nim-lang.org/#ix=2ITi - can you tell me what am i doing wrong? (and yes, i've seen your solution, but i want to start small) |
17:21:58 | FromDiscord | <mratsim> Also question @dom96 how does the stack traces look like in async dispatch? I suppose you don't see anything above poll()? |
17:22:31 | FromDiscord | <dom96> @mratsim you do, haven't you seen them before? |
17:22:52 | FromDiscord | <mratsim> I just see the thing that starts the event loop |
17:23:03 | FromDiscord | <mratsim> not what enqueued the handler |
17:23:06 | FromDiscord | <mratsim> at least in chronos |
17:23:23 | FromDiscord | <mratsim> so i don't know what the handler reacts to. |
17:23:43 | FromDiscord | <mratsim> Apparently CPS would allow that since things are not gobbled up by the event loop. |
17:24:00 | FromDiscord | <dom96> huh, did Chronos get rid of this aspect of asyncdispatch? |
17:24:07 | FromDiscord | <mratsim> though I still don't know how that materialize since there is no stack anymore .... |
17:24:38 | FromDiscord | <mratsim> I'll likely have to just write sample code to compare. |
17:25:02 | FromDiscord | <dom96> You will get multiple stack traces with async/await, it's not ideal and there is bound to be a way to merge these together but it's better than nothing. |
17:26:31 | FromDiscord | <mratsim> @disruptek @Zevv, are you implementing CPS via Environment or via Lambda Lifting? |
17:26:47 | FromDiscord | <mratsim> not sure I get that part. |
17:31:58 | disruptek | it's a little of both. |
17:32:27 | disruptek | the 1011 was inspiration, but we've changed our approach a bit from theirs. |
17:32:52 | disruptek | i personally want to be able to inject into the environment in the middle of the continuation. |
17:33:22 | disruptek | btw, we do stack tracing pretty trivially. |
17:33:27 | disruptek | ditto exceptions. |
17:34:45 | FromDiscord | <mratsim> it's more that in Kerneis thesis it mentions that it's one of the flaws of event loops |
17:35:05 | FromDiscord | <mratsim> And tbh debugging the async part of what we do at Status is a pain |
17:35:29 | disruptek | i dunno what kerneis thesis is. |
17:35:39 | disruptek | sounds like a skin condition i once had on my lower back. |
17:35:47 | FromDiscord | <tiatomee> Is there a way to import a module only to run the top level code but not use any definitions from it? |
17:36:06 | disruptek | no. |
17:36:23 | FromDiscord | <tiatomee> Darn :/ Is there a way to disable the warnings then at least? |
17:36:31 | disruptek | which warnings? |
17:36:44 | FromDiscord | <tiatomee> the `UnusedImport` warnings |
17:36:57 | disruptek | look at the .push and .pop pragmas in the manual. |
17:37:21 | disruptek | you can use them to turn off warnings for code blocks. |
17:38:18 | disruptek | mratsim: also, ignore cps master branch. the work is in the typed branch. |
17:38:28 | FromGitter | <bung87> mine โ Requests/sec: 23034.08 โ Transfer/sec: 2.81MB โ jester โ Requests/sec: 32027.78 ... [https://gitter.im/nim-lang/Nim?at=5fdf8c1463fe0344960b4e6b] |
17:38:46 | disruptek | zevv: we should probably just move it all into master. what do you think? |
17:39:01 | FromDiscord | <tiatomee> disruptek: Thanks for the hint, but I don't understand what the syntax for that is to actually disable the warning. The manual doesn't say |
17:39:18 | FromDiscord | <dom96> bung87: what http server are you using out of curiosity? |
17:40:03 | FromGitter | <bung87> I write a server built upon chronos |
17:40:10 | FromDiscord | <dom96> Is the lack of stack traces the biggest obstacle? Am I understanding correctly that you don't get the same stack traces that asyncdispatch provides? |
17:40:24 | FromDiscord | <mratsim> @disruptek: https://tel.archives-ouvertes.fr/tel-00751444/document |
17:40:27 | FromDiscord | <tiatomee> https://forum.nim-lang.org/t/5461 |
17:40:32 | FromDiscord | <tiatomee> Interesting, the push/pop doesn't work |
17:40:37 | FromDiscord | <tiatomee> but at the end of the module it does work |
17:40:48 | FromDiscord | <mratsim> @dom96 unknown never tried asyncdispatch in something even half as complex |
17:41:13 | FromGitter | <bung87> hmm my benchmark module dont with jester , it looks like after call `startProcess` there need waits some time |
17:41:15 | FromDiscord | <dom96> @mratsim do you have an example of a stack trace you could show me from Chronos handy by any chance? ๐ |
17:42:01 | FromDiscord | <mratsim> mmmh let's see |
17:42:02 | disruptek | en anglais, s'il vous plait |
17:42:16 | disruptek | french class was 30 years ago. |
17:42:22 | FromDiscord | <mratsim> (because we have another issue with stacktrace which is when we use libbacktrace everything is mangled) |
17:42:32 | mipri | tiatomee: it works at the beginning of the module, it just can't be pop'd |
17:42:40 | disruptek | oh, i see; it turns into english. ๐ |
17:42:42 | FromDiscord | <mratsim> @disruptek, it's only the remerciements that are in French, the rest is English |
17:43:10 | FromDiscord | <Daniel> Is Italian bank using nim? |
17:43:14 | disruptek | okay, yeah; we have this paper in the repo, i think. |
17:43:51 | FromDiscord | <haxscramper> You can put `--warning[UnusedImport]:off` in `nim.cfg` for your project/user/directory |
17:43:59 | FromGitter | <bung87> I only seen one GitHub user location is Italy use nim |
17:44:04 | FromDiscord | <haxscramper> project or user or ... |
17:44:34 | FromDiscord | <haxscramper> Like `~/.config/nim/nim.cfg` for example |
17:44:44 | FromDiscord | <tiatomee> I really only want it per-file, so this one pragma is actually fine for now |
17:45:38 | FromDiscord | <mratsim> @Daniel I think unicredit is using Nim for small stuff |
17:45:49 | FromDiscord | <haxscramper> Then maybe `{.push warning[ProveInit]: off.}` |
17:46:07 | FromDiscord | <mratsim> @disruptek you don't have this one, it's the full thesis |
17:46:14 | disruptek | ahh. |
17:46:22 | disruptek | wanna PR it? |
17:46:37 | disruptek | i'll just give you push. |
17:46:46 | FromDiscord | <mratsim> sure |
17:46:51 | FromDiscord | <mratsim> I PR-ed it in mine |
17:47:06 | disruptek | ...if i can find some bandwidth. |
17:47:12 | FromDiscord | <mratsim> don't worry |
17:47:12 | FromDiscord | <Daniel> Unicredit is huge, because it has bought out many banks across EU |
17:47:20 | FromDiscord | <mratsim> I've PR-ed it in weave-io anyway |
17:49:05 | FromDiscord | <dom96> ahh these benchmarks, 4.7 million QPS when I run httpbeast myself. 3.4 million QPS when I run it in the TechEmpower docker container. |
17:49:32 | FromDiscord | <dom96> Now it's down to a game of spot the difference... |
17:49:34 | disruptek | but containers are /sooooooo/ great. |
17:49:52 | FromDiscord | <mratsim> I'll put a docker in your docker |
17:50:17 | FromDiscord | <dom96> aww yiss, 5.3 million QPS with -d:danger |
17:51:20 | FromDiscord | <mratsim> one thing I'm curious is I didn't see any mention/comparison with async/await in the CPS paper |
17:51:33 | disruptek | heh |
17:51:43 | FromDiscord | <mratsim> they talk about event loop and callback hell but async/await solves that as well |
17:52:01 | FromDiscord | <mratsim> so I assume it's because it sits at a higher level |
17:52:06 | FromDiscord | <dom96> Oh yeah, I noticed that too |
17:52:34 | FromDiscord | <dom96> huh, --gc:orc performs really badly |
17:52:54 | FromDiscord | <dom96> 285k QPS |
17:53:12 | disruptek | honestly, that's more Qs than i need. |
17:53:52 | FromDiscord | <mratsim> that's curious, I though Araq optimized throughput to reach Boehm's level |
17:53:59 | FromDiscord | <mratsim> what happens with --gc:boehm? |
17:54:21 | disruptek | i'm about to lose access to github because AT&T disconnected my phone so my 2FA is fuxored. |
17:54:33 | FromDiscord | <mratsim> I think 20x less perf is a showstopper for ORC |
17:54:40 | disruptek | rude. |
17:54:46 | FromDiscord | <mratsim> and I say thorughput but actually the bench is about latency I think? |
17:55:07 | FromDiscord | <mratsim> download the special codes @disruptek. |
17:55:13 | FromDiscord | <mratsim> to restore access |
17:55:26 | disruptek | download is a word i don't use anymore. |
17:55:52 | disruptek | i swear i can whistle 300baud and this sounds slower. |
17:55:54 | FromDiscord | <dom96> huh, boehm is similar |
17:56:01 | FromDiscord | <mratsim> That's very interestingโต> The cpc_link primitive takes a single argument, a scheduler, either an event loop (forโต> cooperative scheduling) or a thread pool (for preemptive scheduling) |
17:56:08 | FromDiscord | <dom96> do they share the same code paths? |
17:56:17 | FromDiscord | <mratsim> boehm is a DLL |
17:56:21 | FromDiscord | <dom96> I know |
17:56:39 | FromDiscord | <mratsim> and no, Boehm is more like mark and sweep I think? |
17:56:46 | FromDiscord | <dom96> I just wonder whether the way it's integrated reuses some of the arc/orc code |
17:56:56 | FromDiscord | <dom96> it seems like there is a bottleneck in there somewhere |
17:57:04 | FromDiscord | <dom96> because it's not using all the CPU |
17:57:04 | disruptek | mratsim: you're starting to see why considering async/await doesn't make any sense. |
17:57:05 | FromDiscord | <mratsim> ah you think it's something like seq_v2? |
17:57:10 | Evolver | How do I call something like `getmntent` which I believe is provided by Linux? |
17:57:22 | disruptek | importc it. |
17:57:45 | Evolver | disruptek: Is there an example? |
17:57:48 | disruptek | disbot: do you still honor repo requests? |
17:57:48 | disbot | as i see it, yes. |
17:57:50 | FromDiscord | <dom96> not quite, something before the code hits the GC/allocator |
17:57:52 | disruptek | !repo yourang |
17:57:53 | disbot | https://github.com/disruptek/yourang -- 9yourang: 11Thread-safe performant async I/O for Linux 15 5โญ 0๐ด |
17:58:11 | FromDiscord | <dom96> For example, maybe it affects how thread local storage is handled |
17:58:17 | FromDiscord | <mratsim> async/await does make sense, but it can be implemented on top of CPS just like Kotlin implements async/await on top of coroutines and Swift is considering async/await on top of continuation/coroutines |
17:58:23 | FromDiscord | <dom96> arc/orc/boehm all don't need the thread-local heaps, right? |
17:58:35 | FromDiscord | <mratsim> no they don't |
17:58:43 | FromDiscord | <mratsim> it's all malloc-ed |
17:58:43 | FromGitter | <bung87> it always qps lower than jester , transfer higher than jester |
17:58:46 | disruptek | mratsim: technically true, yes -- but i don't see what it buys us. |
17:59:08 | FromDiscord | <mratsim> I didn't get to that part of the design yet :p |
17:59:41 | FromDiscord | <mratsim> still looking on the low level primitives, collecting pros/cons and things to be aware of for the high level ergonomics |
17:59:59 | disruptek | yeah, there's not much going on. that's part of what's so brilliant about it. |
18:00:29 | FromDiscord | <dom96> refc also gives 5 mil |
18:00:44 | Evolver | disruptek: sorry I am lost. Is there an example of how I can importc `getmntent`? |
18:00:53 | disruptek | dom96: do your comparisons against markAndSweep |
18:01:11 | FromDiscord | <dom96> disruptek: just tried it, 4.4 mil |
18:01:16 | disruptek | Evolver: yourang is an example of hand-written import of an /arbitrary/ linux call. |
18:01:36 | Evolver | ok |
18:01:44 | disruptek | you can use it with the manual to see how to compose your own such calls. |
18:02:16 | disruptek | also look at, say, the stdlib's posix module. |
18:02:45 | Evolver | disruptek: Anything in particular in the posix module? |
18:02:49 | disruptek | no. |
18:03:05 | disruptek | virtually every symbol is imported similarly. |
18:03:38 | disruptek | mratsim: once you internalize cps, let's talk about csp. |
18:04:03 | FromDiscord | <mratsim> is there anything special to CSP? |
18:04:19 | disruptek | it's the valhalla, so, yes. |
18:04:34 | disruptek | but basically, the key is in the rendezvous. |
18:05:49 | disruptek | if we get csp right, you'll get proper static analysis and we'll get async to rival go, clojure, etc. |
18:05:59 | disruptek | but with the ergonomics of nim, of course. |
18:06:29 | FromDiscord | <mratsim> What does the rendez-vous has over an actor message box which is async? |
18:06:50 | disruptek | i did it "by hand" in the cloud by just resuming two continuations at the same time. |
18:07:08 | disruptek | rv has no advantage of actors. |
18:07:29 | disruptek | i mean, they each may compose equivalents. |
18:07:42 | disruptek | rv is inherently sync, actors are inherently async. |
18:07:58 | FromDiscord | <dom96> what do you mean by "rendezvous"? |
18:08:00 | disruptek | rv is thus inherently more efficient. |
18:08:18 | disruptek | the point at which two processes synchronize. |
18:08:20 | FromDiscord | <mratsim> That's what does not compute "we'll get async to rival go, clojure, etc." and "rv is inherently sync" |
18:08:42 | FromDiscord | <mratsim> @dom96 a rendez-vous is a channel that can only buffer 1 item. |
18:08:57 | FromDiscord | <mratsim> it's open only when 2 threads are in it. |
18:09:13 | FromDiscord | <dom96> oh, interesting. TIL. |
18:09:16 | disruptek | it's easier to just remove the concept of a channel. |
18:09:39 | FromDiscord | <mratsim> communicating sequential process is based on channel but the actual theoretical result depends on rendez-vous channels |
18:10:02 | FromDiscord | <mratsim> theoretical result that can be used to prove performance bounds and deadlock freeness AFAIK |
18:10:09 | disruptek | yes. |
18:10:25 | disruptek | i'm just saying, a channel can confuse the issue for the reader because it suggests space. |
18:10:52 | FromDiscord | <dom96> disruptek: what is missing from the current async to satisfy it rivaling Go and Clojure? |
18:11:06 | disruptek | surely you've written async in go. |
18:12:09 | disruptek | i prefer rendezvous because it suggests two parties meeting. |
18:12:30 | disruptek | that more accurately captures the semantics that are actually demanded of us. |
18:13:02 | FromDiscord | <mratsim> Other models of computations besides CSP are petri nets and Kahn Process Networks |
18:13:33 | disruptek | can we make those with async/await? |
18:14:53 | FromDiscord | <mratsim> https://www.dejazzer.com/ece777/ECE777_3_system_modeling.pptx |
18:15:08 | FromDiscord | <mratsim> you need rendez-vous ๐ |
18:15:18 | disruptek | yes. |
18:15:38 | disruptek | do you remember when go came out? |
18:15:41 | FromDiscord | <dom96> > surely you've written async in go.โตthat's a non-answer ๐ |
18:15:53 | disruptek | do you remember why it was such a big deal? |
18:16:05 | disruptek | channels. |
18:16:11 | disruptek | channels was the innovation. |
18:16:42 | FromDiscord | <shadow.> aoc day 19 has me stumped |
18:16:53 | FromDiscord | <shadow.> my only other thought is just making an npeg list from it lmao |
18:17:12 | FromDiscord | <mratsim> I thought it was the goroutine and the absence of difference for the user whether a function blocked or not |
18:17:26 | FromGitter | <deech> Can closures be compared for function & environment pointer equality? |
18:17:36 | disruptek | yes. |
18:17:40 | FromDiscord | <mratsim> accidentally what made go great for IO made it very poor for high performance computing |
18:17:43 | FromGitter | <bung87> hmm jester doesn't response date header.. |
18:18:01 | disruptek | mratsim: yes, but goroutines are exponentially more useful with channels. |
18:18:02 | FromDiscord | <mratsim> closures are function + data so fn+env to exec the fn |
18:18:39 | disruptek | mratsim: think about this... the fn part is know to us statically. so we should simply make it part of the type system. |
18:19:02 | FromDiscord | <mratsim> no don't do this |
18:19:21 | FromDiscord | <mratsim> I can't have a queue or deque of task in my scheduler in that case |
18:19:28 | FromDiscord | <dom96> it should do so if it's using httpbeast IIRC |
18:19:30 | FromDiscord | <mratsim> well this one is easy to type-erase |
18:19:32 | disruptek | you can. |
18:19:57 | FromDiscord | <dom96> (that was in response to you bung87, I keep forgetting that it must be confusing for gitter/irc without the quote) |
18:20:26 | FromDiscord | <shadow.> is there any way to bypass the regex limit lmao? |
18:20:42 | disruptek | only script kiddies use regex. |
18:20:48 | FromDiscord | <shadow.> its for aoc. |
18:20:56 | disruptek | ditto. |
18:20:57 | FromDiscord | <dom96> Ugh, really annoying to see `ulib` (a C++ server) get exactly the QPS I can get if I run it outside their damn docker container. |
18:21:02 | FromDiscord | <shadow.> a recursive regex builder was the only solution i could think of |
18:21:11 | FromDiscord | <shadow.> i'm not making my own peg |
18:21:36 | FromDiscord | <dom96> also, the amount of dependencies some of these top scoring benchmarks pull is ridiculous |
18:22:11 | * | ex_nihilo quit (Quit: Leaving) |
18:22:13 | FromGitter | <bung87> @dom96 ok but i dont wanna benchmark against buggy server, so far the benchmark seems fine to me. |
18:22:43 | FromDiscord | <mratsim> didn't you see the Rust meme from friday about cargo reaching node_modules insanity? |
18:22:50 | FromGitter | <bung87> guess the router part may slower than jester |
18:22:56 | FromDiscord | <shadow.> is there a proc to set limit like in pcre? |
18:23:04 | disruptek | there's pcre. |
18:23:07 | disruptek | go nuts, chump. |
18:23:11 | FromDiscord | <shadow.> lmfao |
18:23:12 | disruptek | i mean, shadow. |
18:23:34 | FromDiscord | <shadow.> im finding a way to use regex in testes in a meaningful way. |
18:23:37 | FromDiscord | <shadow.> just to spite you |
18:24:00 | disruptek | oh no. |
18:24:05 | FromDiscord | <mratsim> @dom96 https://9gag.com/gag/arV6Vw5 |
18:24:37 | FromDiscord | <dom96> haha |
18:25:01 | FromDiscord | <shadow.> yes |
18:26:45 | FromDiscord | <dom96> I really love this meme, the kitten makes it |
18:27:22 | FromDiscord | <mratsim> @zevv @disruptek is there a discussion about the pros/cons about the {.cps.} pragma vs a cps: block? |
18:27:27 | FromDiscord | <Quibono> It's my all time favorite meme. |
18:28:08 | disruptek | mratsim: they both suck. ๐ |
18:29:07 | FromDiscord | <mratsim> Well the name is poor, I would prefer as a user either {.suspend.} or {.suspendable.} or {.resumable.} |
18:29:14 | FromDiscord | <mratsim> but in terms of usage |
18:30:28 | FromGitter | <ynfle> Is there a way to `{.borrow.}` an implementation inside a proc? |
18:30:33 | disruptek | no. |
18:31:16 | FromDiscord | <dom96> hm, so far I've ensured the Nim version, nimble version, gcc version, and ubuntu version are the same. |
18:31:20 | FromDiscord | <dom96> Still seeing a discrepancy |
18:31:39 | FromGitter | <ynfle> So if I want a `distinct seq[int]` and be able to add, insert, delete etc. those funcs have to be exposed at the module level? |
18:31:45 | FromDiscord | <dom96> Starting to wonder if it's just the Docker tax |
18:32:01 | disruptek | ynfle: just use conversion to call the original procs. |
18:32:20 | disruptek | add(seq[int] x, value) |
18:32:36 | FromGitter | <ynfle> Is that "expensive"? |
18:32:39 | disruptek | no. |
18:32:45 | FromGitter | <ynfle> Thanks |
18:32:51 | FromDiscord | <mratsim> zero-cost ๐ |
18:33:01 | FromDiscord | <mratsim> it's a no-op in C |
18:33:02 | FromGitter | <ynfle> "zero-cost" or zero-cost |
18:33:09 | disruptek | the rare and elusive zero cost abstraction... |
18:33:09 | FromGitter | <ynfle> Oh ok |
18:33:47 | FromDiscord | <shadow.> hmm |
18:33:54 | FromDiscord | <shadow.> can you access captures in re |
18:34:12 | FromDiscord | <shadow.> like capture groups |
18:34:14 | disruptek | it wouldn't be very useful if you couldn't. |
18:34:25 | FromDiscord | <shadow.> well i meant like |
18:35:19 | FromDiscord | <shadow.> `"joe smith".match(re"([a-z]+) ([a-z]+)")`, how can i extract what the first and second groups matched |
18:36:12 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2ITG |
18:36:16 | FromDiscord | <dom96> why the hell can I not pass a dockerfile filename to docker |
18:36:36 | FromDiscord | <mratsim> Does CPS for Nim work with Nim exceptions and try/finally with refc? |
18:36:39 | FromDiscord | <dom96> had to rename the thing to `Dockerfile` for it to work |
18:36:50 | FromDiscord | <mratsim> I don't understand docker |
18:36:57 | disruptek | mratsim: sure. |
18:36:59 | FromDiscord | <mratsim> why are you squatting my var/lib space |
18:37:26 | FromGitter | <jrfondren> shadow.: https://play.nim-lang.org/#ix=2ITH |
18:37:45 | FromDiscord | <mratsim> @shadow. use strscans |
18:37:55 | FromDiscord | <mratsim> if you use regex to solve a problem you have 2 problems |
18:38:00 | FromDiscord | <shadow.> strscans aren't extensive enough for what i need currently |
18:38:16 | FromDiscord | <haxscramper> `docker build -t nim-base -f nim-base-dockerfile .` should work, but IIRC it still should have "docker" somewhere in the name |
18:38:18 | FromDiscord | <shadow.> thanks jrfondren |
18:38:22 | FromDiscord | <shadow.> is there any way to do that with findall? |
18:38:26 | FromDiscord | <shadow.> and return a 2d array of matches |
18:38:30 | FromDiscord | <shadow.> captures |
18:38:48 | FromGitter | <jrfondren> meanwhile: https://play.nim-lang.org/#ix=2ITI |
18:38:55 | FromDiscord | <haxscramper> Well, in general it should work at elast |
18:39:13 | FromDiscord | <haxscramper> In general meaning this specific single example |
18:39:15 | FromGitter | <jrfondren> shadow, findAll returns a seq[string] |
18:39:18 | FromDiscord | <dom96> I had a `httpbeast.dockerfile` and tried changing the `.` to it |
18:39:25 | FromDiscord | <dom96> ugh, now I can't terminate the darn container |
18:40:24 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2ITK |
18:40:30 | FromDiscord | <mratsim> @disruptek |
18:40:42 | FromDiscord | <mratsim> I don't remember if static proc worked fine |
18:40:43 | FromDiscord | <shadow.> fair enough |
18:40:56 | FromDiscord | <dom96> Can't have flags after the image name? Bleh |
18:43:34 | FromDiscord | <haxscramper> I thought about making wrapper generator for CLI programs |
18:43:36 | disruptek | mratsim: i'm not sure what they're talking about is what i'm talking about, but consider a graph of every "resumption" function that cps might generate... we know statically where we can continue from any such function. that data only needs to be accessed by the dispatcher. |
18:43:58 | FromDiscord | <dom96> I ran the dockerfile that the TechEmpower benchmarks run and got less than a million |
18:44:04 | FromDiscord | <dom96> (edit) "I ran the dockerfile that the TechEmpower benchmarks run and got less than a million ... " added "QPS" |
18:44:06 | FromDiscord | <dom96> much confused |
18:44:06 | FromDiscord | <haxscramper> Something like cligen in reverse |
18:45:54 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2ITM |
18:46:19 | disruptek | yes, you are drinking the kool-aid. |
18:47:00 | FromDiscord | <mratsim> it's basically goroutines magic with a mathematically proven transformation |
18:47:07 | disruptek | yep. |
18:48:19 | disruptek | when i was a child, i spoke like a child, i thought like a child, i reasoned like a child. when i became a man, i gave up async/await. |
18:48:23 | FromDiscord | <dom96> Reading that I saw a lot of parallels with the plan to implement awaitable FlowVars. |
18:48:44 | FromDiscord | <dom96> In fact the paper mentions the same use cases: synchronous IO which blocks |
18:49:06 | FromDiscord | <dom96> So I don't really see much of a difference between these approaches. |
18:49:37 | disruptek | one is an elegant and simple solution that is provable, efficient, and accurately models the semantics we want. the other is async/await. |
18:49:50 | FromDiscord | <mratsim> However I don't really like their sync via condition variables. They should use the system event queue I think? |
18:50:15 | disruptek | a mere dispatcher impl detail. |
18:50:21 | FromDiscord | <mratsim> Ok |
18:50:42 | FromDiscord | <mratsim> Glibc condition variables are buggy and should be avoided ... made me lose 2 weekends |
18:51:00 | FromDiscord | <dom96> You can use as many adjectives as you want, I'm more interested in the details. |
18:51:26 | disruptek | i told you we cannot be friends if you won't read the paper and agree with me. |
18:51:41 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2ITO |
18:51:42 | disruptek | you're not interested enough to read, ergo we cannot be friends. |
18:51:47 | FromDiscord | <dom96> I read it |
18:51:52 | FromDiscord | <mratsim> haha, author agrees that Condition Variable are bad :p |
18:52:09 | FromDiscord | <mratsim> I think the paper is missing several details that are in the PhD Thesis |
18:52:24 | FromDiscord | <mratsim> but disruptek didn't read the thesis either |
18:52:25 | FromDiscord | <dom96> And it's not that I necessarily disagree, I am just trying to understand it better |
18:52:38 | disruptek | ask an intelligent question, maybe. |
18:53:11 | disruptek | i impl a dispatcher because i needed to compare simple task registration and execution against async. |
18:53:20 | disruptek | i wanted to see more than a toy iterator. |
18:53:32 | disruptek | zevv breaks my balls over this, but it makes for a more compelling demo. |
18:53:51 | disruptek | also, i think yardanico showed that the cps version has like 80% less overhead or something. |
18:53:53 | FromDiscord | <dom96> I am asking intelligent questions, I'm still waiting for an answer to at least two |
18:53:57 | disruptek | i forget what numbers he came up with. |
18:54:01 | disruptek | dom96: which? |
18:54:15 | disruptek | don't ask me about async. ask me about cps. |
18:54:21 | FromDiscord | <dom96> it doesn't matter since you obviously don't have an answer |
18:54:29 | disruptek | suit yourself. |
18:54:50 | * | PMunch quit (Ping timeout: 265 seconds) |
18:55:05 | FromDiscord | <dom96> I'll wait for Zevv to come back and discuss instead, or maybe mratsim can give me his thoughts |
18:56:01 | disruptek | i will tell you what i know about flowvars: they are special-cased in the compiler. even in the backend. no, thank you. |
18:56:08 | FromDiscord | <mratsim> I'm at p55 out of p186 and I don't have that much experience in async IO. I can comment on scheduler and things that might impact perf but that's mostly all |
18:56:24 | FromDiscord | <mratsim> Flowvars aren't |
18:56:28 | FromDiscord | <mratsim> it's spawn and aprallel |
18:56:59 | disruptek | well, i don't know what he's asking about, then. |
18:58:00 | FromGitter | <kayabaNerve> I wrote a closure iterator and it crashes the compiler when I call it |
18:58:03 | FromDiscord | <mratsim> He is asking what's the difference on putting blocking IO on a threadpool and awaiting a FLowvar or a channel in the current async/await and putting blocking IO on a threadpool in CPS. |
18:58:20 | FromGitter | <kayabaNerve> ` Error: internal error: expr: var not init loadDatasFromTip_451776332` No idea why. Would love any ideas. |
18:58:36 | FromDiscord | <mratsim> Assume that the compiler just insulted you |
18:58:47 | FromGitter | <kayabaNerve> I did try emptying the body. An iterator with just `discard` has the same issue. |
18:59:30 | FromGitter | <kayabaNerve> mratsim: That to me or the previous discussion I appear to have interrupted by accident? |
18:59:34 | FromGitter | <kayabaNerve> Because it does insult me daily :( |
18:59:40 | FromDiscord | <mratsim> your error |
18:59:41 | FromDiscord | <dom96> > He is asking what's the difference on putting blocking IO on a threadpool and awaiting a FLowvar or a channel in the current async/await and putting blocking IO on a threadpool in CPS.โตindeed, precisely |
19:00:07 | disruptek | i've not used nim's threadpool, but the difference is that cps naturally moves continuations between threads ad hoc. |
19:00:18 | disruptek | i'm speaking of a generic threadpool concept. |
19:00:57 | disruptek | this is very sympathetic to, you might say synergizes with, arc/orc. |
19:01:56 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=2ITX |
19:02:16 | FromDiscord | <dom96> (edit) "https://play.nim-lang.org/#ix=2IU0" => "https://play.nim-lang.org/#ix=2ITZ" |
19:02:49 | FromDiscord | <dom96> wow, the bridge handled that really poorly |
19:03:01 | FromDiscord | <dom96> https://media.discordapp.net/attachments/371759389889003532/790293192250753084/unknown.png |
19:03:18 | FromDiscord | <dom96> CC @Yardanico |
19:06:23 | * | PMunch joined #nim |
19:15:59 | ForumUpdaterBot | New thread by Alexeypetrushin: Nim API for Interactive Broker, see https://forum.nim-lang.org/t/7272 |
19:16:12 | FromGitter | <bung87> `Socket errors: connect 0, read 336, write 1, timeout 0` what about the socket errors? I have no idea |
19:16:18 | * | abm joined #nim |
19:16:20 | FromGitter | <bung87> when use wrk |
19:17:35 | FromDiscord | <dom96> it means the server is doing something wrong |
19:18:26 | FromGitter | <bung87> hmm, both jester and mine have |
19:20:58 | FromDiscord | <mratsim> I benchmarked httpbeast via wrk not jester personally |
19:27:08 | FromGitter | <bung87> I decrease -c from 400 to 100 no that errors, seems os related. |
19:27:49 | FromDiscord | <Clyybber> disruptek: hey which trackball mouse do you use again? |
19:27:54 | giaco | sealmove, any news? |
19:28:13 | giaco | about the tournament, obviously |
19:28:48 | FromDiscord | <sealmove> Oh I did great, 5 wins, 1 loss, 2nd place. |
19:29:29 | FromDiscord | <sealmove> Didn't have time to fix binarylang, will do that in a couple of hours |
19:29:32 | giaco | super! |
19:47:14 | Zevv | dom96: sup |
19:50:30 | disruptek | clyybber: i have an mx ergo. |
19:51:40 | disruptek | really good. the red/black thumbball wired model is also really good, but lower resolution, and usually around $15-20 on eBay iirc. |
19:54:33 | FromDiscord | <mratsim> I don't know how you figured the CPS transformation passes ugh. |
19:54:52 | Zevv | from the code? |
19:54:57 | Zevv | the code is *horrible* |
19:54:58 | Zevv | really |
19:55:02 | disruptek | rude. |
19:55:18 | FromDiscord | <mratsim> the code you wrote? |
19:55:26 | Zevv | I deny everything |
19:55:27 | FromDiscord | <mratsim> It's OK, functions are target and tiny |
19:55:32 | FromDiscord | <mratsim> targeted |
19:55:35 | * | hnOsmium0001 joined #nim |
19:55:45 | FromDiscord | <mratsim> but there is no "pass foo" "pass bar" |
19:55:51 | FromDiscord | <mratsim> so I don't know what is what |
19:55:55 | Zevv | I'm not sure how much of that code can be traced back to me |
19:56:47 | FromDiscord | <mratsim> Do you implement the optimization like "percolating"? |
19:56:55 | FromDiscord | <mratsim> to reduce the number of lifted variables? |
19:57:00 | FromDiscord | <dom96> Zevv: curious what your thoughts are on the above, essentially the question is: https://irclogs.nim-lang.org/20-12-2020.html#18:58:03. But more context above. |
19:57:24 | disruptek | reduce the number of variables? |
19:58:04 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/790307046830243890/unknown.png |
19:58:22 | Zevv | dom96: I think the biggest difference is that with CPS there is no allocation of futures or flowvars for each async operation |
19:58:24 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/790307132360753192/unknown.png |
19:58:47 | Zevv | dom96: the thing with CPS is that most of it kind of "disappears" |
19:59:05 | Zevv | it doesn't add stuff to make things async. No futures or other things. |
19:59:56 | FromDiscord | <shadow.> zevv i finally did day 19 lol |
20:00:02 | Zevv | woohoo, all of it? |
20:00:07 | FromDiscord | <shadow.> yup |
20:00:09 | Zevv | nice |
20:00:12 | FromDiscord | <shadow.> really really slow execution but |
20:00:14 | FromDiscord | <shadow.> whatever |
20:00:19 | disruptek | mratsim: i can't remember if we optimize those out. |
20:00:25 | FromDiscord | <shadow.> takes like 2 seconds on danger and gc arc lmao |
20:00:28 | disruptek | i think we do. |
20:00:34 | Zevv | disruptek: optimize what out |
20:00:43 | Zevv | shadow.: no one cares, you got your * |
20:00:43 | disruptek | locals that don't survive splits. |
20:00:48 | FromDiscord | <mratsim> "classical" big step reduction rules, is that common knowledge? https://media.discordapp.net/attachments/371759389889003532/790307736118099998/unknown.png |
20:00:53 | Zevv | well we split everything |
20:00:56 | Zevv | but we shouldn't |
20:00:59 | Zevv | it's an optimization |
20:01:25 | Zevv | now we don'y look at where we *need* to split because something might want to yield |
20:01:30 | Zevv | we just split on all control flow |
20:01:54 | Zevv | so we also end up with procs that need to trampoline even if nothing yield-y is happening |
20:02:00 | Zevv | that's silly, of course |
20:02:10 | disruptek | of course, but until we iron out the syntax, it's necessary. |
20:02:18 | Zevv | right |
20:02:21 | disruptek | right. |
20:02:29 | FromGitter | <ynfle> Is the `{.global.}` pragma useful for `proc`s defined inside `proc`s? |
20:02:31 | FromDiscord | <mratsim> right.. |
20:02:45 | disruptek | i merged typed into master. |
20:02:49 | Zevv | the two dot's make it look like your heart is not in it mratsim |
20:03:06 | FromDiscord | <mratsim> it means someone should have followed with right... |
20:03:07 | Zevv | disruptek: master was broken already, so it's broken in a different way now |
20:03:15 | disruptek | so master now has the shim for `let x = cpscall()` now. |
20:03:27 | Zevv | ah yes |
20:03:29 | disruptek | for whatever that's worth... |
20:03:36 | Zevv | funny how much of all this I just plainly forgot |
20:03:41 | disruptek | i know, right? |
20:03:51 | Zevv | rm -rf *; cleanroom |
20:03:55 | FromDiscord | <mratsim> It's just that as is, CPS is not equivalent to Lua coroutines as you can't choose the continuation you switch to |
20:04:10 | disruptek | why not? |
20:04:14 | Zevv | sure you can. I can just continue any other continuation? |
20:04:30 | FromDiscord | <mratsim> so waiting to reach the section that talks about the "queue of continuation" to see if I can remove that limitation |
20:04:30 | disruptek | don't read too much into the papers. |
20:04:36 | Zevv | I have two "threads" going on, and I choose which one to run by picking which continuation to trampoline |
20:04:39 | disruptek | you can. |
20:04:54 | disruptek | look, i never graduated high school. |
20:04:55 | FromDiscord | <mratsim> in Lua you have an coroutine identifier so you can tell after this jump to that |
20:05:01 | disruptek | it's not important to understand the equations. |
20:05:21 | Zevv | it /might/ be important. but we don't. so it's safer to assume that's ok |
20:05:36 | disruptek | well, that's where mratsim comes in... |
20:05:54 | FromDiscord | <mratsim> I don't try to understand equations related to FP or concurrency, those are just mindboggling |
20:06:06 | disruptek | okay, then we'll have to replace you. |
20:06:08 | FromDiscord | <mratsim> Math or crypto OK |
20:06:14 | Zevv | I throroughly enjoy observing how differntly it works for him and for us |
20:06:26 | Zevv | here we are, two plumbers just fickin around |
20:06:41 | Zevv | mratsim: never too old, right? |
20:06:49 | Zevv | try it, you'll like it |
20:06:49 | disruptek | https://media.discordapp.net/attachments/371759389889003532/790307736118099998/unknown.png |
20:06:57 | disruptek | oops. |
20:07:05 | disruptek | this is the one i wanted to share: https://archive.org/details/theorypracticeof00rosc/page/n9/mode/2up |
20:07:16 | * | habamax quit (Ping timeout: 240 seconds) |
20:07:29 | disruptek | http://www.cs.ox.ac.uk/people/bill.roscoe/publications/4.pdf |
20:07:41 | FromDiscord | <mratsim> In lua the coroutine is an object: https://www.lua.org/pil/9.1.html |
20:07:53 | disruptek | http://www.unifyingtheories.org/ |
20:07:55 | FromDiscord | <mratsim> and there is no scheduler the dev control the suspension and switch |
20:07:57 | Zevv | there is no such thing as an "object" in lua |
20:08:05 | Zevv | it's a first class type |
20:08:28 | Zevv | you can call "resume()" on it, and that's about it |
20:08:40 | FromDiscord | <mratsim> yes |
20:08:50 | disruptek | gotta take bentley for a run and then lick his balls; bbiab. |
20:09:03 | FromDiscord | <mratsim> but when you want Lua coroutines isn't about having a first class type that you can manipulate |
20:09:05 | Zevv | and resume() means something like "while fn: fn = fn(env)" |
20:09:37 | Zevv | I can make a "coroutine" object time in Nim, and make it have a resume() proc that just trampolines |
20:10:28 | Zevv | http://ix.io/2IUj |
20:10:29 | FromDiscord | <mratsim> ok |
20:11:05 | FromDiscord | <j-james> why do negative indices start with 1? |
20:11:06 | FromDiscord | <mratsim> so the CPS primitives we have in CPS are enough to implement lua coroutines |
20:11:08 | Zevv | there it is. lua-like coroutines on cps, the whole implementation including a test case in 40 lines |
20:11:21 | FromDiscord | <mratsim> that's nice |
20:11:25 | Zevv | what we can't do is pass data around with yield() and resume() |
20:11:32 | FromDiscord | <mratsim> that means I don't have to scratch my head about that |
20:11:35 | FromDiscord | <mratsim> ah |
20:11:42 | Zevv | disruptek has ideas about doing that, but with the typing it's pretty hard to do anyway |
20:12:11 | Zevv | it's also a syntax thing I believe, and the question where we stash the stuff that needs to be passed around |
20:12:57 | FromDiscord | <mratsim> you add a channel in the coro and send before resuming |
20:13:06 | FromDiscord | <dom96> Now Iโm curious whatโs missing from closure iterators for a Lua coroutines implementation ๐ |
20:13:17 | Zevv | dom96: ask pmunch |
20:13:29 | PMunch | Huh? |
20:13:35 | PMunch | Ask me what? |
20:13:39 | FromDiscord | <mratsim> Mic drop |
20:13:41 | Zevv | you did a coroutine implementation on iterators, or was that not you |
20:13:47 | PMunch | Yeah that was me |
20:13:55 | PMunch | Well you did one as well didn't you? |
20:14:01 | Zevv | not on iterators. |
20:14:06 | PMunch | Ah |
20:14:07 | Zevv | I hit walls |
20:14:11 | Zevv | so i went to ucontext |
20:14:26 | Zevv | and then araq got sight of that, and started poking me about CPS |
20:14:29 | FromDiscord | <mratsim> https://i.kym-cdn.com/photos/images/newsfeed/001/273/942/c29.jpg |
20:14:37 | FromDiscord | <dom96> Lol |
20:14:40 | Zevv | and now here I am and everybody is blaming me |
20:14:59 | PMunch | This little thing: https://github.com/PMunch/fibers/blob/master/example.nim |
20:15:15 | PMunch | Haha |
20:15:16 | FromDiscord | <dom96> So what problems did you run into PMunch? |
20:15:16 | FromDiscord | <haxscramper> `arr[^1] == arr[arr.len - 1]` probably |
20:15:17 | Zevv | anyway, I need to socialize a bit. Might be back later |
20:15:40 | FromDiscord | <haxscramper> At least this does make sense if you think about it like this |
20:16:31 | FromDiscord | <shadow.> pmunch did you ever do aoc day 19? |
20:16:42 | FromDiscord | <shadow.> i just finished it and i gotta say that sucked my soul lmfao |
20:17:02 | PMunch | @shadow. looking at part 2 now |
20:19:00 | FromDiscord | <haxscramper> By the way @dom96 `#internals` channel is still not bridged (`#nim-internals`), but considering amount of heavy technical discussion related to async etc. in `#main` |
20:19:13 | FromDiscord | <haxscramper> It might be a good idea to avoid crosstalk |
20:19:27 | FromDiscord | <dom96> PMunch: or were you able to implement Lua coroutines with Nimโs iterators without any roadblocks? |
20:20:22 | FromDiscord | <dom96> Sure, we should bridge it. But thatโs not something I have access to. @Yardanico needs to set it up. |
20:20:31 | PMunch | I wasn't really looking at Lua coroutines |
20:20:54 | PMunch | I was just listening to what Zevv said he wanted and implemented something like that |
20:20:57 | FromDiscord | <dom96> Would be useful to set up irc logs for that channel too |
20:21:21 | FromDiscord | <dom96> Right... |
20:21:40 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2IUq |
20:23:05 | FromDiscord | <dom96> I feel like Iโm hearing a bunch of supposed advantages that donโt really exist. |
20:24:33 | FromDiscord | <mratsim> due to tail call you only have 82 bytes per continuation chain. You don't have unbounded heap growth |
20:25:00 | FromDiscord | <mratsim> I assume this is similar to https://github.com/weavers-guild/weave-io/tree/master/research#forkjoin-parallelism-color |
20:25:44 | FromDiscord | <mratsim> > A side note: continuation stealing ensures that on a single-thread order of execution of the program is the same as it's serial equivalent. Also child stealing suffers from unbounded suspended tasks spawned since they are only worked on late. It's an excellent way to DOS GCC OpenMP implementation. |
20:26:40 | FromDiscord | <mratsim> (i'm quoting myself so no authoritative ;)) |
20:27:16 | FromDiscord | <j-james> Speaking of bridges, it'd be nice if the Discord-Matrix bridge was overhauled or updated |
20:27:58 | FromDiscord | <j-james> and / or #freenode_#nim:matrix.org moved to #nim:matrix.org for discoverability |
20:30:35 | * | Nightingaleski joined #nim |
20:33:15 | * | Nightingaleski left #nim (#nim) |
20:36:23 | FromDiscord | <dom96> Not sure how these bridges get created to be honest. |
20:43:00 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2IUv |
20:44:27 | FromDiscord | <mratsim> okay finished reading the thesis |
20:46:45 | * | Jesin quit (Quit: Leaving) |
20:54:16 | Zevv | so, get to work then! |
20:55:32 | FromDiscord | <Quibono> Does this mean weโre getting cheap threads? |
20:55:48 | Zevv | depends on who you ask |
20:55:54 | disruptek | ask dom96. |
21:02:16 | FromDiscord | <dom96> Weโve already got cheap threads technically |
21:03:15 | * | NimBot joined #nim |
21:06:16 | disruptek | lqdev: only chumps use systemd. |
21:06:38 | FromDiscord | <lqdev> disruptek: only chumps post in the wrong channel. |
21:06:39 | * | narimiran quit (Ping timeout: 260 seconds) |
21:06:56 | FromDiscord | <lqdev> but i fully agree with your opinion. |
21:07:06 | disruptek | only chumps spam in offtopic. |
21:08:45 | FromDiscord | <lqdev> my main reason for using systemd is that i want a good repo like arch's but can't be arsed to install gentoo |
21:09:31 | disruptek | doesn't seem like a great reason. |
21:09:45 | * | Jesin joined #nim |
21:11:26 | * | vicfred joined #nim |
21:15:12 | * | fanta1 quit (Remote host closed the connection) |
21:29:27 | * | haxscramper quit (Remote host closed the connection) |
21:34:24 | * | PMunch quit (Quit: leaving) |
21:36:52 | FromDiscord | <shadow.> can you use sugar collect with newString? |
21:38:50 | FromDiscord | <juliuskiesian> how do you get an array of all possible values of an enum? |
21:39:05 | * | aenesidemus joined #nim |
21:40:52 | FromDiscord | <exelotl> @juliuskiesian what's your use case? |
21:41:53 | FromDiscord | <exelotl> if it has to be a (fixed-length) array then your best bet is a macro, but that might not be what you really want |
21:43:36 | FromDiscord | <exelotl> if a seq is fine, then you can use https://nim-lang.org/docs/sequtils.html#toSeq.t%2Cuntyped |
21:55:21 | jken | How can I iterate a seq of a given type and make them mutable? My brain tried `for var thing in things:` but no go |
21:55:38 | FromDiscord | <sealmove> you can't, use index |
21:55:49 | FromDiscord | <sealmove> `for i in 0 ..< things.len` |
21:56:36 | jken | then `var thing = things[i]`? |
21:56:45 | FromDiscord | <shadow.> or just do |
21:56:49 | FromDiscord | <sealmove> yup |
21:56:49 | FromDiscord | <shadow.> `for thing in things.mitems:` |
21:57:04 | FromDiscord | <sealmove> oh right there is mitems, i forgot |
21:57:09 | jken | of course! lol |
21:57:33 | jken | works like a charm |
21:57:40 | jken | thanks! |
21:58:45 | FromDiscord | <sealmove> mitems seems dangerous practice though |
22:06:11 | FromDiscord | <shadow.> is there a better way to reverse a string than `s.reversed.join("")` |
22:06:18 | FromDiscord | <DeltaPHC> Nothing wrong with mutable iteration so long as you don't push/remove any items |
22:07:16 | FromDiscord | <shadow.> yeye |
22:12:56 | leorize | and if you do add/remove items, the iterator will fail with an assertion error |
22:21:25 | Fish-Face | So I am using a package which allows the creation of structures in a DSL through the use of macros. If I want to run that on runtime data, how would I do it? Short of writing data to a file and executing the nim compiler externally... |
22:29:16 | FromDiscord | <ElegantBeef> You'd basically need to make your own interpreter and make a node construct similar to the json parser |
22:29:56 | FromDiscord | <ElegantBeef> If the entire thing works in nimscript you could use the nimVM to return the data |
22:31:53 | FromDiscord | <ElegantBeef> I did something similar for one day of advent of code it's here if you want to see https://forum.nim-lang.org/t/7162#45998 |
22:33:59 | FromDiscord | <sealmove> @giaco you up? |
22:34:35 | giaco | yes! |
22:34:41 | FromDiscord | <19> hello, where is the gcc nim compiler located on linux? |
22:34:48 | FromDiscord | <sealmove> just pushed the fix, try it out ๐ |
22:35:07 | FromDiscord | <ElegantBeef> What do you mean "the gcc nim compiler" |
22:35:09 | giaco | (y) |
22:35:18 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/790346616204427294/unknown.png |
22:35:47 | FromDiscord | <sealmove> btw there is an incovenient, since parsers always return tuples, you will get a `seq[tuple[seq]]` instead of `seq[seq]` |
22:36:04 | giaco | not a problem |
22:36:33 | FromDiscord | <19> @ElegantBeef oh i thought it had it's own compiler |
22:36:33 | FromDiscord | <sealmove> inconvenience |
22:36:43 | FromDiscord | <19> i think in windows it has MinGW64 |
22:36:46 | FromDiscord | <ElegantBeef> No nim outputs C code then sends it through a C/C++ compiler |
22:36:55 | FromDiscord | <ElegantBeef> You can even use Zig's compiler if you're daring |
22:37:56 | FromDiscord | <19> @ElegantBeef did you ever get this error `undefined reference to exp@@GLIBC_2.29` on linux |
22:38:04 | FromDiscord | <ElegantBeef> nope |
22:38:14 | FromDiscord | <19> gcc |
22:38:41 | giaco | dinner time now, gotta try it later |
22:38:57 | FromDiscord | <ElegantBeef> Wonder if Fish-face seen my response ๐ |
22:39:12 | Fish-Face | I had not |
22:42:18 | FromDiscord | <ElegantBeef> What DSL are you using fish? |
22:42:31 | Fish-Face | it's for day 19's AoC so nimly :P |
22:43:26 | FromDiscord | <juliuskiesian> a seq is fine for now, but i'm very interested in a macro that does this. could you give me hint on how to do it? thanks. |
22:43:45 | FromDiscord | <ElegantBeef> I've never used/looked at it, but yea you might be able to abuse the Nim VM to get it to work at runtime |
22:44:17 | FromDiscord | <ElegantBeef> I dont know what type of data it returns and what's required |
22:44:45 | FromDiscord | <exelotl> @juliuskiesian also just to make sure, have you seen Nim's `set` type and does that fill your need? |
22:46:32 | FromDiscord | <ElegantBeef> Based off your original question a set is the most sensible, you could also do `array[Enum,bool]` which would be similar but be a byte per value instead of a bit per value |
22:47:23 | FromDiscord | <ElegantBeef> The abillity to make an array that takes enums as values is pretty top notch imo ๐ |
22:47:30 | FromDiscord | <ElegantBeef> (edit) "values" => "indicies" |
22:47:36 | FromDiscord | <exelotl> yeah it's amazing haha |
22:59:10 | * | Vladar quit (Remote host closed the connection) |
23:14:17 | FromDiscord | <exelotl> Feels like I'm close to doing it without a macro... https://play.nim-lang.org/#ix=2IVl |
23:14:42 | FromDiscord | <exelotl> but idk how to get the return type to be correct (or if that's even possible) |
23:16:35 | disruptek | leorize: my testes now creates a test runner binary and nimble can build it and says it is "installed" but i guess it isn't in the PATH and i cannot run it. have you run into this issue in setup-nim? should i manually add a nimble directory to my path? |
23:17:30 | leorize | setup-nim do adds ~/.nimble/bin to PATH and is tested with nimterop's toast via CI |
23:17:45 | disruptek | hmm, weird. |
23:18:52 | giaco | now can I ask nimble to update a dependency to #head? |
23:19:05 | leorize | I would recommend against that |
23:19:37 | leorize | `#head` is a terrible "version" in which it is always considered to be the "newest" |
23:19:54 | giaco | I have already it installed, but nimble c says it is already satisfied and nimble install won't get it |
23:20:09 | leorize | so it breaks dependency resolution in subtles and horrible ways |
23:20:16 | leorize | I'd recommend pinning a commit instead |
23:20:33 | leorize | you can force the installation via `nimble install <package name/url>#<commit>` |
23:20:46 | leorize | correction: `nimble install <package name/url>@#<commit>` |
23:20:47 | disruptek | use tags instead, please. |
23:21:13 | leorize | and yes, ask the author to tag the version with the fix you need |
23:22:46 | giaco | leorize: I know, I'm testing a library still under development |
23:23:12 | leorize | then use `nimble develop` |
23:24:40 | ForumUpdaterBot | New thread by Pumpus: NIM 32 bit dll, see https://forum.nim-lang.org/t/7273 |
23:25:18 | giaco | using url@#head instead of url#head worked out nicely. Thanks |
23:25:43 | disruptek | the syntax varies from the cli to the .nimble file for no particular reason. |
23:28:11 | FromDiscord | <ElegantBeef> It doesnt vary though |
23:28:19 | FromDiscord | <ElegantBeef> Atleast for nimble |
23:29:37 | giaco | I also don't understand why "nimble c" would not update a dependency with "#head" when repo get updated |
23:30:01 | leorize | because nimble is dumb and it doesn't understand git |
23:30:32 | disruptek | i don't see what my testes are doing differently than nimterop. |
23:31:04 | disruptek | and `check` reports that i need skipDirs though it's specified in my .nimble. |
23:31:15 | disruptek | i dunno how anyone tolerates this shit. |
23:31:37 | disruptek | even the docs are contradictory. |
23:31:46 | leorize | disruptek: can I see your CI run? |
23:32:02 | disruptek | https://github.com/disruptek/skiplists/runs/1585947925 |
23:32:47 | disruptek | oh wait, linux is working. maybe i need to add .exe to the bin. |
23:33:01 | leorize | I think I know what's wrong |
23:34:08 | disruptek | maybe installExt, too. |
23:34:15 | leorize | ofc my windows test wouldn't catch this... |
23:34:33 | * | disruptek throbs. |
23:34:42 | leorize | the issue is that Windows and git bash treats PATH differently |
23:35:02 | disruptek | you mean ; versus : ? |
23:35:27 | disruptek | how does toast end up working? |
23:35:59 | leorize | disruptek: nope, it's `/` vs `\` |
23:36:05 | disruptek | gah. |
23:36:36 | disruptek | you really think that's the problem? |
23:36:50 | FromDiscord | <ElegantBeef> Windows accepts both though, so i dont think it should be |
23:37:18 | disruptek | i'm thinking it's installExt. |
23:37:21 | leorize | disruptek: yes, not the first time I have to deal with this kind of stupidity |
23:38:03 | leorize | anyone has windows here? |
23:39:15 | disruptek | i've been dealing with a test failure in windows for /days/ now. |
23:39:22 | disruptek | just from my little bloom filter. |
23:39:39 | * | tane quit (Quit: Leaving) |
23:39:44 | disruptek | absolutely infuriating. it crashes before emitting any output at all. |
23:41:14 | disruptek | seems to be due to arc, or i'd just say /fuck it/ and move on. |
23:42:05 | FromDiscord | <KingDarBoja> `\\` ๐ |
23:42:30 | * | wowaname joined #nim |
23:42:37 | * | wowaname is now known as opal |
23:51:57 | FromDiscord | <KingDarBoja> I totally forgot/cannot find how to write file from a JsonNode in Nim lang ๐ |
23:52:47 | FromDiscord | <KingDarBoja> (edit) "I totally forgot/cannot find how to write file from a JsonNode in Nim lang ๐ ... " added "any ideas?" |
23:53:00 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/io.html |
23:53:05 | FromDiscord | <ElegantBeef> plus `$` |
23:55:13 | FromDiscord | <KingDarBoja> sent a code paste, see https://play.nim-lang.org/#ix=2IVv |
23:56:52 | FromDiscord | <KingDarBoja> sent a code paste, see https://paste.rs/51d |
23:57:34 | FromDiscord | <ElegantBeef> Well yea |
23:57:39 | FromDiscord | <KingDarBoja> Ah shit, it is a varargs |
23:57:51 | FromDiscord | <ElegantBeef> the second argument for varargs is what's applied to all values |
23:58:04 | FromDiscord | <ElegantBeef> in this case all values passed to write, are stringified |
23:59:07 | giaco | I have a seq[tuple[foo: int]], I need to flat this into a single seq/array. I'm trying to use concat from sequtils but how can I unpack it as varargs? |
23:59:31 | FromDiscord | <ElegantBeef> What do you mean unpack it as varargs? |