00:00:12 | FromDiscord | <tiatomee> Don't mind me. There was another error popping up somewhere else but it was unrelated |
00:00:15 | FromDiscord | <tiatomee> Thanks a lot @nikki |
00:00:26 | FromDiscord | <tiatomee> also you elegantbeef for trying 😬 |
00:02:01 | FromDiscord | <InventorMatt> Giaco: maybe this will help https://peterme.net/handling-files-in-nim.html |
00:05:06 | * | fanta1 quit (Remote host closed the connection) |
00:06:20 | giaco | InventorMatt thanks! -d:binaryparseEcho is quite difficult to read, but I will try |
00:07:03 | FromDiscord | <tiatomee> How can I give a `nil` literal a type? |
00:08:48 | FromDiscord | <nikki> nil.T maybe |
00:09:00 | FromDiscord | <nikki> depends if it's named or anonymous type tho |
00:09:15 | FromDiscord | <nikki> !eval echo (ptr int)(nil) |
00:09:16 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <ptr int> |
00:09:28 | mipri | !eval var q = cast[ref int](nil); new(q); q[] = 2; echo q[] |
00:09:31 | NimBot | 2 |
00:09:50 | FromDiscord | <tiatomee> It's the same procedural type 🙃 I'm writing a macro to organise my AoC solutions and I'm doing that with closures |
00:09:50 | FromDiscord | <nikki> !eval (ptr int)(nil) |
00:09:51 | NimBot | Compile failed: /usercode/in.nim(1, 10) Error: expression 'ptr int(nil)' is of type 'ptr int' and has to be used (or discarded) |
00:10:13 | FromDiscord | <nikki> cool i think that ^ works for this type at least but yeah also nil.T works if the name is T |
00:11:20 | FromDiscord | <tiatomee> Thank you very much! |
00:11:39 | * | krux02 quit (Remote host closed the connection) |
00:25:33 | giaco | InventorMatt failing hard to find out what's wrong with my proc return type that binaryparse doesn't like |
00:28:35 | FromDiscord | <InventorMatt> do you have some code you could show with it? |
00:29:21 | giaco | InventorMatt I've already posted it -> https://termbin.com/5yfw |
00:30:20 | giaco | InventorMatt and this is the line that is complaining about my return code: https://github.com/PMunch/binaryparse/blob/5f8f4a745ffded841975cd1166b328ee843ff81a/binaryparse.nim#L115 |
00:32:45 | giaco | I'm now using tuple[foo: uint8] as proc return type instead, but same error |
00:34:52 | FromDiscord | <Rebel> Is there a PE parser in Nim? |
00:35:22 | FromDiscord | <ElegantBeef> Nah no physical education parser |
00:37:16 | FromDiscord | <Rebel> Portable Executable... |
00:40:22 | FromDiscord | <Rebel> guess I could always just use PeNet and if I really wanted to load that assembly in Nim after hosting the CLR with new winim module |
00:41:41 | FromDiscord | <Rebel> might have to do IL weaving with costura and fody though |
00:41:55 | * | Fish-Face joined #nim |
00:42:13 | FromDiscord | <Cohjellah> Yo is there anywhere like leetcode and hackerrank but it's in the form of AoC where you only need to enter the answer? |
00:42:27 | FromDiscord | <Cohjellah> Because websites like leetcode don't support Nim... Yet ;) |
00:42:37 | Fish-Face | does projecteuler count |
00:43:31 | mipri | http://rosalind.info/problems/locations/ |
00:51:37 | * | klaufir_ quit (Ping timeout: 260 seconds) |
01:14:29 | * | a_chou joined #nim |
01:14:33 | giaco | maybe I can reroute my binaryparse question. While parsing the Ogg header, I get a field that contains "the 27th byte of each page specifies the number of segments it contains, ranging from 0 to 255. This is also the size of the following segment table in bytes. Each byte of the segment table provides the length of a segment" but I have no idea how to accomplish that following binaryparser template |
01:14:35 | giaco | rules |
01:16:15 | giaco | so I'm able to read this array of bytes that contains the lengths of the next field, but I don't know how to create such field |
01:16:59 | giaco | as it's length is dynamic, and math.sum(lengths_array) returns something strange |
01:26:35 | Fish-Face | finally got part 2 of yesterday's AoC. I solved the first part in a way that didn't make the same data structure optimisation as every other AoC task this year required... and then that was not good enough for part 2 and I had to do it anyway |
01:27:12 | FromDiscord | <ElegantBeef> day18? |
01:27:22 | Fish-Face | no, 17 |
01:41:37 | Fish-Face | Zevv: I ended up using nimly to do the parsing btw. It worked in the end. I think I don't care about having to create a lexer separately, though it's a bit clunky. In comparison to npeg though the DSL is quite nice and it allows you to construct your AST or whatever with no bookkeeping structures which is great. (in fact for this AoC problem you can skip creating a tree and just emit an integer). |
01:42:10 | Fish-Face | just a shame that you can't re-use a parser, and you can't create two different parsers from the same lexer |
01:45:14 | FromDiscord | <shadow.> hmm |
01:45:26 | FromDiscord | <shadow.> i feel like |
01:45:30 | FromDiscord | <shadow.> day 17 was actually one of the easiest days lmao |
01:45:31 | FromDiscord | <shadow.> idk why |
01:45:37 | FromDiscord | <shadow.> prolly just my skillset i suppose |
01:45:56 | * | a_chou quit (Remote host closed the connection) |
01:46:10 | FromDiscord | <shadow.> also mine was slow asf but |
01:46:10 | FromDiscord | <ElegantBeef> day 18 i just phoned it in |
01:46:13 | Fish-Face | I dunno about "easiest" it was just annoying that they are hammering the "use a hash(set|table)" thing and little else! Or so it seems to me |
01:46:15 | FromDiscord | <shadow.> how'd you do day 18? |
01:46:19 | FromDiscord | <shadow.> lmao yeah |
01:46:20 | FromDiscord | <ElegantBeef> Using nimscripter |
01:46:23 | FromDiscord | <shadow.> i used a hash set of (int, int) |
01:46:25 | FromDiscord | <shadow.> LMAO |
01:46:26 | FromDiscord | <shadow.> same pretty much |
01:46:37 | Fish-Face | not (int, int, int[, int])? |
01:46:39 | FromDiscord | <ElegantBeef> https://forum.nim-lang.org/t/7162#45998 |
01:46:45 | FromDiscord | <shadow.> wait |
01:46:46 | FromDiscord | <shadow.> for which part |
01:46:52 | FromDiscord | <shadow.> for part two (int, int, int, int) |
01:46:54 | Fish-Face | I wanted to learn how to write a parser, so I did that for today |
01:46:57 | FromDiscord | <shadow.> for part one (int, int, int) |
01:46:59 | Fish-Face | yes |
01:47:02 | Fish-Face | ok cool |
01:47:03 | FromDiscord | <shadow.> fairly short |
01:47:04 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2ICS |
01:47:17 | FromDiscord | <ElegantBeef> Hey we did it similarly |
01:47:22 | FromDiscord | <shadow.> haha ye |
01:47:26 | Fish-Face | so I initially used a pairing function so that I could use a seq for 17.1 |
01:47:28 | FromDiscord | <shadow.> a lot of ppl w metaprogramming abilities did |
01:47:32 | FromDiscord | <shadow.> like py, ruby, nim |
01:47:32 | mipri | npeg's precedence support works great for day 18. |
01:47:36 | FromDiscord | <ElegantBeef> I just used nimscripter to evaluate it |
01:47:39 | FromDiscord | <shadow.> lmaooo |
01:47:40 | FromDiscord | <shadow.> same |
01:47:42 | FromDiscord | <shadow.> parseExpr() |
01:47:45 | FromDiscord | <shadow.> and custom ops to remove precedence |
01:47:47 | FromDiscord | <ElegantBeef> No you didnt use nimscripter |
01:47:49 | Fish-Face | but you run out of memory in part 2 unless you do something different |
01:47:50 | FromDiscord | <shadow.> ok but |
01:47:51 | FromDiscord | <shadow.> evaluate |
01:47:52 | FromDiscord | <shadow.> lmao |
01:47:53 | FromDiscord | <ElegantBeef> you used nimscript 😄 |
01:47:59 | FromDiscord | <shadow.> i didnt mean nimscripter |
01:48:02 | FromDiscord | <shadow.> i just meant evaluating it |
01:48:06 | Fish-Face | mipri: do you have an npeg solution to hand? |
01:48:22 | FromDiscord | <ElegantBeef> Well mine is purely runtime, so it works on any data |
01:48:27 | mipri | there's one in the reddit thread that uses it |
01:48:31 | FromDiscord | <shadow.> oh nice nice |
01:48:51 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2ICU |
01:49:17 | Fish-Face | mipri: I searched all the comments for "npeg" but didn't find it... |
01:49:18 | FromDiscord | <shadow.> it looks like a lightning bolt |
01:49:32 | FromDiscord | <shadow.> im considering learning dyalog apl so i can get fake internet points on the aoc megathreads |
01:49:40 | Fish-Face | ah, that's you shadow |
01:49:46 | Fish-Face | I did find that solution :P |
01:50:04 | FromDiscord | <shadow.> you found it? |
01:50:05 | FromDiscord | <shadow.> on reddit? |
01:50:12 | Fish-Face | yes while searching for nim solutions |
01:50:16 | FromDiscord | <shadow.> ohh nice nice |
01:50:20 | FromDiscord | <shadow.> i've only posted there like twice lmao |
01:50:24 | FromDiscord | <shadow.> all mine are on github tho |
01:50:29 | Fish-Face | yeah |
01:50:30 | FromDiscord | <shadow.> !repo shadowninja55/aoc-2020 |
01:50:30 | disbot | https://github.com/shadowninja55/aoc-2020 -- 9aoc-2020: 11my attempt at advent of code 2020 in nim. 15 1⭐ 0🍴 |
01:50:32 | mipri | Fish-Face: there are more than 500 comments now, and it's hidden by default even if you expand to show 500. |
01:50:33 | FromDiscord | <shadow.> e |
01:50:40 | mipri | https://old.reddit.com/r/adventofcode/comments/kfeldk/2020_day_18_solutions/gg8596t/ |
01:50:58 | FromDiscord | <shadow.> jesus christ |
01:50:59 | FromDiscord | <shadow.> no way- |
01:51:15 | FromDiscord | <shadow.> wait |
01:51:16 | FromDiscord | <shadow.> nvm |
01:51:18 | FromDiscord | <shadow.> i didnt scroll all the way |
01:51:19 | FromDiscord | <shadow.> LMAO |
01:51:29 | FromDiscord | <shadow.> i went like halfway and it looked like it was over |
01:51:43 | Fish-Face | mipri: thanks, yeah I don't even know the logic behind reddit comment hiding. |
01:51:49 | FromDiscord | <shadow.> props on using old reddit |
01:54:38 | Fish-Face | mipri: hmm. I see kind of how it works... it seems to have some code to handle backtracking in the capture blocks |
01:54:56 | Fish-Face | oh no, I misread |
01:55:33 | Fish-Face | in that case... is it just written to never backtrack over the rules which have capture blocks? |
01:56:55 | * | regreg_ joined #nim |
01:57:40 | mipri | right, that never happens. |
01:58:15 | Fish-Face | this would be easier to grok if my degree were in CS and/or I'd actually ever had to use proper parsers in anger |
01:58:42 | mipri | run through some examples with -d:npegTrace |
01:59:20 | Fish-Face | yeah - I did that when I was trying to write an npeg parser but it *was* backtracking over the relevant rules |
01:59:27 | Fish-Face | then I gave up and used another library |
02:07:43 | FromDiscord | <bark> I... overcomplicated day 18 part 2 https://play.nim-lang.org/#ix=2Iz6 |
02:08:02 | FromDiscord | <bark> (edit) "I... overcomplicated day 18 part 2 https://play.nim-lang.org/#ix=2Iz6 ... " added "(25 minute)" |
02:08:06 | FromDiscord | <bark> (edit) "minute)" => "minute solution)" |
02:08:22 | Fish-Face | I took hours playing with parsing libraries :) |
02:08:44 | FromDiscord | <bark> yeah, it took me hours to figure out npeg on day 14 |
02:08:59 | FromDiscord | <bark> reading documentation is slow |
02:09:22 | Fish-Face | mmm |
02:09:35 | Fish-Face | but learning a language (which is what I am doing) means learning some of its libraries |
02:09:45 | Fish-Face | I don't time my solutions |
02:10:02 | Fish-Face | could bash out quick ugly solutions in python all day long :P |
02:10:39 | FromDiscord | <bark> yeah, I could also check new libs out out there |
02:10:49 | FromDiscord | <bark> or just new parts of the stdlib |
02:11:10 | FromDiscord | <bark> reading other people's aoc's has been helpful as well |
02:11:19 | Fish-Face | yeah |
02:11:32 | Fish-Face | I figure I might learn rust one day so I've been reading rust solutions too |
02:11:56 | * | blueberrypie quit (Quit: leaving) |
02:13:39 | FromDiscord | <shadow.> nice |
02:13:45 | FromDiscord | <shadow.> idk rust is kinda verbose for me lol |
02:13:57 | Fish-Face | myeah |
02:14:01 | Fish-Face | my friend is doing AoC in rust |
02:14:14 | Fish-Face | it's interesting though |
02:14:45 | Fish-Face | some things in nim are slow because of copy-by-default - with ownership checking you can avoid that more easily |
02:16:39 | mipri | it comes up. --gc:arc --expandArc:(module|proc) work well for sussing out unexpected copying. |
02:18:10 | FromDiscord | <nikki> sent a code paste, see https://play.nim-lang.org/#ix=2ID8 |
02:18:11 | Fish-Face | Yes I ended up using that |
02:18:42 | FromDiscord | <nikki> strings are definitely copy-trigger-happy tho |
02:18:47 | Fish-Face | Mmm |
02:19:14 | Fish-Face | After some experience I started defining more ref types |
02:20:51 | FromDiscord | <nikki> hmm word. i try to stay away from ref types usually to avoid the refcounts, but -- yeah depends on your usecase i guess. basically i use ref types when that's the semantics i really want |
02:21:26 | mipri | eh, value types are usually what I want. It just helps to be aware that Nim isn't a scripting language and has more of a C++ understanding of assignment. |
02:21:26 | FromDiscord | <nikki> but otherwise for non-`var` value type params nim will use pointers under the hood anyways if they are large |
02:22:43 | FromDiscord | <nikki> probably the main thing to do is profile etc. and see if the copies are indeed your problems with using value types for certain data, then architect your stuff so that they are just referenced (which doesn't necessarily mean using ref types) |
02:26:42 | * | d10n-work quit (Ping timeout: 260 seconds) |
02:26:49 | * | spiderstew_ joined #nim |
02:26:53 | Fish-Face | Mmm, I was definitely being overly paranoid at some point |
02:27:16 | Fish-Face | AoC tends to have loads of huge trees so it's not representative |
02:27:17 | * | spiderstew quit (Ping timeout: 260 seconds) |
02:27:17 | * | BitPuffin quit (Ping timeout: 260 seconds) |
02:28:04 | FromDiscord | <shadow.> tbh if your aoc solution takes a long time then you're doing it wrong anyways lmao |
02:28:07 | Fish-Face | What confused me is that the semantics are dictated by the type not the function. I was expecting to be able to use C++ style references |
02:28:21 | Fish-Face | "a long time" is subjective ;) |
02:28:30 | * | d10n-work joined #nim |
02:28:33 | FromDiscord | <shadow.> haha |
02:28:37 | Fish-Face | AoC is an opportunity to try to optimise |
02:28:37 | * | BitPuffin joined #nim |
02:28:38 | FromDiscord | <shadow.> my longest one was 2s and that was the memory one |
02:28:41 | FromDiscord | <Quibono> 10ms |
02:28:43 | FromDiscord | <shadow.> everything else is under 250ms |
02:28:44 | Fish-Face | If you want |
02:28:45 | FromDiscord | <shadow.> lmao |
02:28:45 | FromDiscord | <Quibono> You have 10ms |
02:28:48 | FromDiscord | <shadow.> usually under 50ms |
02:28:50 | FromDiscord | <shadow.> id guess |
02:28:53 | FromDiscord | <shadow.> i meannn |
02:28:57 | FromDiscord | <Quibono> SLOW |
02:29:01 | FromDiscord | <shadow.> aoc is typically made for writing fast code and problem solving quickly |
02:29:06 | FromDiscord | <shadow.> id say leetcode is more for efficiency |
02:29:10 | FromDiscord | <shadow.> and optimization |
02:29:14 | FromDiscord | <shadow.> if only leetcode had nim |
02:29:21 | FromDiscord | <Quibono> In my day we did AOC in fortran and we had to finish in 1ms |
02:29:37 | FromDiscord | <shadow.> "in my day" boi you were just barely born last century don |
02:29:40 | FromDiscord | <shadow.> don't even |
02:29:49 | Fish-Face | Maybe yes. Well, this year as I said, everything is "use a hash map" sand you're good |
02:29:53 | FromDiscord | <shadow.> yup |
02:29:56 | FromDiscord | <shadow.> use a hashmap or a set |
02:30:04 | Fish-Face | Same difference ;) |
02:30:08 | FromDiscord | <shadow.> even day 1 lol |
02:30:12 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IDd |
02:30:15 | FromDiscord | <shadow.> gotta use a set smh |
02:30:58 | mipri | https://adventofcode.com/2017/day/1 <- the "everything has to be done in 1ms" year was 2017 |
02:31:57 | Fish-Face | Hehe |
02:32:47 | FromDiscord | <shadow.> hm |
02:32:54 | FromDiscord | <shadow.> i rly wanna solve that in dyalog apl lmao |
02:33:45 | FromDiscord | <shadow.> its so intruguing to me |
02:34:20 | mipri | the 2017 one? yeah that's a very short APL program |
02:34:33 | FromDiscord | <shadow.> lol yes |
02:35:12 | * | regreg_ quit (Read error: Connection reset by peer) |
02:36:04 | FromDiscord | <shadow.> idk anywhere good to learn apl tho |
02:36:34 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IDg |
02:42:30 | FromDiscord | <InventorMatt> giaco: for some reason for some reason testing your program is giving me a different weird error. you may want to ask pmunch or @sealmove later when they are online |
02:43:14 | giaco | InventorMatt. Thanks a lot for the feedback |
02:44:06 | FromDiscord | <InventorMatt> sorry I can't be more of a help |
02:49:00 | * | revere quit (Quit: quit) |
02:49:12 | * | revere joined #nim |
02:55:58 | FromDiscord | <Quibono> Somethings just can't be helped, like the lack of macos arm support. :p |
02:59:21 | FromGitter | <deech> Is the function pointer returned by `rawProc` stable? If I call it on the same `proc` but with different closure environments does it give me the same function pointer? Of course, I expect `rawEnv` to be different each time. |
03:02:12 | FromGitter | <deech> I'm assuming `orc/arc` memory management. |
03:08:06 | ForumUpdaterBot | New thread by Rockcavera: Domain Name System (DNS) protocol and client for Nim, see https://forum.nim-lang.org/t/7270 |
03:08:40 | FromDiscord | <Cohjellah> Damn guys, the Nim book is no joke hey. Briefly covers the syntax and goes straight into a client/server Async chat app ahaha |
03:09:17 | FromDiscord | <Cohjellah> It's really well written. If the creator is in this Discord/IRC, mad props. It's a good break from all the little meaningless projects most books give |
03:11:47 | FromDiscord | <Clyybber> yeah he's here; dom86 |
03:17:25 | * | mfiano quit (Ping timeout: 240 seconds) |
03:38:02 | * | abm quit (Read error: Connection reset by peer) |
03:45:52 | * | letto_ joined #nim |
03:47:38 | * | mfiano joined #nim |
03:49:03 | * | opal quit (Ping timeout: 240 seconds) |
03:49:05 | * | letto quit (Ping timeout: 240 seconds) |
03:55:34 | * | mfiano quit (Ping timeout: 268 seconds) |
03:58:50 | * | mfiano joined #nim |
04:02:02 | * | muffindrake quit (Ping timeout: 260 seconds) |
04:04:13 | * | muffindrake joined #nim |
04:04:42 | * | mfiano quit (Ping timeout: 260 seconds) |
04:08:28 | * | mfiano joined #nim |
04:12:54 | * | mfiano quit (Ping timeout: 265 seconds) |
04:16:53 | FromDiscord | <shadow.> + 10 |
04:18:49 | * | letto_ quit (Ping timeout: 264 seconds) |
04:22:24 | * | mfiano joined #nim |
04:22:33 | * | letto_ joined #nim |
04:37:56 | * | mfiano quit (Ping timeout: 240 seconds) |
04:54:54 | * | spiderstew joined #nim |
04:55:00 | * | narimiran joined #nim |
04:55:03 | * | mfiano joined #nim |
04:57:13 | * | spiderstew_ quit (Ping timeout: 264 seconds) |
05:00:53 | giaco | I am doing some parsing with binaryparse. I am following this RFC https://tools.ietf.org/html/rfc7845 and it basically requires me to create an opus substream while parsing the wrapper ogg file stream. What's the nim class for that? |
05:00:56 | * | mfiano quit (Ping timeout: 256 seconds) |
05:04:41 | disruptek | nim doesn't have classes. |
05:05:14 | giaco | oh, yeah, sorry for that ^^" still have to rewire the brain |
05:05:29 | disruptek | well, i'm not really sure what you're asking for. |
05:06:40 | disruptek | you'll want to google to find packages for ogg or opus support, if any, but it's less likely that you'll find a very raw decoder and more likely that you'll need to write one using binaryparser or nimitai. |
05:06:52 | disruptek | sealmove is the expert on this stuff. |
05:07:07 | giaco | disruptek: I have this ogg file that contains an opus stream. The format says basically how read the filestream as a stream of ogg pages, and within the pages theres the opus stream that I have to parse searately (basically unwrapping it) |
05:07:41 | disruptek | his name sounds like the bowel movement of a sea creature, but he's really not that bad once you get to know him. |
05:07:56 | disruptek | strange taste in cinema, though. |
05:08:44 | giaco | I've already coded most of it using binaryparser and it works, except that I don't know how to separate the opus substream from the ogg at software level |
05:10:44 | * | opal joined #nim |
05:12:46 | giaco | :D k thanks for the name |
05:14:40 | disruptek | treeform: license for jsony? i need a parser and want to compare it to eminim... |
05:18:15 | FromDiscord | <ElegantBeef> The nimble says MIT, so hopefully that |
05:18:38 | disruptek | good catch, thank you. |
05:19:55 | giaco | apparently binaryparse can't handle variable strings. It refuses to template "s1: myfield[string_length]" |
05:22:31 | FromGitter | <bung87> `echo p.match("q=0.9")` `(ok: false, matchLen: 5, matchMax: 5, cs: (capList: ...))` why all matched still ok is false? |
05:22:55 | FromGitter | <bung87> use npeg |
05:23:02 | disruptek | giaco: i've done variable fields with nesm. |
05:23:10 | disruptek | !package nesm |
05:23:11 | disbot | disruptek hung like rhinocerous🦏 |
05:23:15 | disruptek | hmm. |
05:23:23 | disruptek | !repo swayipc |
05:23:24 | disbot | https://github.com/disruptek/swayipc -- 9swayipc: 11swayipc (i3ipc) for Nim 15 5⭐ 0🍴 |
05:23:29 | disruptek | example usage within. |
05:24:35 | giaco | thanks! But now I am confused: how many tools do I have to accomplish same job? |
05:24:52 | disruptek | well, i haven't used binaryparser. there's probably a way to do what you want. |
05:24:59 | disruptek | but i have done what you want using nesm. |
05:25:38 | disruptek | emphasis: /there's probably a way to do what you want in binaryparser./ |
05:29:36 | * | mfiano joined #nim |
05:30:13 | giaco | re-reading all binaryparse docs and examples one more time |
05:30:13 | * | kungtotte quit (Read error: Connection reset by peer) |
05:32:15 | * | kungtotte joined #nim |
05:35:41 | giaco | no, it seems not possible. I have to read the char as uint8 and then somehow convert it back. sad |
05:45:27 | FromDiscord | <treeform> @disruptek jsony license should be MIT, let me add that. |
05:45:48 | disruptek | giaco: real out to sealmove. |
05:45:51 | disruptek | reach, too. |
05:45:56 | disruptek | treeform: aight, thanks. |
05:46:16 | disruptek | treeform: is it pretty solid? well tested or something? |
05:48:26 | FromDiscord | <treeform> I have not used it in production yet. |
05:49:06 | FromDiscord | <treeform> I am using it everyday for this project I am doing. |
05:49:32 | FromDiscord | <treeform> It has a test suite |
05:51:05 | disruptek | okay, cool. thank you. i will see how it runs. 😈 |
05:51:22 | FromDiscord | <treeform> current bench mark: |
05:51:28 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=2IE8 |
05:52:06 | FromDiscord | <treeform> No support for case objects... |
05:53:45 | mipri | got day 19 by turning the rules into an npeg parser, but part 2 requires left-recursion. woops. |
05:54:20 | * | hipoint-yc9 joined #nim |
05:54:44 | * | hpyc9 quit (Read error: Connection reset by peer) |
05:55:38 | * | mfiano quit (Ping timeout: 272 seconds) |
05:57:28 | disruptek | treeform: do you use ggplotnim? like it? |
05:57:43 | FromDiscord | <treeform> I do not |
05:57:54 | FromDiscord | <treeform> I added LICENSE file for https://github.com/treeform/jsony |
05:58:00 | disruptek | danke. |
05:58:52 | * | mfiano joined #nim |
05:58:53 | FromDiscord | <treeform> I have my own nim charting library I use at work. Its work related to I will not be open sourcing it. |
05:59:47 | disruptek | right, i think you demo'd that a bit, maybe. |
06:00:14 | disruptek | i'm just thinking about something simple for time/space graphs on my repos and whatnot. |
06:00:33 | disruptek | i don't really want to look at all these benchmarks in text, y'know? |
06:00:53 | FromDiscord | <treeform> text is easy though |
06:01:10 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
06:01:11 | FromDiscord | <treeform> I just want to see "thing" --- number. I am simple. |
06:01:17 | * | njoseph joined #nim |
06:01:41 | disruptek | yeah, but you know how it is... once i write this thing once, boom, i'll have it everywhere. |
06:03:34 | FromDiscord | <treeform> you make a good point |
06:04:19 | FromDiscord | <treeform> Some thing like this can be really cool for multiple tests: |
06:04:20 | FromDiscord | <treeform> https://media.discordapp.net/attachments/371759389889003532/789734843490762752/68747470733a2f2f697269732d676f2e636f6d2f696d616765732f62656e63686d61726b732e737667.png |
06:04:30 | disruptek | some of us don't have nifty reddit graphs. 😁 |
06:04:58 | * | mfiano quit (Ping timeout: 256 seconds) |
06:06:02 | disruptek | cute. |
06:06:26 | FromDiscord | <treeform> Actually going vertically might be better, as you can go on for a long time. |
06:06:31 | FromDiscord | <treeform> https://media.discordapp.net/attachments/371759389889003532/789735392123027476/iphone-xs-benchmarks-geekbench4-fixed-100774085-large.png |
06:06:49 | FromDiscord | <treeform> Maybe I should add this to benchy |
06:07:42 | FromDiscord | <ElegantBeef> As a rendered image or just tui? |
06:07:49 | disruptek | yeah, people have wider displays now and they know how to scroll. i'm always careful with height in the ui but when it comes to the web.. just let them scroll that fucker. |
06:08:55 | FromDiscord | <treeform> yes |
06:13:44 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:14:30 | * | mfiano joined #nim |
06:20:37 | * | mfiano quit (Ping timeout: 260 seconds) |
06:29:54 | * | mfiano joined #nim |
06:45:08 | * | mfiano quit (Ping timeout: 256 seconds) |
06:54:20 | * | mfiano joined #nim |
07:07:17 | * | mfiano quit (Ping timeout: 260 seconds) |
07:10:23 | * | opal quit (Ping timeout: 240 seconds) |
07:13:18 | * | opal joined #nim |
07:33:13 | * | fputs quit (Ping timeout: 260 seconds) |
07:34:28 | * | mfiano joined #nim |
07:37:09 | FromDiscord | <sealmove> @giaco hey |
07:37:18 | giaco | hello |
07:38:05 | FromDiscord | <sealmove> Yesterday i launched a fork of binaryparse |
07:38:50 | FromDiscord | <sealmove> Strings are refurbished |
07:39:03 | FromDiscord | <sealmove> https://github.com/sealmove/binarylang |
07:39:08 | giaco | sealmove, would you help me fixing my little experiment with binaryparse? |
07:40:04 | giaco | oh! cool |
07:40:25 | * | mfiano quit (Ping timeout: 240 seconds) |
07:40:25 | FromDiscord | <sealmove> Yes sure. |
07:43:17 | giaco | I'm a newbie in nim and I've been playing with binaryparser for the last 3h. Two are the things that I failed to accomplish: first is if it is possible read variable size strings (I tried this but computer says no "s1: myfield[string_length]") |
07:45:01 | FromDiscord | <sealmove> `s1` is wrong. It means "string were each character is 1 bit". |
07:46:05 | FromDiscord | <sealmove> use `s` or `s8` |
07:46:17 | giaco | sealmove, no, docs says that it would mean 1 character, not 1 bit |
07:46:48 | giaco | I need to read a string long X characters where X comes from a previous field |
07:47:44 | Zevv | mipri: haha, too bad :) Every left recursive grammar can be expressed as a peg, so Ive been told |
07:47:57 | giaco | I'm using "u8: wrongstring[length_of_string]" as a workaround now |
07:48:38 | FromDiscord | <sealmove> yes, it should be `s: myField[myPrevField]`. honestly I don't know exactly it works in binaryparse. I found strings too confusing and implemented them differently. |
07:49:39 | FromDiscord | <sealmove> in binarylang it's `s: myField(myPrevField)` and `s: myField[myPrevField]` means "seq of null-terminated strings with length `myPrevField`" |
07:50:55 | * | mfiano joined #nim |
07:53:09 | giaco | s: myField[myPrevField] looks null terminated strings, that's not my case |
07:53:33 | FromDiscord | <sealmove> do your strings contain null bytes in-between? |
07:55:45 | giaco | no, they do not. For the sake of clarity, I'm parsing opus protocol RFC, problem arises at page 22 (Vendor String) https://tools.ietf.org/html/rfc7845 |
07:55:59 | FromDiscord | <sealmove> well, give binarylang a try, see if it solves your problems. `s: myField(myPrevField)` creates a substream of length `myPrevField` and reads a string out of it. |
07:57:47 | giaco | I will surely try it if, but here it comes the second problem I've faced |
07:59:47 | * | mfiano quit (Ping timeout: 260 seconds) |
08:01:10 | giaco | ogg protocol RFC, page 9 https://tools.ietf.org/html/rfc3533, page_segments + segment_table. Basically the segment table is a list of u8 like [234,10,5,53,73,...,N] that I should use in the next field to read 234+10+5+53+73+..N bytes |
08:02:25 | giaco | I tried something like "u8: segments[sum(segment_table)]" but was just a wild guess |
08:03:11 | * | mfiano joined #nim |
08:05:16 | giaco | currently I'm handling it outside the library by running manually other parsers instead of chaining them inside the createParser definition |
08:07:28 | FromDiscord | <sealmove> hum, so you just need the length of the segment table? |
08:07:57 | FromDiscord | <sealmove> or total bytes read for segment table? |
08:09:08 | giaco | the total bytes. segment_table contains the lenghts of the N next fields |
08:10:15 | giaco | I could read them separately, or just all of them in one shot. I failed both tasks with binaryparser, so I had to workaroud it |
08:10:40 | FromDiscord | <sealmove> i see, yes, the way you did it above works (at least in binarylang :P) |
08:11:05 | FromDiscord | <sealmove> you can use any valid nim expression for the size |
08:11:16 | FromDiscord | <sealmove> so `sum(segment_table)` should work |
08:12:15 | FromDiscord | <sealmove> also you know you can integrate custom parsers into binaryparse/lang right? |
08:12:50 | FromDiscord | <sealmove> (although absolutely not necessary the case you described) |
08:13:00 | FromDiscord | <sealmove> for the |
08:15:44 | giaco | This -> "u8: segments[sum(segment_table)]" doesn't work in binaryparse |
08:16:32 | giaco | it compiles and runs, but returns incorrect results |
08:17:43 | giaco | well, apart from my questions. I'd like to thank you for the great work! |
08:19:36 | FromDiscord | <sealmove> thanks 😄 |
08:20:54 | FromDiscord | <sealmove> giaco i am expecting feedback for binarylang 😛 let me know if those things worked or didn't. |
08:21:59 | giaco | sure! but first I seriously need some sleep. Been forcing myself in learning nim in a weekend, let's see |
08:23:01 | FromDiscord | <sealmove> you won't regret nim 😉 gn |
08:30:04 | giaco | another question would be how you would use your invention in a real example, for example I'm puzzled if I should search magic numbers using loop+peek, or try/catch on MagicError, or something else |
08:33:05 | FromDiscord | <sealmove> just for clarity, the original project (binaryparse) was not written by me, I made binarylang which is a rewrite 😛 |
08:33:24 | FromDiscord | <sealmove> um, for magic numbers there is a special feature, so obviously you should use that |
08:34:08 | FromDiscord | <sealmove> i don't think you can do it with try/catch |
08:34:38 | FromDiscord | <sealmove> i mean you can, if you use a custom parser, but that shouldn't be necessary |
08:59:52 | * | mfiano quit (Ping timeout: 260 seconds) |
09:02:06 | FromDiscord | <Ricky Spanish> anyone know how to get a single column/slice out of an arraymancer tensor of shape[1,18] when i just want the tensor containing 18 elements? |
09:03:04 | FromDiscord | <mratsim> @Ricky Spanish t.squeeze(0) since the column 0 dim is 1 |
09:03:14 | FromDiscord | <mratsim> ot t.squeeze() to remove all 1 dimension |
09:03:28 | FromDiscord | <Ricky Spanish> ah awesome thanks again @mratsim |
09:04:09 | FromDiscord | <mratsim> otherwise the usual way is t[0, _] |
09:04:37 | FromDiscord | <Ricky Spanish> yeh i was trying to slice that way but wasnt really able to get what i wanted |
09:05:11 | FromDiscord | <mratsim> likely because you want autoreduction of 1-dim like in Numpy |
09:05:20 | FromDiscord | <Ricky Spanish> yeh exactly |
09:05:33 | FromDiscord | <mratsim> I don't do it because from stackoverflow people often had to search for a way to get out of it |
09:05:47 | FromDiscord | <mratsim> when composing algorithm |
09:06:18 | FromDiscord | <Ricky Spanish> ah never really considered that to be fair its a good point, often harder to get out of doing something than to then implement it after |
09:09:43 | FromDiscord | <mratsim> I have a "at" template that does slicing + squeeze |
09:09:51 | FromDiscord | <mratsim> t.at(0, _) |
09:09:55 | * | mfiano joined #nim |
09:10:12 | FromDiscord | <Ricky Spanish> hmm ill add it in as comments so i can remember thanks |
09:13:43 | * | habamax joined #nim |
09:14:13 | * | klaufir_ joined #nim |
09:14:37 | * | mfiano quit (Ping timeout: 264 seconds) |
09:17:32 | * | mfiano joined #nim |
09:28:32 | * | haxscramper joined #nim |
09:39:17 | FromDiscord | <dom96> @Cohjellah Thank you! Means a lot and thanks for grabbing a copy 🙂 |
09:39:40 | * | mfiano quit (Ping timeout: 268 seconds) |
09:55:17 | * | mfiano joined #nim |
10:00:01 | * | mfiano quit (Ping timeout: 268 seconds) |
10:07:03 | * | fanta1 joined #nim |
10:09:12 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
10:23:10 | * | mfiano joined #nim |
10:28:45 | * | Vladar joined #nim |
10:30:37 | * | superbia joined #nim |
10:31:08 | * | mfiano quit (Ping timeout: 260 seconds) |
10:31:45 | Zevv | https://www.microsoft.com/en-us/research/uploads/prod/2020/11/perceus-tr-v1.pdf |
10:34:45 | * | narimiran quit (Ping timeout: 240 seconds) |
10:47:37 | * | mfiano joined #nim |
10:50:34 | FromDiscord | <mratsim> It's in the Nim forum |
10:50:52 | FromDiscord | <mratsim> The authors of Koka and Lean language are really working on very interesting stuff |
10:51:09 | FromDiscord | <mratsim> Besides pPerceus they are powered by mimalloc. |
10:56:01 | * | habamax_ joined #nim |
10:56:13 | * | habamax_ quit (Client Quit) |
10:56:48 | * | habamax quit (Read error: Connection reset by peer) |
10:56:48 | * | mfiano quit (Ping timeout: 260 seconds) |
11:00:17 | * | mfiano joined #nim |
11:01:05 | FromDiscord | <mratsim> @Zevv, it's coming! https://media.discordapp.net/attachments/371759389889003532/789809521249878016/unknown.png |
11:01:16 | * | krux02 joined #nim |
11:05:40 | * | mfiano quit (Ping timeout: 265 seconds) |
11:14:57 | * | mfiano joined #nim |
11:18:28 | FromDiscord | <m0nsta> well, everything is attracted by a black hole : P |
11:20:37 | * | mfiano quit (Ping timeout: 264 seconds) |
11:23:35 | * | mfiano joined #nim |
11:29:15 | * | mfiano quit (Ping timeout: 256 seconds) |
11:38:17 | FromDiscord | <mratsim> very interesting thread about CPS use cases: https://discuss.ocaml.org/t/what-is-the-use-of-continuation-passing-style-cps/4491 |
11:38:58 | Zevv | I don't care for any of those. I just want my Lua-style coroutines, that is all |
11:39:03 | Zevv | and a pony |
11:40:59 | Zevv | And yesterday I heard a talk where someone said that "coroutines will be the way we do async in the future". Which made me laugh. I use coroutines for async for more then a decade. ha ha ha. hear me laugh |
11:41:06 | FromDiscord | <mratsim> Do they have a special somehing? |
11:42:40 | FromDiscord | <mratsim> seems very similar to greenlet https://github.com/treeform/greenlet |
11:42:52 | Zevv | nope. They are the most basic coroutines you can imagine. They are first class citizens, can yield from any nested functions (so no 'color' problem), and as a nice bonus can yield and resume data both ways. But that flexibility is hard to emulate in nim, giving the type system. |
11:43:18 | Zevv | The best part is the no-color. |
11:43:39 | Zevv | so A can resume B. B can call C taking a callback to D, then D can yield, and it all Just Works |
11:44:00 | FromDiscord | <mratsim> Why aren't they similar? |
11:44:17 | FromDiscord | <mratsim> I don't see the equivalent of "switchTo" in the CPS codebase though |
11:44:39 | Zevv | that's not the task of CPS. It's just how you trampoline your continuation. |
11:44:41 | FromDiscord | <mratsim> LUA coroutines and greenlet seems to be scheduled manually while CPS has a "scheduler" called trampoline |
11:44:42 | Zevv | c.fn() |
11:44:48 | Zevv | no no no |
11:44:51 | Zevv | CPS has no scheduler |
11:44:57 | Zevv | or no trampoline |
11:45:08 | Zevv | that's /outside/ CPS. CPS just makes the continuations. |
11:45:15 | Zevv | How you trampoline them is your choice |
11:45:15 | FromDiscord | <mratsim> I thought your nope was about greenlet, misunderstanding |
11:45:15 | * | mfiano joined #nim |
11:45:23 | Zevv | ah no sorry |
11:45:24 | FromDiscord | <mratsim> ah I see |
11:45:48 | Zevv | so resum() aka switchTo() is just a `while c: c = c.fn()` |
11:46:01 | Zevv | nothing more, nothing less |
11:46:18 | FromDiscord | <mratsim> I need manual control to implement formal verification of concurrent data structures |
11:46:28 | Zevv | the nice thin in lua is that both yield() and resume() can return data, which then end up in the others respective resume() and yield() |
11:47:06 | Zevv | That is why I keep on whining to disruptek about this. CPS /should not/ implement or enforcy any kind of trampolining, scheduling, looping, whatsoever |
11:47:12 | Zevv | we will build that on top of CPS. |
11:47:13 | FromDiscord | <mratsim> yes agree |
11:47:16 | FromDiscord | <mratsim> https://github.com/mratsim/weave/pull/127/files |
11:47:17 | disbot | ➥ [WIP] Thread Collider: Race detection / Formal Verification of Nim concurrent programs ; snippet at 12https://play.nim-lang.org/#ix=2IwE |
11:47:37 | Zevv | because the CPS primitive itself is also useful for doing cool control flow, iterators, etc, which all don't need event loops or schedulers |
11:47:38 | FromDiscord | <mratsim> My formal verification of threading requires coroutines or equivalent without a scheduler |
11:47:46 | Zevv | right. that's good. |
11:48:10 | Zevv | so our 'spawn' is bascially a "create initial environment and call the first continuation stage" |
11:49:11 | FromDiscord | <mratsim> I need my own scheduler which is a thin wrapper around coroutines/fibers https://github.com/mratsim/weave/pull/127/files |
11:49:13 | disbot | ➥ [WIP] Thread Collider: Race detection / Formal Verification of Nim concurrent programs ; snippet at 12https://play.nim-lang.org/#ix=2IwE |
11:49:45 | Zevv | I think the main problem for now is that both disruptek and me don't have the real motivation to kickstart this whole thing again. We spent a nice few weeks in a cool flow making this, asking for comments, but hardly got any. I'm a bit flushed with life & work these days, and disruptek is struggling to keep his head out of the water in life, so his prios lie totally elsewhere |
11:49:55 | * | mfiano quit (Ping timeout: 246 seconds) |
11:51:05 | Zevv | Also I kind of lost disruptek in the second stage of development - he took over my initial implementation and reworked when I did not pay attention, and I got lost on the details. From that point on he was the producer and me the consumer; that worked quite well, but if I want to pick up where he left up I need to spend some good time understanding what he did there |
11:51:39 | Zevv | otoh, it's no magic at all. It's just a few macros chewing their way through a proc AST and deciding where to cut and what to lift. |
11:51:52 | FromDiscord | <mratsim> Well I'm also swamped with projects but I'll try to productionize something |
11:52:27 | Zevv | most of what we did is straight out of the Gabriel Kerneis paper (1011.4558.pdf) |
11:53:10 | Zevv | I /almost/ got myself to start again from scratch the other day to make use of what we learned |
12:06:57 | haxscramper | Can someone comment on my idea for interfacing with C++ classes (right now I'm mostly thinking about Qt, but this should be applicable to any other OOP-heavy library): https://gist.github.com/haxscramper/558f470dff55dbb3b09fce7cf92e2e74 |
12:07:59 | haxscramper | After some testing with codegen I think it is the best solution overall, but there are some issues, like making nim-declared types available in generated C++ code |
12:09:16 | FromDiscord | <hugogranstrom> Today's AoC is crazy hard 😕 |
12:09:19 | haxscramper | Also 'derived' clases still won't behave as proper OOP on the nim side - e.g. I'd need to provide additional overloads for all procs |
12:10:26 | haxscramper | Though I have full access to information about original C++ object hierarchy and might provide access to a lot of metadata that can be used by macro on the nim side. |
12:12:46 | haxscramper | But I still can provide override for behavior of the object without actually overriding anything, which might be quite useful for various 'DelegatePainter' OOP patterns, where you actually only want to overide implementation of a single method and nothing else. |
12:14:12 | FromDiscord | <Cohjellah> No problem :) is there plans for an updated version in a couple years or perhaps a new book? |
12:15:43 | FromDiscord | <dom96> No plans right now, not even sure if my publisher would be up for it, might look into it in the near future though. |
12:16:30 | FromDiscord | <dom96> Zevv: that's a long paper, I found this as well, is it a good summary of it? https://arxiv.org/pdf/1102.0951.pdf |
12:18:53 | FromDiscord | <mratsim> it's interesting because it gives you the 5 (iirc) low-level primitives to make continuation passing C |
12:19:31 | FromDiscord | <mratsim> I have a better picture on how we can structure CPS. |
12:20:38 | FromDiscord | <mratsim> level 0 would be nim functions,↵level 1 would be suspend and switch↵level 2 would be schedulers (async/await, weave). |
12:20:53 | FromDiscord | <mratsim> so level 1 would be like Lua coroutines and greenlets |
12:21:05 | FromDiscord | <mratsim> and i think we should make level 1 usable on embedded. |
12:21:22 | FromDiscord | <dom96> what does "usable on embedded" mean though? |
12:21:40 | FromDiscord | <mratsim> level 2 would either tie in into the OS for IO tasks or Weave for compute tasks. |
12:22:05 | FromDiscord | <mratsim> https://github.com/treeform/greenlet#platform-portability |
12:25:12 | * | klaufir_ quit (Ping timeout: 260 seconds) |
12:28:52 | * | narimiran joined #nim |
12:29:32 | ForumUpdaterBot | New question by Michal Marš&#225;lek: Game of life is running slow, see https://stackoverflow.com/questions/65369818/game-of-life-is-running-slow |
12:31:55 | * | mfiano joined #nim |
12:32:04 | FromDiscord | <Ricky Spanish> is there a way to initialize a tensor in arraymancer to all zero's? aka np.zero's equivelant? |
12:34:02 | FromDiscord | <Vindaar> @Ricky Spanish there's `zeros`: https://mratsim.github.io/Arraymancer/init_cpu.html#zeros%2Cvarargs%5Bint%5D |
12:34:23 | FromDiscord | <Vindaar> but the default construction of a tensor zeros all elements anyways |
12:34:44 | FromDiscord | <Vindaar> only if you use `newTensorUninit` you get one that isn't initialized to zero |
12:36:10 | FromDiscord | <Ricky Spanish> ah ok i see thanks for the info |
12:37:49 | * | mfiano quit (Ping timeout: 256 seconds) |
12:37:53 | Zevv | dom96: yes it has the same ideas, it will do as a summary |
12:38:09 | Zevv | but for actual implementation the 1101 has more details |
12:38:48 | Zevv | mratsim: i like your levels, it allows for a clear separation |
12:39:38 | Zevv | so 0 has proven to work for the majority of nim control flow, although we need some compiler bug fixes to make it play better with types |
12:39:48 | Zevv | it will not be able to splitup for loops though |
12:41:54 | Zevv | so the original intent was to make the work all the way in macros, as far as we can push it |
12:42:00 | Zevv | learn, implement level 1 and 2 |
12:42:10 | Zevv | and then one day maybe move level 0 into the compiler |
12:42:25 | Zevv | so we can make this work deep and everywhere |
12:43:38 | FromDiscord | <mratsim> splittable for loops are at the scheduler level anyway |
12:44:02 | FromDiscord | <mratsim> And it's only useful for Compute tasks |
12:44:42 | FromDiscord | <mratsim> Also there are 3 ways of splitting a for loop, and Weave is the only one to implement the most efficient way 😉 |
12:45:21 | FromDiscord | <mratsim> (which is what I explain here https://forum.nim-lang.org/t/6367#39266) https://media.discordapp.net/attachments/371759389889003532/789835762035327006/2020-05-22_18-33.png |
12:50:05 | Zevv | well its not only for compute task |
12:50:17 | Zevv | i might to do something IOish for all things in a list |
12:50:30 | Zevv | so i want to iterate them with a for because they live in a seq |
12:50:59 | Zevv | or i might want to read x things with an async recv |
12:51:04 | Zevv | and do that in a for loop |
12:51:13 | Zevv | so it is very much a use case |
12:54:07 | Zevv | it the optimal case, it'll "just work" for normal and closure iterators |
12:54:35 | * | mfiano joined #nim |
12:55:39 | FromDiscord | <mratsim> but beyond `for foo in list: cpsLaunch myFn(foo)` is there any optimization that you ought to do? |
12:56:52 | Zevv | not about optimization i think. its about cps being able to do whatever is required to split the control flow into continuables |
12:57:16 | Zevv | if you do something "yieldable" in a for loop, we should be able to split that op and continue from there |
12:57:36 | Zevv | for i in 0..parts: l.add magicRecv() |
12:58:19 | Zevv | thats tricky because the interaction with the nim iterator state, because that should be lifted into the env |
12:58:32 | Zevv | but its not "available" from the macro, afaik |
12:58:48 | Zevv | its not explicit, so we can not find it, lift it off the stack onto the env |
12:59:06 | FromDiscord | <mratsim> I solved that problem in Weave |
12:59:16 | Zevv | and for non-closure iterators, im not even sure if there is a way to iterate them without a "for" |
12:59:21 | * | mfiano quit (Ping timeout: 256 seconds) |
12:59:30 | Zevv | ah look, i will have to check that out |
12:59:42 | Zevv | is it "nice" or is it a hack? |
12:59:52 | FromDiscord | <mratsim> the Task carries start, current, stop, stride metadata: https://github.com/mratsim/weave/blob/master/weave/datatypes/sync_types.nim#L37-L40 |
13:00:11 | Zevv | yah for explicit `..`, that is? |
13:00:13 | FromDiscord | <mratsim> it's packaged with the function and the environment |
13:00:19 | Zevv | but what about for a in items? |
13:00:31 | Zevv | where does the items state live? |
13:00:43 | Zevv | idealle we would rewrite for to while |
13:00:48 | FromDiscord | <mratsim> not a use case for compute tasks |
13:00:49 | Zevv | so we make everything explicit |
13:00:52 | FromDiscord | <mratsim> well most |
13:00:55 | Zevv | but it is for io tasks |
13:01:17 | Zevv | my point is, the gen 1 cps will have this problem until it is moved ito the compiler |
13:01:21 | FromDiscord | <mratsim> then I rewrite the for loop to a while 😉 https://github.com/mratsim/weave/blob/master/weave/parallel_for.nim#L39-L50 |
13:01:37 | Zevv | but you cant do thayt for non-closure iterators |
13:01:43 | Zevv | can you? |
13:01:58 | FromDiscord | <mratsim> inline iterators cannot be composed anyway |
13:02:04 | Zevv | right |
13:02:05 | FromDiscord | <mratsim> you can rewrite them using CPS |
13:02:07 | Zevv | thats my point |
13:02:16 | Zevv | yes but not from a macro |
13:02:27 | FromDiscord | <juliuskiesian> https://github.com/dom96/flippy/blob/master/src/flippy.nim#L158-L171↵so the compiler is expected to optimize away the repeated `image.width y + x`? |
13:02:30 | * | mfiano joined #nim |
13:02:33 | FromDiscord | <mratsim> for some you can just take the length + address of the container |
13:02:33 | Zevv | the macro does not have access to the iterator implementation |
13:02:51 | Zevv | sure for some |
13:02:54 | Zevv | but not for all |
13:02:56 | Zevv | just sayin |
13:03:20 | Zevv | so itll be a know limitation. we can go a long way, but not all |
13:03:23 | FromDiscord | <mratsim> @juliuskiesian, that's called constant folding and loop hoisting |
13:04:25 | FromDiscord | <mratsim> also something of the form array[ax + b] can compile down to a single instruction using something called SIB addressing mode. |
13:05:05 | FromDiscord | <mratsim> https://github.com/mratsim/photon-jit/blob/master/photon_jit/x86_64/x86_64_base.nim#L191-L200 |
13:05:34 | FromDiscord | <juliuskiesian> (edit) https://github.com/dom96/flippy/blob/master/src/flippy.nim#L158-L171↵so the compiler is expected to optimize away the repeated `image.width y + x`? |
13:05:35 | * | FromDiscord quit (Remote host closed the connection) |
13:05:49 | * | FromDiscord joined #nim |
13:06:54 | Zevv | if nim does not, the c compiler is likely to i believe |
13:06:59 | Zevv | but trust mratsim on this |
13:08:00 | Zevv | ~ |
13:08:01 | disbot | no footnotes for ``. 🙁 |
13:08:44 | FromDiscord | <mratsim> The Nim compiler only propagates compile-time constants, not scope constants. |
13:09:30 | FromDiscord | <mratsim> The code can be easily checked on godbolt. |
13:09:33 | * | mfiano quit (Ping timeout: 256 seconds) |
13:10:53 | FromDiscord | <Clyybber> Zevv: You could perhaps workaround it by looking at the post transf ast |
13:10:57 | FromDiscord | <shadow.> hm |
13:11:02 | FromDiscord | <shadow.> boost |
13:11:04 | FromDiscord | <mratsim> I've watched a talk on Kotlin coroutines, they do seem quite well designed, they split a level 1 and level 2 and build async await on top of level 1 as well, though i think they force a scheduler on us unlike Lua |
13:11:04 | FromDiscord | <shadow.> yay |
13:11:10 | FromDiscord | <Clyybber> @shadow. nice |
13:11:22 | FromDiscord | <shadow.> lol one more boost is needed for level 1 |
13:11:22 | * | waleee-cl joined #nim |
13:11:25 | FromDiscord | <Clyybber> Zevv: macros.getImplTransformed |
13:11:33 | haxscramper | What is the correct way of calling nim closures from C code? I tried https://play.nim-lang.org/#ix=2IGJ and both attempts worked, though I'm surprised second ones doesn't give any segfaults |
13:12:25 | haxscramper | And maybe I've missed something else entirely and it will result in very hard-to find bugs later, while this just worked because of some magic concidence |
13:13:29 | mipri | https://godbolt.org/z/a4qzh1 - not that easily. it's hard to get it to generate code at all for a proc, and it's hard to correlate Nim with the output, and it's an old version of Nim, and there's a lot of noise, and tab indentation isn't great, and it's saturday, and |
13:13:58 | FromDiscord | <shadow.> oh shit godbolt has nim? |
13:14:01 | FromDiscord | <shadow.> i never knew that |
13:14:10 | FromDiscord | <shadow.> i use to generate asm for cpp on there lol |
13:15:04 | Zevv | clyybber: how would that work? Looking at the post transf is not possible from a regular macro, is it? |
13:15:14 | Zevv | oh wait getImplTransformed, wow |
13:15:52 | FromDiscord | <shadow.> haven't taken a look at today's aoc but ive heard it's on parsing |
13:15:58 | FromDiscord | <shadow.> is it npeggable? |
13:16:37 | mipri | it's not a hard parsing problem. You might've heard of npeg in the context of doing the non-parsing part of the task. |
13:17:43 | FromDiscord | <shadow.> oh ok |
13:17:46 | federico3 | When compiling with --gc:arc --os:standalone I get "Error: system module needs: nimErrorFlag" |
13:18:08 | FromDiscord | <shadow.> yesterday's was fun lol |
13:18:15 | FromDiscord | <shadow.> bc i cheesed it ofc |
13:18:26 | * | fputs joined #nim |
13:18:39 | FromDiscord | <dom96> Zevv: are you familiar with how the Nim compiler implements closure iterators? My understanding is that lifted variables are put into a heap-allocated which seems to be the primary differentiator from CPS where all lifted variables are simply passed as arguments to the CPS continuations. Am I correct? |
13:20:27 | FromDiscord | <mratsim> CPS continuations are also on the heap, at least in the current PoC |
13:20:43 | FromDiscord | <mratsim> @mipri right, seems like a busy proc in assembly here |
13:20:55 | Zevv | dom96: yes, it's very much related |
13:21:16 | Zevv | iterators are a subset of CPS |
13:21:35 | Zevv | if CPS would live at the compiler level, iterators could be implemented as a library |
13:22:22 | Zevv | it allows you express any kind of non-linear control flow in the language itself |
13:22:46 | Zevv | so things like setjmp/longjump, exceptions, goto, defer. These are all expressable in the language itself using CPS |
13:22:53 | Zevv | which I find pretty cool, IMHO |
13:22:56 | FromDiscord | <shadow.> how are people identified on irc by the bridge bot? |
13:23:15 | FromDiscord | <shadow.> since yk you guys always have the same profile pictures which im assuming is by identification |
13:23:38 | haxscramper | robohash on nickname |
13:24:14 | FromDiscord | <shadow.> hmm |
13:24:25 | FromDiscord | <shadow.> is the bridge bot open source? |
13:25:02 | haxscramper | !repo ircord |
13:25:02 | disbot | https://github.com/Yardanico/ircord -- 9ircord: 11Discord <-> IRC bridge in Nim 15 12⭐ 2🍴 |
13:25:03 | FromDiscord | <mratsim> Sorry I can't release the source code of Skynet |
13:25:10 | FromDiscord | <shadow.> lol |
13:25:13 | haxscramper | I think it is this one |
13:25:24 | FromDiscord | <Rika> It is |
13:25:29 | * | mfiano joined #nim |
13:25:50 | FromDiscord | <shadow.> hmm |
13:26:09 | FromDiscord | <shadow.> im guessing it's using one webhook and just using avatar / name overloads in the json post? |
13:27:11 | Zevv | shodow.: In theory it's npeggable, if you create your peg compile time from your input |
13:27:16 | FromDiscord | <shadow.> im just thinking it wouldnt be too hard to make a command for irc folks to set a custom pfp for bridge, tho to be fair irc doesn't even have pfps so they might not care lol |
13:27:20 | FromDiscord | <shadow.> ah i see |
13:27:22 | FromDiscord | <shadow.> thanks |
13:27:31 | Zevv | but it's not worth it |
13:27:33 | FromDiscord | <Rika> I doubt they care |
13:29:43 | mipri | a "circle slash discord" image would be amusing. |
13:29:56 | * | mfiano quit (Ping timeout: 240 seconds) |
13:30:00 | mipri | mainly I want the bot to stop dropping normal ASCII characters. |
13:30:35 | FromDiscord | <shadow.> hmm |
13:31:15 | FromDiscord | <shadow.> im confused why like |
13:31:19 | FromDiscord | <shadow.> asterisks are dropped |
13:31:33 | FromDiscord | <shadow.> because in dapi it certainly doesn't drop the asterisks |
13:31:37 | mipri | probably they have meaning for Discord, and need to be esacped |
13:31:53 | FromDiscord | <shadow.> well it's discord -> irc not other way |
13:31:59 | FromDiscord | <shadow.> does this work |
13:32:03 | FromDiscord | <dom96> > CPS continuations are also on the heap, at least in the current PoC↵how come? Is this a necessity or just a convenience for now. I thought a big advantage of the proposal is that we can avoid these heap allocs. |
13:32:11 | mipri | no, but it also drops them going irc -> discord |
13:32:20 | FromDiscord | <shadow.> ohh hm |
13:32:29 | FromDiscord | <shadow.> yeah in discord they mean italics |
13:32:33 | FromDiscord | <shadow.> you needa escape |
13:32:44 | FromDiscord | <shadow.> but yours dont even show as italics so |
13:32:57 | FromDiscord | <shadow.> ima take a look at the repo and maybe try and fix it |
13:33:05 | FromDiscord | <dom96> Zevv: I feel like all of those things are expressable in the language itself. CPS after all is implemented without changes to the compiler, right? |
13:33:13 | mipri | https://irclogs.nim-lang.org/10-12-2020.html#19:11:30 |
13:33:17 | haxscramper | `code`, *italic*, **bold**, __a__ |
13:33:53 | mipri | !eval var s = "ab\0\0\0"; echo @($cast[cstring](s[0].addr)) # from paste in the log |
13:33:56 | NimBot | @['a', 'b'] |
13:34:01 | mipri | cast[cstring](that) |
13:34:09 | mipri | what's that look like? |
13:34:14 | FromDiscord | <mratsim> problem 1 mentioned here on Chronos limitation: https://github.com/status-im/nim-chronos/issues/2#issue-327470294↵Also the difference between stackless and stackful coroutines/futures. |
13:34:16 | disbot | ➥ [RFC] Async I/O with structural control flow (a.k.a. Enforced Awaits) ; snippet at 12https://play.nim-lang.org/#ix=2j7c |
13:34:31 | haxscramper | mipri: `cast[cstrin]` is completely destroyed |
13:34:31 | FromDiscord | <Quibono> How would I know when macos arm is supported, like where should I be checking? |
13:34:43 | FromDiscord | <mratsim> If you allow returning a future that you spawned, you have to heap allocated. |
13:35:02 | FromDiscord | <mratsim> if not you can stack allocate |
13:35:10 | FromDiscord | <mratsim> with the current async/await as well btw |
13:35:31 | FromDiscord | <mratsim> it's just "if something escapes it's caller scope you can't stack allocate it" |
13:35:43 | mipri | Quibono: github, just search for arm and this comes up: https://github.com/nim-lang/Nim/issues/16211 |
13:35:44 | disbot | ➥ Support for Apple Silicon / M1 ; snippet at 12https://play.nim-lang.org/#ix=2IBQ |
13:35:59 | FromDiscord | <mratsim> so either you need restrictions which zahary proposes, or you use borrow checking for optimization. |
13:36:20 | FromDiscord | <Quibono> So the issue will get closed when it's resolved? |
13:36:36 | FromDiscord | <mratsim> @dom96 can you look into disabling embeds for github links and nim-lang.org links? |
13:36:42 | FromDiscord | <mratsim> so annoying |
13:36:50 | FromDiscord | <dom96> Okay, I'm just trying to understand CPS in isolation for now, regardless of how it would be applied to async |
13:36:55 | FromDiscord | <shadow.> iiuc there's a workaround currently @Quibono |
13:37:21 | FromDiscord | <dom96> @mratsim yeah, it's very annoying, let me see |
13:37:21 | FromDiscord | <Quibono> Which one @shadow., I tried modifying the one file and it crashed |
13:37:46 | FromDiscord | <shadow.> hm |
13:38:00 | FromDiscord | <shadow.> he did some more lower, but it seems this isnt a good solution |
13:38:05 | FromDiscord | <shadow.> id say wait for it to be resolved |
13:39:47 | * | fputs quit (Read error: Connection reset by peer) |
13:39:49 | * | mfiano joined #nim |
13:40:05 | FromDiscord | <dom96> looks like this is per-user https://support.discord.com/hc/en-us/articles/206342858--How-do-I-disable-auto-embed- |
13:40:23 | FromDiscord | <dom96> Test: <https://github.com/nim-lang/Nim/issues/16211> |
13:40:24 | disbot | ➥ Support for Apple Silicon / M1 ; snippet at 12https://play.nim-lang.org/#ix=2IBQ |
13:40:29 | FromDiscord | <dom96> https://github.com/nim-lang/Nim/issues/16211 |
13:40:30 | disbot | ➥ Support for Apple Silicon / M1 ; snippet at 12https://play.nim-lang.org/#ix=2IBQ |
13:40:38 | FromDiscord | <dom96> yeah, so you can wrap in `<>` |
13:40:52 | FromDiscord | <dom96> but then it's up to every user to do that :/ |
13:42:01 | FromDiscord | <dom96> @mratsim so disregarding async/await and Future being returned. On a CPS vs. closure iterator comparison only, as long as you are not returning a Future-like object, CPS has one less heap allocation than closure iterators? |
13:42:32 | * | habamax joined #nim |
13:43:10 | Zevv | CPS does not actually care about your allocations, environments can live on the stack as well, or be global and static, or heap allocated |
13:43:51 | Zevv | when we split one "linear" function into n continuations, we still need 1 environment block (= 1 allocation) for the whole flow. So there is no new future for each closure trampoline |
13:44:18 | FromDiscord | <dom96> looking at the paper the environment seems to be passed via the function arguments |
13:44:23 | FromDiscord | <mratsim> I don't know the implementation of closure iterators :/. I think this goes well over various async designs and their allocation cost: https://aturon.github.io/blog/2016/09/07/futures-design/ |
13:44:28 | FromDiscord | <Quibono> So I need to retry modifying build.sh |
13:44:56 | * | mfiano quit (Ping timeout: 272 seconds) |
13:45:32 | FromDiscord | <dom96> @Quibono you need a new C sources build, until you get this it won't work, unless someone else created updated C sources |
13:46:06 | FromDiscord | <mratsim> basically, you can:↵- stack or heap allocate your closures. This will restrict which task you can switch to and from↵- stack or heap allocate your future/channel/way of comunicating back the result. This will restrict where the result needs to be consumed. |
13:46:21 | FromDiscord | <mratsim> This is orthogonal to CPS vs async vs Weave. |
13:46:36 | FromDiscord | <Quibono> @dom96 Which is what I needed another computer for. Gotcha. So just keep checking github |
13:46:44 | Zevv | dom96: right. When CPSing a function we construct an object type T which has one member `which his proc(env: T)` |
13:46:57 | Zevv | no, `proc(env: var T)` |
13:47:23 | Zevv | We pass the env into the proc, the proc works with the data in the env, replaces the `fn` member with the next continuation that should be invoked |
13:48:29 | FromDiscord | <Clyybber> test #6666 |
13:48:31 | disbot | https://github.com/nim-lang/Nim/issues/6666 -- 5Internal error for procs of `auto` result type returning a type and not declared as `compiletime` ; snippet at 12https://play.nim-lang.org/#ix=2IGZ |
13:48:33 | Zevv | the object has basically the same layout as the stack frames of the proc would have during function execution. |
13:48:48 | FromDiscord | <Clyybber> @dom96 maybe disable embeds for disbot; don't think I have the perms for that |
13:48:52 | Zevv | so at compile time we deduce the size of the env, and basically the env object is the stack of the function, living somewhere else then on the stack |
13:49:08 | Zevv | it is exactly as large as it needs to be, not larger |
13:50:20 | FromDiscord | <dom96> well FromIRC had admin permissions |
13:50:28 | FromDiscord | <dom96> I disabled them, not sure if that will break it |
13:50:52 | FromDiscord | <Clyybber> lets test #12345 |
13:50:53 | disbot | https://github.com/nim-lang/Nim/issues/12345 -- 3Confusing error with static parameters ; snippet at 12https://play.nim-lang.org/#ix=26CQ |
13:51:08 | FromDiscord | <dom96> well that didn't help |
13:52:11 | FromDiscord | <mratsim> @Zevv, interesting where is that done? |
13:53:01 | FromDiscord | <mratsim> I wonder how to mix that with schedulers who needs type-erased continuations :/ |
13:53:09 | FromDiscord | <mratsim> which |
13:53:19 | FromDiscord | <dom96> so for async currently we're actually paying for 1 alloc for future, 1 alloc for closure iterator's env, n alloc for each parameter |
13:53:32 | FromDiscord | <dom96> if I'm understanding correctly |
13:54:23 | * | NimBot joined #nim |
13:54:30 | FromDiscord | <mratsim> parameters are in the environment |
13:54:39 | FromDiscord | <mratsim> So I think it's 2 |
13:54:45 | * | sk_ joined #nim |
13:54:55 | FromDiscord | <mratsim> correction, locals are in the environment |
13:54:58 | Zevv | mratsim: where is what done? |
13:55:05 | FromDiscord | <mratsim> parameters are passed like a regular function call |
13:55:18 | FromDiscord | <mratsim> The precise size usage thing. |
13:55:32 | Zevv | that's the environment object we build |
13:55:43 | sk_ | hi, how to write `if x not in y:` in nim |
13:55:44 | Zevv | the current implementation from disruptek is not exactly like that because he was stuborn |
13:55:54 | FromDiscord | <mratsim> `if x notin y` |
13:55:58 | Zevv | he now just puts all locals in one object, filling up the object |
13:56:10 | FromDiscord | <mratsim> that's what I do in Weave |
13:56:29 | Zevv | but the ideal implementation (and we know how to do it), should generate a specific env object for each potential continuation |
13:56:34 | Zevv | with exactly the objects that live at that time |
13:56:47 | FromDiscord | <mratsim> I do some hack with typles `env[] = (a, b, c, d)` |
13:56:53 | Zevv | then the object type gets casted over between calls |
13:57:07 | FromDiscord | <mratsim> and on deserialization (a, b, c, d) = env[] |
13:57:24 | Zevv | so for example, if you have a var 'i', then a 'j' in a nested block, and a 'k' in a later nested block after the first, 'j' and 'k' can occupy the exact same location |
13:57:27 | FromDiscord | <Yardanico> @dom96 since I'm using webhook for sending the message to discord - https://discord.com/developers/docs/resources/webhook#execute-webhook - the only good way to "disable" embeds is to automatically enclose all URLs in <>, but I don't know if that's desired behaviour. or alternatively I can only do that for specific usernames, like disbot |
13:57:27 | Zevv | just as the would on the stack |
13:57:28 | FromDiscord | <mratsim> with env being a cast[ptr EnvType] |
13:57:35 | sk_ | mratsim haha thanks. |
13:57:44 | Zevv | does that make sense? |
13:58:00 | FromDiscord | <dom96> I’d say please do it for everyone |
13:58:00 | FromDiscord | <mratsim> yes it makes sense |
13:58:18 | FromDiscord | <dom96> Also, we need support for the new replies 🙂 |
13:58:19 | FromDiscord | <mratsim> My main grip is github and nim links |
13:58:27 | FromDiscord | <mratsim> youtube links in offtopic are fine |
13:58:43 | FromDiscord | <mratsim> but github embeds don't add anything. |
13:58:54 | * | klaufir_ joined #nim |
13:59:06 | FromDiscord | <Yardanico> @dom96 support as in - provide the username of the user you're replying to on IRC side, so you can "reply" to IRC people? |
13:59:31 | FromDiscord | <Yardanico> idk if Dimscord was updated with new replies |
14:01:57 | FromDiscord | <dom96> I think a quote of what you’re responding to would be nice |
14:02:16 | FromDiscord | <Yardanico> a few starting words from it, like the forum updater bot? |
14:02:24 | FromDiscord | <Yardanico> and yes, seems like the discord updated their api for replies https://media.discordapp.net/attachments/371759389889003532/789855154143756318/unknown.png |
14:02:31 | FromDiscord | <Yardanico> five asterisks :D |
14:03:07 | * | sk_ quit (Quit: Leaving) |
14:05:57 | * | clyybber joined #nim |
14:06:41 | * | klaufir_ quit (Ping timeout: 268 seconds) |
14:06:42 | FromDiscord | <dom96> I think as much as can fit |
14:06:55 | FromDiscord | <dom96> Basically replicate the old reply functionality |
14:07:16 | FromDiscord | <Yardanico> the "quote" you mean |
14:07:18 | FromDiscord | <Yardanico> oh, they removed it completely? |
14:07:22 | FromDiscord | <dom96> Yeah |
14:07:28 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2IH8 |
14:08:01 | FromDiscord | <Yardanico> networking is the first thing that comes to mind obviously :D |
14:08:14 | FromDiscord | <Clyybber> oh hey Yard o/ |
14:08:15 | FromDiscord | <mratsim> sure, P2P and all that jazz |
14:08:18 | FromDiscord | <Yardanico> @Clyybber hallo |
14:08:44 | FromDiscord | <mratsim> reading from a file, socket. |
14:09:26 | FromDiscord | <Yardanico> @dom96 I'll see what I can do, so 1) disable embeds for urls in the bot 2) make replies work correctly |
14:09:39 | FromDiscord | <mratsim> for nim-lang.org and github.com |
14:09:47 | FromDiscord | <mratsim> youtube is OK 😉 |
14:09:48 | FromDiscord | <dom96> Http server |
14:09:57 | FromDiscord | <Yardanico> @mratsim guess I should have both URL and username blacklist? :P |
14:09:59 | FromDiscord | <dom96> Thank you 🙂 |
14:10:08 | FromDiscord | <mratsim> sounds flexible enough |
14:10:39 | FromDiscord | <Yardanico> disbot and ForumUpdaterBot for username, nim-lang, github for URL (maybe stackoverflow too) |
14:11:10 | FromDiscord | <mratsim> any unfurled URL that basically repeats the header instead of the content. |
14:12:03 | FromDiscord | <flywind> What's the time complexity of `cstring.len` in VM? |
14:13:42 | FromDiscord | <mratsim> in the VM cstring have the same representation as strings I think so I assume o(1). |
14:14:10 | FromDiscord | <flywind> I see, thanks |
14:24:39 | FromDiscord | <sealmove> hum, I can't publish on nimble |
14:24:59 | FromDiscord | <sealmove> "refusing to allow a Personal Access Token to create or update workflow `.github/workflows/test.yml` without `workflow` scope" |
14:26:30 | * | mfiano joined #nim |
14:29:48 | FromDiscord | <sealmove> oh so the "workflow" scope is also needed... hmm, I don't remember needing it last time |
14:33:08 | FromDiscord | <mratsim> Is everyone aware of those numbers? https://gist.github.com/hellerbarde/2843375 |
14:37:30 | * | mfiano quit (Ping timeout: 272 seconds) |
14:39:45 | Zevv | I got that one hanging on the toilet door |
14:40:21 | FromDiscord | <sealmove> oh nice! |
14:40:43 | federico3 | the numbers change over time - what's really important is the relations between them |
14:40:46 | Zevv | I must admit brusing my teeth usually does not take 100s |
14:41:44 | Zevv | I think it should be extended with some common things |
14:41:47 | Zevv | "calling a function" |
14:41:50 | Zevv | "dereferencing a pointer" |
14:41:59 | Zevv | "executing a system call" |
14:42:37 | * | audiofile joined #nim |
14:42:46 | FromDiscord | <Clyybber> @flywind hmm, maybe put the whole caseSenstivie check behind an if? |
14:42:55 | FromDiscord | <Clyybber> because otherwise we crash for empty string |
14:44:34 | FromDiscord | <flywind> sure |
14:44:46 | FromDiscord | <mratsim> @federico3, actually they don't change |
14:45:06 | FromDiscord | <mratsim> memory, disk and network are still as slow as 6 years before. |
14:45:23 | FromDiscord | <mratsim> while CPU improved a lot compared to them. |
14:46:59 | * | mfiano joined #nim |
14:52:21 | * | mfiano quit (Ping timeout: 265 seconds) |
14:55:04 | * | mfiano joined #nim |
14:58:20 | FromDiscord | <Yardanico> @mratsim electron developers will be like "what are those numbers?" |
14:58:57 | FromDiscord | <mratsim> Electron developers are the hobgobelins of your CPU resources. |
15:00:49 | haxscramper | How I would go about getting these numbers for various things in nim, specifically different vayes of calling a functions and associated costs? E.g. do you have any specific recommendations for articles on benchmarking that I should read. |
15:01:41 | haxscramper | I understand it is mostly about ratios of these numbers and not exact values, but still should be interesting to have |
15:02:01 | * | mfiano quit (Ping timeout: 265 seconds) |
15:05:22 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2IHY |
15:05:30 | FromDiscord | <mratsim> 0.33 ns per cycle on a 3GHz CPU. |
15:06:03 | FromDiscord | <shadow.> @ElegantBeef is your scantuple in devel yet? |
15:06:35 | FromDiscord | <mratsim> so I would put function call in the same order of magnitude as a branch mispredict. |
15:07:20 | FromDiscord | <mratsim> but there is also the delay of loading the function from memory, if it's a fuction already i the cache it doesn't cost anything, but otherwise you need to wait for memory |
15:10:13 | FromDiscord | <haxscramper> And the cost of things like closures, methods etc. can be calculated based on the number of additional operations performed for a call (accessing closure environment, dispatching to find correct method body and so on). |
15:11:16 | FromDiscord | <haxscramper> So I should look at generated C and assembly to get a better idea of what is going on. |
15:12:00 | * | mfiano joined #nim |
15:17:03 | FromDiscord | <mratsim> the cost of closures is dwarfed by memory allocation cost |
15:17:29 | FromDiscord | <mratsim> and methods depend on the size of the root class because they are dispatched by a tree of if |
15:17:37 | * | mfiano quit (Ping timeout: 264 seconds) |
15:17:44 | FromDiscord | <mratsim> plus they require a heap allocated object as well. |
15:18:09 | FromDiscord | <mratsim> in short, run this benchmark: https://github.com/mratsim/Arraymancer/blob/master/benchmarks/implementation/proc_method_closure_bench.nim |
15:18:32 | FromDiscord | <mratsim> and this one also: https://github.com/status-im/nimbus-eth1/wiki/Interpreter-optimization-resources#nim-implementation-benchmark |
15:18:37 | federico3 | mratsim: "<mratsim> while CPU improved a lot compared to them." that's my point: some of the numbers change and therefore the relations between them. E.g. at one time doing on-the-fly compression during I/O is helpful, at another time is not |
15:18:58 | FromDiscord | <mratsim> but none of the numbers here refere to CPU operations |
15:19:02 | FromDiscord | <mratsim> refers |
15:19:21 | FromDiscord | <mratsim> it's all memory, networking or disk. |
15:19:44 | federico3 | yes and thats' unfortunate |
15:22:59 | federico3 | well, things like compressing and branch mispredictions are CPU-bound, but timings on context switching, doing a fork & so on are equally important |
15:22:59 | FromDiscord | <haxscramper> This one does not compile - on line 279 you probably need to change `rand` to `sample`. Should I fix this one on wiki? |
15:23:20 | FromDiscord | <mratsim> sure |
15:24:09 | FromDiscord | <mratsim> syscalls are about 150 / 200 cycles + CPU cache pollution which will likely require you to reload data from L2 or L3 cache. |
15:25:25 | FromDiscord | <haxscramper> It seems like I don't have access to editing wiki pages on this repo, sorry |
15:25:47 | FromDiscord | <mratsim> np |
15:26:32 | federico3 | also, disk seeks and reads changed drastically between spinners, SSD, and recent NVMe |
15:28:49 | FromDiscord | <mratsim> HDD and SSD are in there. |
15:29:08 | * | clemens3_ is now known as clemens3 |
15:32:37 | federico3 | somewhere I've seen historical charts around CPU vs I/O vs network timings |
15:33:22 | * | mfiano joined #nim |
15:34:20 | FromDiscord | <shadow.> hmmm |
15:34:43 | FromDiscord | <shadow.> `>Num " " >Num " | " >Num " " >Num` (num being `+Digit`) why isn't that matching "1 2 | 3 4" |
15:34:58 | FromDiscord | <shadow.> or anything else like the example |
15:35:38 | FromDiscord | <shadow.> ah wait |
15:35:43 | FromDiscord | <shadow.> i think it's bc i have another rule above like it one sec |
15:36:48 | FromDiscord | <shadow.> ah yeah my other rule is eating it up lol |
15:37:12 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IIf |
15:39:02 | FromDiscord | <shadow.> ah right just change the order in the `or` im guessing |
15:39:05 | * | mfiano quit (Ping timeout: 240 seconds) |
15:39:43 | FromDiscord | <shadow.> got it |
15:45:37 | disruptek | zevv: originally, we computed the ideal environments, but that results in more copies and harder pooling. |
15:46:33 | disruptek | mratsim: we just change the code to refer to the environment so there's no assignment needed. |
15:47:07 | Zevv | "harder pooling" ? |
15:47:13 | Zevv | "more copies"? |
15:47:15 | disruptek | the objects aren't the same size. |
15:47:30 | Zevv | no but you only allocate the outermost biggest one originally |
15:47:32 | Zevv | the rest "fits" |
15:47:47 | Zevv | you allocate max of all possible envs for a split up proc |
15:47:57 | Zevv | and cast all permutations in there |
15:47:58 | disruptek | but the location of the contents changes. |
15:48:06 | Zevv | not if you do it right |
15:48:13 | Zevv | it's recursive. it's towers of hanoi |
15:48:16 | disruptek | well, sure, but you would have to binpack the thing. |
15:48:24 | Zevv | nope |
15:48:36 | Zevv | your natural stack does exactly the same. It grows. shrinks a bit, grows a bit |
15:48:53 | Zevv | so do all these objects you build. If you build them in the same order (Which you do, because that is how it comes naturally) |
15:49:03 | * | mfiano joined #nim |
15:49:20 | disruptek | i remain unconvinced. |
15:49:26 | Zevv | I'll draw a picture |
15:49:37 | * | natrys joined #nim |
15:49:45 | disruptek | but anyway, it doesn't matter. |
15:49:54 | Zevv | it does, a bit. We allocate Just Enough |
15:50:11 | Zevv | the lazy solution is not bad as well. We allocate Just A bit More |
15:50:19 | disruptek | well, turn the code back on. we splitting of envs is a simple if statement. |
15:50:24 | disruptek | s/we/the/ |
15:50:30 | Zevv | sure |
15:50:37 | Zevv | doesnt matter indeed for now |
15:50:41 | disruptek | you can save us a couple bytes. 🙄 |
15:50:56 | Zevv | Clyybber mentioned there is a special peek mode in macros where you can see how your for loops expanded |
15:51:05 | Zevv | if it's that simple, we also support non-closure iterators |
15:53:20 | FromDiscord | <mratsim> @zevv, @disruptek, I think the allocation strategy should be managed by the scheduler anyway |
15:53:50 | Zevv | sure, but it's about allocating a bit more or a bit less, only |
15:54:00 | Zevv | but indeed |
15:54:08 | Zevv | disruptek: the other day it came up that our current envs are refs. |
15:54:16 | Zevv | what is the impact if we make them object type |
15:54:20 | Zevv | non ref, non pointer |
15:54:49 | * | mfiano quit (Ping timeout: 264 seconds) |
15:54:50 | FromDiscord | <mratsim> we can have a "stack scheduler" for async for example but for multithreading you need those on the heap. And you might need one env per task because you don't know the order they will be processed in. |
15:55:00 | Zevv | the clusure fn then takes `var T` instead of `T`. But it will make the schedulers life easier, mratsim can pool his heart out, and we can also put them on the stack if we want |
15:55:12 | disruptek | hmm. |
15:55:13 | Zevv | right, that ^^ |
15:55:34 | Zevv | CPS should not care a single bit |
15:55:41 | Zevv | just drop the ref from your concept and var your args |
15:55:43 | FromDiscord | <mratsim> technically I don't want to pool but it depends on the constraint we put. |
15:55:54 | Zevv | sure. but if you want, you should be able to |
15:56:10 | Zevv | We mainly target ARC, personally I want to target global allocations for tiny scale embedded |
15:56:16 | disruptek | the /original/ idea, btw, was that the env types use inheritance. 😉 |
15:56:24 | FromDiscord | <mratsim> meh |
15:56:47 | Zevv | sure, but we can just shove all stuff in like we do now, or create different types and cast along |
15:56:54 | FromDiscord | <mratsim> maybe with concepts and vtable but they aren't here |
15:56:58 | disruptek | it was an effort at **correct by construction**. |
15:57:00 | Zevv | don't. there is no reason to |
15:57:08 | Zevv | OO does not make it correct |
15:57:13 | Zevv | /inheritence/ |
15:57:28 | * | mfiano joined #nim |
15:57:34 | disruptek | it would put each symbol into the typedef just once. |
15:57:43 | disruptek | single source of truth. |
15:58:10 | disruptek | i'm just saying... that's why the original design split the envs. |
15:59:10 | disruptek | you will have to use cast to pass different types around. |
16:00:18 | disruptek | missing vtable is a deal-breaker, i think. |
16:00:24 | Zevv | shadow.: here's mine, but it has a off-by-one which I don't feel like fixing. https://github.com/zevv/aoc2020/blob/master/19/main.nim |
16:00:27 | FromDiscord | <gcao> sent a long message, see http://ix.io/2IIv |
16:00:38 | Zevv | it parses the grammar with npeg into a list of choices with sequences |
16:00:44 | Zevv | and then has a pretty trevial match function |
16:00:51 | Zevv | (which is broken somehow, still :) ) |
16:00:54 | disruptek | lemme get some coffee and i will think about other reasons to shit on your objects. |
16:00:55 | Zevv | whatever it's worth |
16:00:56 | FromDiscord | <lqdev> @gcao no. |
16:01:09 | Zevv | disruptek: I can't think of any problems, actually |
16:01:12 | FromDiscord | <lqdev> why would you need that, what are you trying to do? |
16:01:17 | FromDiscord | <gcao> I |
16:01:45 | disruptek | the problems are in the dispatcher, which is basically... someone else's problem. |
16:01:49 | disruptek | but it's still a problem. |
16:01:59 | disruptek | i don't plan to use CPS without a dispatcher. 🤣 |
16:02:25 | Zevv | I do |
16:02:36 | disruptek | no trampoline? really. you savage. |
16:03:28 | FromDiscord | <gcao> @lqdev I'm implementing a plugin-like architecture. A main program will load compiled extensions. In the main program there are global variables like "first" above. I would like the extension to access them instead of clones. |
16:03:42 | FromDiscord | <lqdev> oh |
16:04:13 | FromDiscord | <mratsim> @disruptek, I need coroutines without dispatcher to debug concurrent data structures like queues or hash tables 😉 |
16:04:17 | FromDiscord | <lqdev> well, here's my idea: use a single `ref object` instead of globals. |
16:04:32 | FromDiscord | <mratsim> because the dispatcher would be a "mathematical" algorithm |
16:04:35 | FromDiscord | <lqdev> and then share that `ref object` between all your plugins |
16:05:05 | * | mfiano quit (Ping timeout: 256 seconds) |
16:05:08 | FromDiscord | <gcao> thanks I'll give it a try |
16:05:19 | FromDiscord | <mratsim> @gcao, use shallow seq |
16:05:28 | FromDiscord | <gcao> how? |
16:05:32 | FromDiscord | <mratsim> they will have reference semantics |
16:05:53 | FromDiscord | <lqdev> i think mratsim's referring to system.shallow |
16:06:04 | FromDiscord | <mratsim> https://github.com/mratsim/Arraymancer/blob/v0.6.0/src/tensor/data_structure.nim#L20-L30 |
16:06:10 | FromDiscord | <gcao> thanks let me read about it. |
16:06:16 | FromDiscord | <mratsim> the {.shallow.} pragma |
16:06:36 | Zevv | i thought that was a mratsim-only pragma |
16:06:41 | FromDiscord | <mratsim> it makes string and seq in the object copy by reference instead of by value which is Nim default |
16:06:56 | Zevv | "This can cause serious semantic issues and break memory safety" |
16:07:19 | FromDiscord | <mratsim> that's because people often make mistakes with reference semantics |
16:07:31 | FromDiscord | <gcao> I suppose I still need to call a function in the extension to assign the global "first"? |
16:07:46 | FromDiscord | <mratsim> they to "a = b" then "b[0]=42" and don't realize that a has been changed. |
16:07:49 | kinkinkijkin | there a way to fetch the running user's name in nim, with just the std? |
16:07:53 | FromDiscord | <mratsim> do |
16:08:01 | * | mfiano joined #nim |
16:08:05 | FromDiscord | <gcao> understood |
16:08:06 | * | axion joined #nim |
16:08:09 | * | mfiano quit (Client Quit) |
16:08:59 | * | axion quit (Client Quit) |
16:09:33 | FromDiscord | <gcao> I'll test it out. but if you know the answer already that'll be great.↵I'm thinking of add init(v: seq[A]{.shallow.}) to the extension, and after the extension is loaded, call "init" with first in the main program. |
16:10:04 | FromDiscord | <gcao> is this necessary in order for the extension to access same "first" global variable |
16:10:07 | FromDiscord | <gcao> (edit) "variable" => "variable?" |
16:12:00 | FromDiscord | <shadow.> https://play.nim-lang.org/#ix=2IIP |
16:12:09 | FromDiscord | <shadow.> any idea why this peg is failing zevv? |
16:13:12 | FromDiscord | <mratsim> a shallow seq needs to be wrapped in an object |
16:13:28 | FromDiscord | <mratsim> but for parameter passing Nim doesn't copy. |
16:13:50 | Zevv | shadow: -d:npegTrace should tell you? |
16:14:14 | * | mfiano joined #nim |
16:14:25 | FromDiscord | <mratsim> I think someone should write about using Nim in a plugin way, was it @Zachary Carter that experimented with this a lot? |
16:14:44 | FromDiscord | <Ulrik> NIM what kind of language is this? what's its purpose instead of the other languages?? |
16:14:45 | FromDiscord | <Zachary Carter> yeah I did |
16:14:47 | FromDiscord | <shadow.> with npeg trace what part should i be looking at specifically |
16:14:51 | FromDiscord | <shadow.> read faq |
16:14:55 | Zevv | .shadow: https://play.nim-lang.org/#ix=2IIZ |
16:14:56 | Zevv | works for me |
16:15:13 | FromDiscord | <shadow.> > Nim is one of the very few programmable statically typed languages, and combines the speed and memory efficiency of C, an expressive syntax, memory safety and multiple target languages. |
16:15:16 | Zevv | are you doing part 2? Did you change rule 8 and 11 yet? |
16:15:22 | FromDiscord | <shadow.> > Nim is a statically typed compiled systems programming language. |
16:15:23 | FromDiscord | <shadow.> im doing part one |
16:15:26 | Zevv | ok |
16:15:28 | Fish-Face | I am still on part 1 |
16:15:31 | Fish-Face | also trying npeg today |
16:15:42 | FromDiscord | <shadow.> yeah i tried it on a small set like you did zevv and it worked |
16:15:50 | FromDiscord | <shadow.> but when i tried it on my file |
16:15:51 | FromDiscord | <shadow.> it doesn't work |
16:16:00 | Zevv | my above link has a working parser |
16:16:15 | FromDiscord | <Ulrik> @shadow. What about go? it does exactly the same and is 100x more popular |
16:16:16 | Zevv | but it's more flexible. It parses choices of seqs |
16:16:22 | Zevv | Ulrik: true |
16:16:25 | Zevv | go is great |
16:16:27 | FromDiscord | <gcao> @Zachary Carter any suggestions on how to approach this and gotchas? |
16:16:30 | FromDiscord | <shadow.> i mean |
16:16:38 | FromDiscord | <shadow.> does go have generics |
16:16:40 | FromDiscord | <shadow.> metaprogramming |
16:16:45 | FromDiscord | <haxscramper> It does approximately 30% of what nim does |
16:16:46 | FromDiscord | <shadow.> arguably more readable syntax |
16:17:01 | FromDiscord | <Ulrik> It dosnt have brackets language without brackets are messy |
16:17:02 | Zevv | it has a good thrading story |
16:17:11 | FromDiscord | <shadow.> that's objective. |
16:17:17 | FromDiscord | <Zachary Carter> @gcao I don't really know the context of what you're trying to do, but I can explain what I've done. |
16:17:43 | Zevv | Ulrik: but sure, if Go fits your needs, stick with it. Nim might not add anything useful for you |
16:17:54 | FromDiscord | <Zachary Carter> obviously, step 1, is compiling your program to a shared library |
16:17:57 | Zevv | The Go stdlib is terrific as well |
16:17:57 | FromDiscord | <Ulrik> I really wanna learn nim but is it worth it at it's state i mean what can i actully do that i can't do with others?? it looks nice and extremly easy |
16:18:03 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IJ8 |
16:18:11 | FromDiscord | <shadow.> i can certainly tell which is more verbose |
16:18:17 | Zevv | Ulrik: it *is* nice and easy. But it's a beast if you unleash the power |
16:18:32 | FromDiscord | <Zachary Carter> then you need code to handle the loading / unloading of plugins and symbols inside their associated shared libraries |
16:18:33 | Zevv | While Go has its limits. Without generics and OO, your code tends to get verbose or repetative |
16:18:37 | FromDiscord | <shadow.> you don't have generics, ufcs, metaprogramming, ffi, etc in go |
16:18:41 | FromDiscord | <shadow.> and yeah no oo either |
16:18:47 | Zevv | shadow.: there is ffi allright |
16:18:47 | FromDiscord | <Ulrik> aware of taht |
16:18:51 | FromDiscord | <shadow.> there is? |
16:18:52 | FromDiscord | <shadow.> oh damn |
16:18:53 | FromDiscord | <Ulrik> but Is it really needed |
16:18:59 | FromDiscord | <shadow.> is it as good as nims tho lmao |
16:19:01 | FromDiscord | <Zachary Carter> there is some complexity there, so I've historically opted to just use some C/C++ code to do it for me |
16:19:04 | Zevv | Ulrik: Of course not. |
16:19:10 | Zevv | You can write everything you want in assembly |
16:19:10 | FromDiscord | <gcao> I'm creating a toy language. I have a main interpreter, but want to move non-core libraries in extensions. I have several global variables in the main interpreter which may be accessed from extensions |
16:19:28 | Zevv | what is _needed_ is subjective. |
16:19:41 | FromDiscord | <Zachary Carter> I use this library - https://github.com/fungos/cr |
16:19:50 | FromDiscord | <mratsim> @shadow. Did you hear about aboriginal generics: https://github.com/vasilevp/aboriginal↵Also Go has "metaprogramming" by generating a .go file with their angular/Vue.js like stuff: https://blog.golang.org/generate |
16:20:05 | FromDiscord | <Ulrik> I still don't see the need for nim |
16:20:10 | FromDiscord | <Ulrik> How old is it? |
16:20:12 | FromDiscord | <shadow.> then dont learn it |
16:20:21 | FromDiscord | <gcao> C and FFI are not my main concern. the extensions may be in Nim only |
16:20:24 | FromDiscord | <shadow.> if you dont need it there's no reason to learn it |
16:20:29 | Zevv | Ulrik: I find nim the best of a number of worlds. For me it's mostly about being low-friction. It /just works/ usually, and I enjoy typing Nim. The resulting binaries are small and fast, have almost no dependencies. Also Nim tagets every single thing with a C compile, which is about everything ever made |
16:20:36 | Zevv | Ulrik: about 15 years old |
16:20:44 | FromDiscord | <Zachary Carter> so what problem are you having exactly? |
16:20:55 | FromDiscord | <Ulrik> Nim is 15 years old and bearly has even reached the top 99, that says alot. |
16:21:08 | Zevv | Sure. That say s a lot. |
16:21:15 | FromDiscord | <shadow.> in all fairness go is kind of backed by google so it's not exactly a fair comparison |
16:21:27 | FromDiscord | <Ulrik> Well that is true |
16:21:39 | FromDiscord | <Zachary Carter> Is D in the top 99? |
16:21:39 | Zevv | Ulrik: no one is saying you are wrong, are they? |
16:21:49 | FromDiscord | <haxscramper> Most of the hyped languages are either 40+ old or backed by google/mozilla etc. |
16:21:49 | FromDiscord | <Clyybber> greatness takes time |
16:21:54 | FromDiscord | <gcao> there are two main problems I'm concerned. The first is the global variables seem to be duplicated inside the extension |
16:21:58 | FromDiscord | <Zachary Carter> is Zig? |
16:22:07 | Zevv | Ulrik: mind that Nim has /no/ big backer companies, no commercial involvments. Go went big because of google. Rust went big because of mozilla. |
16:22:11 | FromDiscord | <Zachary Carter> do you have some example code? |
16:22:49 | FromDiscord | <Zachary Carter> I've encountered something similar - and I'll use a compiler define to handle that |
16:23:02 | FromDiscord | <shadow.> @Ulrik what do you like making? |
16:23:04 | FromDiscord | <Zachary Carter> so the symbols are only declared in a single compilation unit |
16:23:05 | Zevv | Ulrik: you can find that good or bad. For me it's pretty important. Also I generally like the folks involved, there's a few pretty smart ones I learn from every day. |
16:23:17 | FromDiscord | <gcao> https://github.com/gcao/gene.nim/blob/http/src/genex/http.nim |
16:23:41 | FromDiscord | <Ulrik> @shadow. Web scrapping, discord bots. Websites currently uses node.js with EJS + express. Doing system calls, micro service, Programming network interfaces. |
16:24:06 | FromDiscord | <gcao> lots of global variables here https://github.com/gcao/gene.nim/blob/http/src/gene/types.nim#L971 |
16:24:06 | FromDiscord | <shadow.> well if you're doing web scraping and discord bots why are you looking at compiled languages / statically typed ones? |
16:24:12 | FromDiscord | <shadow.> do you need high high efficiency? |
16:24:36 | FromDiscord | <shadow.> i would honestly typically recommend py or js over any other language for stuff like that |
16:24:58 | FromDiscord | <Ulrik> No. Not exactly, but my bots tend to get some compelxicty. The one i ahve now is calculating runway in use for airports and creates GPS routes and send cordinbates thru discord witch works very terribly. |
16:25:13 | FromDiscord | <shadow.> hm |
16:25:21 | FromDiscord | <mratsim> Besides generics Go doesn't have sum types/ADTs/variants, this makes it poor to serve as the backend for implementing programming languages, parsers and DSLs |
16:25:22 | FromDiscord | <shadow.> well nim does have a pretty nice dapi library |
16:25:25 | FromDiscord | <Zachary Carter> @gcao I'm cloning the project now |
16:25:35 | FromDiscord | <shadow.> !repo dimscord |
16:25:36 | disbot | https://github.com/krisppurg/dimscord -- 9dimscord: 11A Discord Bot & REST Library for Nim. 15 49⭐ 8🍴 7& 3 more... |
16:25:59 | FromDiscord | <gcao> the branch is to create a working http server in the extension. I have code in the interpreter will load extensions |
16:26:42 | FromDiscord | <gcao> pls feel free to play with it and let me know any suggestions/comments. I'm new to Nim so a lot of things are not done in optimized way |
16:26:56 | FromDiscord | <shadow.> zevv: can i see which line or section it failed on in the npegtrace? |
16:27:52 | Zevv | you can see your subject scrolling by in column #2 |
16:27:58 | FromDiscord | <shadow.> kk lemme check |
16:28:02 | Zevv | also, you can inspect your return value from the match() |
16:28:06 | FromDiscord | <Ulrik> Can NIM do webserver and do websites such as node.js with epxress and EJS can? |
16:28:07 | Zevv | and look at matchMax |
16:28:12 | Zevv | it's the offset up to where matching succeded |
16:28:16 | Zevv | typically that's where you went wrong |
16:28:33 | FromDiscord | <shadow.> column two? |
16:28:41 | FromDiscord | <shadow.> the one with all 0's? |
16:28:42 | FromDiscord | <shadow.> lol |
16:28:59 | Zevv | column 3 then, I dunno |
16:29:05 | Zevv | you'll see your input data there |
16:29:07 | FromDiscord | <shadow.> matchMax: 967 hm |
16:29:10 | FromDiscord | <shadow.> is that the max character? |
16:29:17 | FromDiscord | <Zachary Carter> @gcao sure |
16:29:25 | Zevv | right. So then you dump your subject[967..^1] |
16:29:28 | Zevv | and see where that is |
16:29:32 | FromDiscord | <shadow.> ohhh nice nice |
16:29:42 | Zevv | I should write that stuff down, right |
16:29:50 | FromDiscord | <shadow.> hm? |
16:29:52 | Zevv | :) |
16:30:45 | FromDiscord | <shadow.> `8: 42` |
16:30:48 | FromDiscord | <shadow.> i didn't account for that |
16:30:52 | FromDiscord | <shadow.> rip |
16:30:57 | Zevv | there you have it :) |
16:31:06 | Zevv | your rules have a grammar, use that |
16:31:15 | FromDiscord | <shadow.> yup |
16:31:21 | Zevv | each rule consists of a squence of choices of (sequence of rule ids) |
16:31:33 | FromDiscord | <shadow.> thanks |
16:31:45 | FromDiscord | <shadow.> for the help lol |
16:31:46 | Zevv | now you're only matching X X | X X |
16:31:55 | Zevv | but make sure to also match other numbers or X's or number of choices |
16:32:01 | Zevv | like X X | X X X | X X X |
16:32:18 | FromDiscord | <shadow.> if im not wrong those dont appear in my input, but yeah that'd probably be a good idea |
16:32:31 | Zevv | your input mihgt change, right |
16:33:19 | FromDiscord | <shadow.> i see |
16:33:52 | narimiran | Zevv: `X X | X X X | X X X` don't appear in the input |
16:34:05 | FromDiscord | <shadow.> ah `x | x` did tho |
16:34:11 | narimiran | it is just `x x` or `x x | x x` |
16:34:24 | Zevv | narimiran: oh and what about rule 11 in part 2 |
16:34:48 | * | letto_ quit (Quit: Konversation terminated!) |
16:34:50 | narimiran | no idea, i haven't even solved part 1 |
16:35:03 | FromDiscord | <shadow.> alr ig im changing to a seq[seq[int]] lol |
16:35:07 | Zevv | haha |
16:35:20 | FromDiscord | <shadow.> im guessing im just gonna wind up using a recursive regex builder |
16:35:24 | FromDiscord | <shadow.> for part one |
16:35:29 | * | letto joined #nim |
16:35:54 | Zevv | it's about matching a choice, and then commiting or backtracking |
16:35:56 | narimiran | when i saw the task i was "hmmm, maybe i should really start learning npeg" |
16:35:56 | Zevv | recurse until done |
16:36:11 | FromDiscord | <shadow.> yeah |
16:36:52 | narimiran | but i decided to do it myself, which — in hindsight — wasn't the smartest choice. |
16:37:35 | narimiran | and then after lots of failed attempts, i decided to give up. which *was* a smart choice. |
16:39:09 | disruptek | mratsim: CPS requires a trampoline unless we impl tailcall recursion in c, as you know. i use dispatcher<->trampoline interchangeably. |
16:39:48 | Zevv | the trampoline is also nice for debugging, let's just keep that |
16:40:57 | FromDiscord | <mratsim> it would be nice if the compiler had trampolines in debug mode instead of crashing at 2000 recursions |
16:41:52 | disruptek | i would rather have tail calls. |
16:41:57 | haxscramper | I updated by C++ OOP interop idea - now it should be possible to override C++ method with nim closures as supply custom user data without deriving. https://gist.github.com/haxscramper/558f470dff55dbb3b09fce7cf92e2e74 |
16:41:57 | haxscramper | Most likely I will go with this implementation for C++ interop, but if anyone has some input |
16:41:57 | haxscramper | It would be nice to hear |
16:41:57 | haxscramper | Or some comments on overall code |
16:42:18 | disruptek | but i don't care about exporting a 3 line template or whatever. |
16:42:30 | Zevv | disruptek: well, we could make this work for the lucky folks who have a C compiler doing TCO |
16:42:49 | Zevv | or for the folks who know they will go to limited depth |
16:43:16 | disruptek | i guess one nice feature of non-ref env is that we can overload [] usefully, though it might confuse the reader a bit. |
16:43:19 | Zevv | we might be able to tail-call-a-bit and then trampoline |
16:43:25 | Zevv | so you go, like, 30 deep, and then bail out |
16:43:59 | Zevv | trampoline once, and go back in |
16:44:27 | disruptek | that's the dispatcher's problem. |
16:44:35 | disruptek | they can just have a state machine or whatever they want. |
16:44:45 | Zevv | not if you want to natively tail call |
16:44:51 | Zevv | then we should not return the fn, but call it |
16:45:01 | disruptek | that's what mutant was. |
16:45:04 | Zevv | in the CPS transformed proc |
16:45:44 | disruptek | i would rather return the proc and not store it in the env. |
16:46:21 | Zevv | talk talk talk but do we have somehing that works |
16:46:21 | disruptek | i don't see what it buys me to store a pointer to it. |
16:46:27 | FromDiscord | <shadow.> zevv: gottem |
16:46:32 | Zevv | nice |
16:46:40 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IJJ |
16:46:42 | FromDiscord | <shadow.> shoulda just done that from the beginning lol |
16:58:31 | * | lritter joined #nim |
17:04:18 | FromGitter | <bung87> in quote do how do I prevent await expand too earlier ? |
17:04:48 | FromGitter | <bung87> I have ``body`` which contains `await` |
17:05:54 | FromDiscord | <Goel> Hello, which is the latest version of nim compiler? |
17:06:25 | * | mfx joined #nim |
17:06:42 | FromGitter | <bung87> stable 1.4 devel 1.5 |
17:07:40 | FromGitter | <bung87> I got `internalRead(cast[type(resp(req, "Hello World", headers, Http200))](chronosInternalTmpFuture))' has no type (or is ambiguous)` |
17:07:53 | disruptek | dom96, mratsim: i can make disbot wrap urls if you want. assuming i can get nimterop to work well enough that i can compile the bot. |
17:09:15 | FromDiscord | <Goel> This is weird, i'm using choosenim to update nim but i don't understand, i used "choosenim stable" command but it tells me "choosenim Info: Version 1.0.6 already selected |
17:09:56 | FromGitter | <bung87> you ever update versions ? |
17:10:15 | FromDiscord | <Goel> Of choosenim? |
17:10:23 | * | mfx quit (Remote host closed the connection) |
17:11:03 | FromGitter | <bung87> update stable or devel, looks like it doen't get latest versions |
17:11:39 | FromDiscord | <Goel> my choosenim version currently is 0.7.5 |
17:12:40 | FromGitter | <bung87> not about tool, nim versions |
17:12:53 | FromDiscord | <Goel> Same goes if i use "nim -v" tells me im using nim compiler 1.0.6 |
17:13:02 | disruptek | why does `nimble test` need to give me a stack trace when a test fails? so dumb. |
17:13:13 | disruptek | it's like no one tests this shit. |
17:14:00 | FromGitter | <bung87> I mean update your nim versions |
17:14:04 | disruptek | it's 10 lines of text to tell me one single bit of information. |
17:16:05 | FromDiscord | <Goel> With "choosenim update stable"? |
17:16:22 | FromGitter | <bung87> the information it give you like "hey , I choose the latest stable as I know is 1.0.6" but there's versions I dont know |
17:16:41 | disruptek | ~gitnim |
17:16:42 | disbot | gitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek |
17:16:47 | FromDiscord | <Goel> Ok now it works, thanks |
17:17:36 | FromGitter | <bung87> weird , it doesn't fetch meta info about versions |
17:19:48 | FromDiscord | <Goel> also in the latest version of choosenim for win x64 there is no run.bat file, only the exe, and wasn't working. I had to download the 0.7.4 release zipped |
17:27:15 | * | hipoint-yc9 quit (Quit: 420) |
17:27:48 | * | hpyc9 joined #nim |
17:32:46 | disruptek | neat. |
17:37:10 | * | hnOsmium0001 joined #nim |
17:39:11 | FromDiscord | <Daniel> how do i make nim forum send me email when some1 replies in the forum thread? |
17:41:48 | disruptek | how do i make honor killings more socially acceptable in my community? |
17:42:35 | FromDiscord | <tiatomee> There is `Option[T]` but is there something like `Result[T, E]` or `Either[A, B]`? |
17:46:15 | disruptek | !repo badresults |
17:46:16 | disbot | https://github.com/disruptek/badresults -- 9badresults: 11like results but worse 15 1⭐ 0🍴 |
17:47:00 | disruptek | the original implementation really should be linked there, but it's called, like, nim-results. |
17:48:10 | disruptek | araq, clyybber: badresults tests demonstrate a cpp --gc:arc codegen bug. |
17:51:00 | FromDiscord | <mratsim> !repo nim-result |
17:51:01 | disbot | https://github.com/arnetheduck/nim-result -- 9nim-result: 11Friendly, exception-free value-or-error returns, similar to Option[T] 15 38⭐ 6🍴 7& 4 more... |
17:51:11 | disruptek | yeah, that one. |
17:51:33 | FromDiscord | <mratsim> !repo stew also has nim-results and a couple of standard utilities we use at Status |
17:51:34 | disbot | no results 😢 |
17:51:40 | FromDiscord | <mratsim> !repo stew |
17:51:41 | disbot | https://github.com/status-im/nim-stew -- 9nim-stew: 11stew is collection of utilities, std library extensions and budding libraries that are frequently used at Status, but are too small to deserve their own git repository. 15 37⭐ 4🍴 |
17:51:46 | disruptek | it's funny, i just typing the link into the README. |
17:51:47 | * | audiofile quit (Quit: Connection closed) |
17:51:58 | disruptek | how big is stew now? |
17:52:31 | FromDiscord | <mratsim> maybe 10 modules |
17:52:56 | FromDiscord | <mratsim> 25 actually |
17:53:06 | FromDiscord | <tiatomee> Interesting, thanks! I ended up making my own type for now 🙈 |
17:53:14 | FromDiscord | <Clyybber> disruptek: ah cool |
17:53:14 | FromDiscord | <mratsim> I only use byteutils, endians2 and results |
17:53:28 | disruptek | nothin' wrong with that. |
17:55:19 | FromDiscord | <dom96> 0.7.5 is a pre-release, that's why you don't get a run.bat file |
17:57:24 | leorize | mratsim: if you find the time, can you port some of the heavily used modules to fusion? :) |
17:58:07 | disruptek | please disregard my rant about `nimble test`. i don't know what it does. my exception was due to my own laziness. |
18:00:59 | disruptek | clyybber, araq: it's the bug i reported previously; explicit --exceptions:goto breaks codegen under cpp and arc. |
18:01:19 | Zevv | disruptek: what it buys you to store a pointer in it is that the caller doesn't have to keep track of 2 things. So probably not worth to put it in there |
18:01:42 | disruptek | when does the caller not know both things, though? |
18:02:06 | Zevv | right, that's what I'm saying |
18:02:21 | disruptek | right. |
18:02:24 | Zevv | right. |
18:02:28 | disruptek | i got it, buddy. |
18:02:32 | Zevv | me too |
18:02:33 | disruptek | i GOTCHU. |
18:02:35 | Zevv | great pair, we, right |
18:02:38 | disruptek | right. |
18:03:19 | disruptek | so... cuckoo filter today, or more attention paid to my testes? |
18:04:52 | disruptek | if there's a `show tips? 🗵` that you leave checked, in what software does it appear? |
18:08:50 | disruptek | i guess you folks know everything. |
18:11:02 | * | Sembei joined #nim |
18:11:12 | * | lritter quit (Quit: Leaving) |
18:13:36 | Zevv | Clyybber: how is this getImplTransformed supposed to work? Not like this I guess? https://play.nim-lang.org/#ix=2IKg |
18:14:43 | FromDiscord | <Clyybber> you give it a proc syn |
18:14:48 | FromDiscord | <Clyybber> (edit) "syn" => "sym" |
18:15:05 | Zevv | ow and I just noticed "see tests/macros/tmacros_various.nim" in the manual |
18:15:09 | Zevv | first ask, then read |
18:15:15 | Zevv | first shoot, then ask, then read |
18:15:38 | disruptek | shoot, ask |
18:15:48 | Zevv | but quickly |
18:15:49 | disruptek | or just shoot? |
18:17:48 | * | klaufir_ joined #nim |
18:18:34 | leorize | disruptek: wdyt about this "feature"? :P https://github.com/alaviss/setup-nim/pull/5 |
18:18:41 | disbot | ➥ Add function to allow downloading compiler for other architecture |
18:20:03 | Zevv | well well disruptek, would you look at this. You knew? https://play.nim-lang.org/#ix=2IKo |
18:20:15 | disruptek | hard to believe, i know. |
18:20:58 | FromDiscord | <tiatomee> In Rust there's `std::time::Instant` which uses the (ideally) monotonic clock and allows you to get a `Duration` from two `Instant`s. I see the `times` module has a `Duration` too but I see no mention of monotony anywhere on that page. Is there some API that guarantees monotony? |
18:21:40 | leorize | std/monotimes |
18:21:59 | leorize | https://nim-lang.org/docs/monotimes.html |
18:22:08 | Zevv | who is anyone supposed to find that?! |
18:22:15 | FromDiscord | <Rebel> google? |
18:22:20 | Zevv | and why is it not in times? |
18:22:25 | disruptek | it's new. |
18:22:29 | Zevv | sweet |
18:22:32 | leorize | we really need an autogenerator for the library page |
18:22:36 | disruptek | well, it's not /that/ new. |
18:22:43 | disruptek | times is a mess, imo. |
18:22:44 | Zevv | sour |
18:22:44 | FromDiscord | <tiatomee> Thanks a lot! I am having a bit of trouble finding my way through the docs I gotta admit |
18:22:55 | leorize | Zevv: it's in the index if anyone ever look at it |
18:23:07 | FromDiscord | <Rebel> Also Disruptek do not think I forgot my problems will be fixed the nightmare will end one day. A bigger project has taken priority and I am back in C# land using Blazor and MassTransit |
18:23:11 | FromDiscord | <tiatomee> The Rust APIs and docs really treated me well, I need to adapt to Nim 😅 |
18:23:14 | Zevv | tiatomee: yeah, you don't want to know how much we improved over the last year, but it's still not at the point it should be |
18:23:15 | FromDiscord | <Rebel> (edit) "Also Disruptek do not think I forgot my problems will be fixed ... the" added "and" |
18:23:19 | disruptek | you know what, we should really flip this whole problem of libraries on its head. |
18:23:23 | leorize | (and the index is a horrible mixed up mess) |
18:23:35 | FromDiscord | <mratsim> @leorize, time? where do you find that? |
18:23:43 | disruptek | blazor makes my pants tight. |
18:23:48 | FromDiscord | <mratsim> I tried to import the times module but it didn't work |
18:23:57 | Zevv | I had a visit to Golang a few months ago, and I was able to instantly find *everything* in the place I expected it to be |
18:23:58 | leorize | import std/monotimes |
18:24:05 | FromDiscord | <tiatomee> Zevv: oh yeah I don't mean to talk bad about it at all. I think it's more a testament to Rust rather than a critique of Nim 😄 Glad it's being worked on though :) |
18:24:26 | FromDiscord | <Rebel> Bruh what do you have against Blazor lol don't you dare and try rip on dependency injection |
18:24:27 | FromDiscord | <exelotl> +1, Rust really has a culture of writing excellent docs |
18:24:31 | disruptek | why don't we just version the library with incrementing majors and just monorepo whatever we want? |
18:24:36 | Zevv | tiatomee: it *is* a fair point. |
18:24:55 | disruptek | putting everyone at head will solve all our problems. |
18:25:09 | Zevv | and I'm just as guilty as anyone else, here I am sitting on my couch, not writing or improving the documentation |
18:25:14 | leorize | https://forum.nim-lang.org/c/3 <- we have a docs category to discuss on the forum |
18:25:30 | disruptek | araq: seriously, tell me why this idea doesn't make sense. |
18:25:35 | FromDiscord | <mratsim> @tiatomee https://nim-lang.org/docs/theindex.html |
18:26:20 | leorize | we need to organize yet-another-doc-rework tbh |
18:26:28 | FromDiscord | <mratsim> Rust has to write excellent docs because the language is so hard when you try it for the first time. Nim grew complacent because it's easier :/ |
18:26:50 | disruptek | maybe the solution to the docs is a tool to make writing docs RIDICULOUSLY easy. |
18:26:57 | FromDiscord | <Rebel> Well that is one of rust's biggest problems is the learning curve it's always up there in the yearly survey |
18:27:02 | disruptek | not writing, /contributing docs/. |
18:27:12 | leorize | and nim's biggest is docs |
18:27:32 | disruptek | mratsim: this is more true than you know. |
18:27:33 | FromDiscord | <Rebel> You want something like Sphinx but for Nim disruptek? |
18:27:44 | disruptek | no, i would just use sphinx. |
18:27:50 | disruptek | but, not that. i'm talking about ndoc. |
18:27:56 | FromDiscord | <Rebel> ah |
18:28:06 | disruptek | ndoc should be /primarily/ a way to /contribute/ documentation. |
18:28:14 | disruptek | as fast as it is, it should be even easier. |
18:28:21 | leorize | !repo ndoc |
18:28:23 | disbot | https://github.com/nodeca/ndoc -- 9ndoc: 11js port of pdoc, with extentions 15 93⭐ 8🍴 7& 29 more... |
18:28:26 | disruptek | lol |
18:28:29 | FromDiscord | <mratsim> We can just use sphinx since Nim and sphinx are both using RST |
18:28:31 | leorize | wait what is ndoc? |
18:28:41 | disruptek | right, i prefer mkdocs but sphinx is good, too. |
18:28:42 | FromDiscord | <mratsim> nim doc foo.nim |
18:28:49 | disruptek | ndoc is pydoc for nim. |
18:28:56 | disruptek | !repo disruptek/ndoc |
18:28:57 | disbot | https://github.com/disruptek/ndoc -- 9ndoc: 11like pydoc but for nim 15 0⭐ 0🍴 |
18:28:58 | disruptek | it's v-ware. |
18:29:13 | FromDiscord | <mratsim> we call that "readme-driven development" |
18:29:14 | FromDiscord | <exelotl> @mratsim yeah this exactly↵I'd like to write an RFC for improving nim's doc gen but what I really want is a Sphinx plugin so I can write custom docs with my own layout/structure and pull in proc signatures and doc comments from my lib's source wherever I want. |
18:29:25 | disruptek | ~vware is readme-driven development. |
18:29:26 | disbot | vware: 11readme-driven development. |
18:29:52 | disruptek | our doc gen is great, especially for runnable examples. |
18:30:12 | leorize | if we ever want to push this forward I'd recommend using the forum to organize the effort |
18:30:20 | disruptek | we should be able to have runnable examples include a toggle to add expandArc notations to the example. |
18:30:28 | FromDiscord | <mratsim> it doesn't work on repos with a private module and some functions imported and made public by another module |
18:30:31 | disruptek | then you can see the resource impact of the example. |
18:30:36 | leorize | irc is frequent by like 5-6 devs that actively work on nim |
18:30:55 | disruptek | leorize: you can be our liason. |
18:31:00 | disruptek | i really hate the web. |
18:31:16 | FromDiscord | <Rebel> If you want to see some good docs for a library check out fastapi docs those docs are no joke 😛 |
18:31:37 | disruptek | if you really want someone to read something, provide a link. no joke. |
18:31:43 | FromDiscord | <mratsim> At Status we just use the Rust doc generator for documentation 😉 |
18:31:50 | disruptek | i mean, i hate the web. i think i just mentioned that. |
18:32:00 | disruptek | don't make me fucking search. |
18:32:06 | FromDiscord | <Rebel> well I mean you're not wrong lol |
18:32:06 | FromDiscord | <Rebel> https://fastapi.tiangolo.com/ |
18:32:16 | leorize | disruptek: dude I want to write software too, can't just organize stuff :P |
18:32:27 | disruptek | leorize: what. |
18:32:41 | disruptek | are you saying you want me to help you? |
18:33:04 | FromDiscord | <mratsim> @Rebel looks good |
18:33:08 | FromDiscord | <Rebel> We need Nim testimonies of people using Nim at companies and saying how much it helped or didn't lol |
18:33:11 | leorize | yes, you're pretty good at making rants on how things suck :P |
18:33:31 | FromDiscord | <mratsim> Disruptek must be French inside |
18:33:32 | disruptek | i go to this fucking web-site and the first link is to Documentation. |
18:33:36 | disruptek | so of course i click that link. |
18:33:41 | disruptek | that's what i want, right? |
18:33:43 | disruptek | Documentation. |
18:33:48 | disruptek | so where do you think i end up? |
18:33:52 | disruptek | on the same fucking page. |
18:34:02 | FromDiscord | <Rebel> you are on the documentation you silly rabbit |
18:34:12 | leorize | please rant on the forum :) |
18:34:18 | disruptek | but i can't tell because the masthead is so fucking large that i have to actually scroll. |
18:34:24 | leorize | you ranted once about cps and now 4raq gives it priority |
18:34:28 | FromDiscord | <mratsim> @Rebel "We need"? Are you evaluating whther or not to use Nim? |
18:34:30 | leorize | please do the same magic for docs |
18:34:43 | disruptek | no, we've been whispering about cps since like june. |
18:34:59 | disruptek | but i do think ndoc could be easy to write. |
18:34:59 | FromDiscord | <Rebel> oh I just meant it may be a good idea for Nim community to incorporate an opinions section similiar to fastapi's opinion section |
18:35:01 | leorize | people has been complaning about docs since nim is a thing |
18:35:03 | FromDiscord | <mratsim> Yeah I ranted every year about docs and everytime I wanted to cut a new release of Arraymancer. No dice, I still don't have proper support for RST tables :/ |
18:35:06 | disruptek | and it could be a game changer for docs development. |
18:35:24 | disruptek | mratsim: wait, our rst doesn't support tables? |
18:35:27 | Zevv | tiatomee: see what you did there |
18:35:31 | disruptek | that's insane. |
18:35:41 | FromDiscord | <mratsim> there are 2 types of tables in RST |
18:36:05 | disruptek | leorize demonstrated one form. |
18:36:07 | FromDiscord | <mratsim> Nim supports the easy one which no tools produce except pandoc after one Nimmers asked for it in Pandoc repo |
18:36:27 | FromDiscord | <mratsim> it created some kind of war with others that had a regression also |
18:36:28 | FromDiscord | <tiatomee> Zevv: all part of my secret plan >:D |
18:36:29 | disruptek | doesn't /sound/ like the easy one. |
18:36:51 | leorize | https://alaviss.github.io/dnsstamps/dnsstamps.html#initDnsCryptStamp%2Cstring%2CopenArray%5Bbyte%5D%2Cstring%2Cset%5BProperties%5D <- this is the only table i ever wrote |
18:36:59 | disruptek | yeah, that's the one i'm talking about. |
18:37:02 | FromDiscord | <mratsim> anyway, everytime I produce a doc for Arraymancer, I spend like 30 min dealing with RST annoyances :/ |
18:37:04 | Zevv | tiatomee: nah, we have this fit every few weeks |
18:37:09 | FromDiscord | <Rebel> With Nim inline assembly does it support MASM? |
18:37:22 | FromDiscord | <mratsim> it already support Intel masm |
18:37:46 | FromDiscord | <Rebel> interesting |
18:37:47 | FromDiscord | <mratsim> --passC:-masm=intel in the CLI |
18:37:54 | FromDiscord | <Rebel> that might be the easiest to do syscalls then |
18:38:00 | FromDiscord | <Rebel> in C# it's so janky |
18:38:13 | leorize[m] | !repo nim-syscall |
18:38:14 | disbot | https://github.com/def-/nim-syscall -- 9nim-syscall: 11Raw system calls for Nim 15 19⭐ 3🍴 7& 2 more... |
18:38:20 | FromDiscord | <Rebel> no |
18:38:23 | FromDiscord | <Rebel> those are linux syscalls |
18:38:25 | FromDiscord | <Rebel> I need Windows lol |
18:38:33 | FromDiscord | <tiatomee> Uhm probably an easy question, but how do I parse a string to a `uint64`? |
18:38:37 | FromDiscord | <mratsim> Otherwise, just implement/use an assembler as macro: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/assembly/limbs_asm_montred_x86_adx_bmi2.nim#L126-L145 |
18:38:38 | disruptek | don't be a dick, no one here uses windows. |
18:38:47 | superbia | I use windows |
18:38:49 | FromDiscord | <mratsim> @tiatomee, parseUint |
18:38:49 | FromDiscord | <Rebel> Well that's just a lie |
18:39:01 | FromDiscord | <Rebel> Go to any company and tell me which OS you will see more of Linux or Windows? |
18:39:04 | superbia | almost all of the houses in my village have windows |
18:39:05 | FromDiscord | <Rebel> typically ofc |
18:39:05 | disruptek | nim users don't use windows. |
18:39:11 | FromDiscord | <Rebel> that's a lie |
18:39:14 | FromDiscord | <Rebel> I do 😛 |
18:39:21 | FromDiscord | <tiatomee> But that returns a `uint`, is it the same size as `uint64`? |
18:39:22 | disruptek | well, they shouldn't be allowed to use windows. |
18:39:23 | FromDiscord | <tiatomee> I guess I need to cast ten |
18:39:23 | superbia | ah you mean windows OS |
18:39:25 | FromDiscord | <tiatomee> (edit) "ten" => "then" |
18:39:27 | disruptek | friends don't let friends run windows. |
18:39:43 | disruptek | like, you sorta owe it to a friend to get them off windows. |
18:39:46 | FromDiscord | <Rebel> don't tell me you use arch :/ |
18:39:52 | FromDiscord | <mratsim> parseBiggestUint and convert |
18:39:54 | disruptek | it's a religion of ineptitude. |
18:39:55 | FromDiscord | <tiatomee> `Error: unhandled exception: invalid unsigned integer: [ValueError]` I guess not? |
18:40:09 | FromDiscord | <mratsim> integer was negative? |
18:40:17 | leorize[m] | @Rebel why would you ever wanna do syscalls on windows? |
18:40:35 | FromDiscord | <tiatomee> Nope, no negative numbers. Maybe it's the empty line at the end |
18:40:44 | disruptek | look at it this way, if you want software to evolve, is the best way to do that to embrace closed platforms? or open ones? |
18:40:57 | FromDiscord | <mratsim> Apple of course |
18:41:05 | disruptek | lol |
18:41:11 | Zevv | tiatomee: don't cast, convert: https://play.nim-lang.org/#ix=2IKI |
18:41:17 | FromDiscord | <tiatomee> Yeah that was it, trying to parse an empty string. Also thanks for `parseBiggestUint` |
18:41:48 | FromDiscord | <tiatomee> Zevv: isn't that the same with UFCS? |
18:41:49 | disruptek | yeah, it used to be called parseTheBiggestUintYouCanFindLikeTheReallyReallyBittyBigOne. |
18:42:06 | FromDiscord | <mratsim> @tiatomee Nim has UFCS |
18:42:13 | FromDiscord | <tiatomee> Yeah that's what I mean |
18:42:21 | FromDiscord | <tiatomee> `uint64(x)` is the same as `x.uint64` |
18:42:34 | FromDiscord | <tiatomee> unless my lingo is wrong and the first one is not a "cast" |
18:42:37 | FromDiscord | <mratsim> myFn 1234 | 1234.myFn | 1234.myFn() | myFn(1234) are all valid |
18:42:41 | Zevv | tiatomee; yeah but casting is really doing `cast[uint64](sometThing)` |
18:42:47 | disruptek | procs that conflate the name with the type make absolutely zero sense to me. |
18:42:57 | FromDiscord | <tiatomee> Ahh I see, yeah that makes sense then |
18:42:58 | FromDiscord | <mratsim> casting is reinterpreting the raw bit pattern |
18:43:08 | FromDiscord | <mratsim> no checks, you're on your own, unsafe |
18:43:30 | FromDiscord | <mratsim> conversion will have runtime checks (at least until we get formal verification) |
18:44:03 | FromDiscord | <dom96> conversion also has some compile-time checks |
18:44:21 | FromDiscord | <Rebel> Leorize I put why in offtopic |
18:45:22 | * | klaufir_ quit (Ping timeout: 256 seconds) |
18:45:42 | FromDiscord | <tiatomee> That all makes sense and I've already used conversions then! |
18:45:45 | FromDiscord | <Rebel> I will figure it out eventually lol have bigger things to worry about and dnlib documentation is so scarce 😦 |
18:46:27 | * | klaufir_ joined #nim |
18:49:54 | FromDiscord | <fwsgonzo> it says that -d:useMalloc uses malloc, realloc and free, so it doesn't use calloc then? |
18:51:15 | FromDiscord | <mratsim> I'm pretty sure malloc = c_alloc that you have in `import system/ansi_c` |
18:51:58 | leorize[m] | @fwsgonzo, nim already do the zeroing so calloc is redundant |
18:52:54 | FromDiscord | <Clyybber> @mratsim not sure if it helps but there have been improvements to the table support lately |
18:53:19 | FromDiscord | <mratsim> tables? Do we have SortedTable now? :p |
18:53:29 | FromDiscord | <Clyybber> oh; rst tables :D https://github.com/nim-lang/Nim/pull/16040 |
18:53:30 | disbot | ➥ RST tables: fix latex col number; allow <= 3 of = |
18:54:08 | disruptek | i was so confused. |
18:55:11 | FromDiscord | <mratsim> ah ok |
18:56:54 | FromDiscord | <tiatomee> Is there a shortcut to take a slice of a `seq[T]` from a position until the end? Something like `s[4..]`? |
18:57:05 | Zevv | s[4..^1] |
18:58:03 | FromDiscord | <tiatomee> Thanks! |
18:59:04 | * | klaufir_ quit (Ping timeout: 272 seconds) |
18:59:30 | FromDiscord | <mratsim> for slices btw, if you are in a perf critical piece of code the slices that are zero-copy and borrow checked are via s.toOpenarray(4, s.high) |
18:59:55 | Zevv | mratsim: don't scare the newbies dude |
19:00:02 | FromDiscord | <mratsim> hopefully we change that soon |
19:00:07 | Zevv | right. |
19:00:12 | disruptek | right. |
19:00:17 | * | lum quit (Quit: Lum: Bye!) |
19:00:18 | FromDiscord | <mratsim> @Araq^ |
19:00:50 | FromDiscord | <tiatomee> That's good to know, thanks @mratsim |
19:01:03 | FromDiscord | <tiatomee> still feels weird to not have borrow semantics in the language at all times |
19:01:09 | FromDiscord | <tiatomee> same with ownership |
19:01:10 | FromDiscord | <mratsim> it has |
19:01:16 | disruptek | that's the beauty of it. |
19:01:35 | disruptek | we don't ask you to compose the annotations; we do it for you. |
19:01:38 | FromDiscord | <mratsim> https://nim-lang.org/docs/manual_experimental.html#view-types |
19:01:40 | FromDiscord | <tiatomee> I've seen the `lent` before, but I mean like "Oh a substring of the input? Just return a new `string`" |
19:02:00 | FromDiscord | <haxscramper> What is the possible reason `cannot instantiate:` error on this code https://play.nim-lang.org/#ix=2IKO ? |
19:02:24 | FromDiscord | <tiatomee> I'm not asking for Nim to be like Rust, I just notice how much those concepts have burned into my head |
19:02:24 | FromDiscord | <mratsim> The thing is, lent types are pretty young and the stdlib is being reworked to use them |
19:03:02 | FromDiscord | <mratsim> we won't make Nim like Rust, more likely like Ada/Sparks if anything |
19:03:21 | FromDiscord | <tiatomee> That's great, I like those too 😄 |
19:03:43 | FromDiscord | <mratsim> That's my hope: https://github.com/nim-lang/RFCs/issues/222 |
19:03:45 | disbot | ➥ Correct-by-construction Nim programs ; snippet at 12https://play.nim-lang.org/#ix=2lbm |
19:04:19 | FromDiscord | <tiatomee> It's just that I'm either in full FP mode and do Idris or Haskell stuff, or I do Rust where I'm more aware of memory layout and all that |
19:04:33 | FromDiscord | <mratsim> You have dependent types in Nim |
19:04:40 | FromDiscord | <mratsim> and monads if you want |
19:04:55 | FromDiscord | <mratsim> Monadic construct: https://github.com/unicredit/emmy |
19:05:36 | Zevv | Monads. I heard these are some kind of burrito's, right |
19:05:39 | FromDiscord | <tiatomee> I'm already happy with range types existing in Nim, I really miss those in Rust |
19:05:43 | FromDiscord | <mratsim> And for dependent types: https://github.com/mratsim/constantine/blob/master/constantine/tower_field_extensions/tower_instantiation.nim#L27-L29 |
19:05:57 | FromDiscord | <mratsim> Curve is an enum corresponding to elliptic curve |
19:06:14 | * | Arrrrrrrrrrrrrrr joined #nim |
19:06:20 | FromDiscord | <mratsim> and I do bigint precomputation at compile time |
19:06:48 | Arrrrrrrrrrrrrrr | Fast question: In nimscript I import times and I get "Error: cannot evaluate at compile time: localInstance", does times work in vm? |
19:06:57 | FromDiscord | <tiatomee> Those are really nice uses, probably not quite what I'd call "full spectrum dependent types" like in Idris, but I don't think anyone would ask for that :D |
19:07:10 | FromDiscord | <tiatomee> performance is a big issue with full dependent types |
19:07:14 | Arrrrrrrrrrrrrrr | Also, any workaround? |
19:07:16 | FromDiscord | <tiatomee> and Nim already seems really powerful! |
19:07:32 | FromDiscord | <mratsim> Nim compile-time VM is as fast as Python |
19:07:42 | FromDiscord | <mratsim> so you can do BigInt in the type system 😉 |
19:08:54 | FromDiscord | <tiatomee> Dependent types can be more than only compile time evaluation :) But that alone is already amazingly useful |
19:08:56 | * | lum joined #nim |
19:09:17 | FromDiscord | <mratsim> int or enums can be part of a function type |
19:09:25 | FromDiscord | <mratsim> a type "type |
19:09:27 | FromDiscord | <mratsim> sorry |
19:09:42 | FromDiscord | <mratsim> what do you need for full support of dependent types? |
19:10:01 | FromDiscord | <tiatomee> also sorry, I don't mean to give off the vibes of "prove to me that Nim is capable enough for me 😈 " or anything |
19:10:01 | * | lum quit (Client Quit) |
19:10:21 | FromDiscord | <tiatomee> I'm already happy with what I'm seeing |
19:10:22 | disruptek | nah, it's cool. |
19:10:24 | FromDiscord | <mratsim> don't worry, it's me who wants to understanding the full need |
19:10:45 | FromDiscord | <tiatomee> Sigma types, aka `proc(x: T): computeType(x) = ...` |
19:10:50 | FromDiscord | <mratsim> I know haskell as it was my first language, Rust as well as i did some stuff in it but never used idris so |
19:10:53 | FromDiscord | <tiatomee> where x can be a runtime value |
19:11:07 | FromDiscord | <tiatomee> That's not a sigma type |
19:11:11 | FromDiscord | <tiatomee> but it's a similar effect |
19:11:27 | FromDiscord | <mratsim> oh, so return type overloading? |
19:11:37 | disruptek | : auto |
19:11:42 | FromDiscord | <tiatomee> a sigma type would be like `proc[T](x: int): (x, array[0..x, T])` |
19:11:49 | disruptek | is, i think what they want. |
19:11:56 | FromDiscord | <mratsim> auto is a hack :p |
19:12:00 | FromDiscord | <Clyybber> yeah, nim's types are compile time only :) |
19:12:05 | FromDiscord | <tiatomee> it's like a tuple, but the type of the second member depends on the value of the first member |
19:12:14 | FromDiscord | <mratsim> if at compile-time we have that |
19:12:16 | disruptek | ah, that's just a generic. |
19:12:20 | FromDiscord | <tiatomee> also lifting runtime values into the type system and doing proofs with that |
19:12:34 | * | blueberrypie joined #nim |
19:12:39 | disruptek | mratsim: indeed, but no more so than converters. |
19:13:08 | FromDiscord | <mratsim> for proofs there is a plan to integrate Z3, with a PoC https://nim-lang.org/docs/drnim.html |
19:13:08 | FromDiscord | <tiatomee> a nice example would be run-length encoding a list/array. The original value is tracked in the type and acts as an invariant to make sure encoding and decoding will always yield the same value |
19:13:10 | * | saem joined #nim |
19:13:16 | FromDiscord | <tiatomee> I saw DrNim, it's super interesting |
19:13:30 | disruptek | tiatomee: tell me more. this is what i want to do with CPS. |
19:13:51 | disruptek | basically, encode the transition in the type so it doesn't get stored at all. |
19:13:54 | FromDiscord | <tiatomee> You mean about run length encoding lists? |
19:14:10 | disruptek | no, i'm talking about free continuation dispatch. |
19:14:35 | FromDiscord | <tiatomee> I'm not sure what you mean with that |
19:14:54 | FromDiscord | <tiatomee> or how that relates to dependent types |
19:14:54 | disruptek | i think what you're talking about we already do with statics. |
19:15:18 | FromDiscord | <mratsim> (30min ago we were talking about parsing string to uint and now we have dependent types, continuation passing style and formal verification) |
19:15:36 | disruptek | cps is a boon to your verification problems, btw. |
19:15:43 | disruptek | i don't know if we ever talked about that. |
19:16:10 | FromDiscord | <tiatomee> I think the biggest difference is that `static`s are like "works for all values passed in at compile time", whereas "full dependent types" have a more "parametric" approach to it |
19:16:13 | FromDiscord | <mratsim> as I said, for formal verification of concurrent data structure I need coroutines/fibers/CPS to emulate threads in a way I can control their interleaving |
19:16:28 | disruptek | yeah, we'll be able to do that for you. |
19:16:31 | FromDiscord | <mratsim> so that would be my first usecase for CPS |
19:16:44 | FromDiscord | <tiatomee> so for example when you write a type that proofs equivalence of run length encoding, it does so for all possible values, not only the ones that are known at compile time |
19:16:49 | disruptek | yep, that's a good one that would be very tough for something like async to beat. |
19:17:11 | FromDiscord | <mratsim> this means no dispatcher 😉 |
19:17:15 | disruptek | tiatomee: yeah, we have that. |
19:17:22 | FromGitter | <HJarausch> I need a helping hand on when to use a template or a macro. E.g. if I want to write *unpack* which acts as a simple version of Python's unpack operator '*'. Given a proc *foo* which returns a tuple of two values, the call ```myfunc(a, unpack(foo()) ``` should expand to something like ``` let T=foo() ; myfunc(a, T[0],T[1])``` ⏎ Can this be achieved by a template, a macro or not at all. ⏎ Many thanks for a hint |
19:17:22 | FromGitter | ... or pointers, ⏎ Helmut [https://gitter.im/nim-lang/Nim?at=5fde51c193af5216fc4fa345] |
19:18:09 | FromDiscord | <mratsim> I think there is one in the wiki or the forum |
19:18:16 | Zevv | this is so getting out of hand |
19:18:19 | FromDiscord | <mratsim> also check unpackArgs in the macro or sugar module |
19:18:39 | Zevv | somethimes I think I know what this is all about, do fun stuff with continuations. And then this kind of talk happens. dudes. |
19:18:52 | disruptek | wut |
19:18:57 | FromDiscord | <tiatomee> didn't mean to derail 🙈 |
19:19:13 | Zevv | I lack the general smarts, no problem, my fault |
19:19:13 | FromDiscord | <mratsim> I already told you about this use case for formal verification of concurrent data structure |
19:19:19 | FromDiscord | <mratsim> like this morning |
19:19:36 | disruptek | shit man, read a wikipedia article once in awhile. |
19:19:37 | FromDiscord | <mratsim> ah no it was in the #science channel maybe? |
19:19:41 | * | blueberrypie quit (Quit: leaving) |
19:19:51 | FromDiscord | <tiatomee> Zevv: in my experience it's less about smarts are mostly about spending a significant time bashing your head against a wall |
19:20:09 | * | blueberrypie joined #nim |
19:20:15 | FromDiscord | <tiatomee> and at some point it kind of becomes clearer if you don't think about it too hard for too long 😆 |
19:20:48 | FromDiscord | <mratsim> ergo, drink, you won't think and it will become clear |
19:21:42 | * | blueberrypie quit (Client Quit) |
19:22:09 | * | blueberrypie joined #nim |
19:22:35 | disruptek | i probably should have saved that typedef of a (-1 or 1) type. i feel like it'd be a good example. |
19:23:25 | FromDiscord | <mratsim> I've been on my IO task and CPU task articles since the morning and i think I won't finish >_> |
19:24:11 | * | lum joined #nim |
19:24:19 | FromDiscord | <Daniel> OT: The more i think about it, the more think how illogical is to compare programming languages to human spoken/written languages, as it has completely different purpose and and structure which is based on logic and math....just my few noob programing thouhts. |
19:24:25 | FromDiscord | <Daniel> (edit) "thouhts." => "thoughts." |
19:24:42 | FromDiscord | <Daniel> (edit) removed "and" |
19:24:55 | disruptek | i think a story came out this week about the different parts of the brain involved in each. |
19:25:10 | disruptek | i feel like i saw an article on /r/programming or something. |
19:25:21 | * | lum quit (Client Quit) |
19:25:47 | FromDiscord | <mratsim> Araq posted it this morning in the channel |
19:26:08 | FromGitter | <haxscramper> @HJarausch regular macros cannot rewrite code that is not passed directly to as arguments, so you'd need to use `unpack(myfunc, a, foo())` or something like that to unpack arguments. You *might* want to try term rewriting macros, but personally I'd just write `let (a, b) = foo(); myfunc(arg, a, b)` manually |
19:26:18 | FromDiscord | <mratsim> TLDR: programming is different from both natural language and math/logic in terms of the brain areas it activates. |
19:26:55 | FromDiscord | <Daniel> I would say it is more connected to logic than to anything else. |
19:27:08 | * | lum joined #nim |
19:27:49 | FromGitter | <haxscramper> I'm pretty sure that term rewriting macros have potential to making your exact syntax possibly, but it would not recommend going there unless it is really necessary |
19:27:59 | * | lum quit (Client Quit) |
19:28:44 | FromDiscord | <mratsim> @Daniel the article mentions that programming also used the creativity part of the brain |
19:30:29 | disruptek | haxscramper: why can't they just use a macro? |
19:31:00 | disruptek | and, i wouldn't use term-rewriting macros. they are probably going to change somehow. |
19:31:22 | FromGitter | <HJarausch> @haxscramper I'd just like to understand the mechanism. If I un |
19:32:48 | * | klaufir_ joined #nim |
19:33:23 | haxscramper | disruptek: because for `myfunc(a, unpack(foo())` `unpack()` must have access to `myfunc` and `a` in order to use them in generated code |
19:33:32 | haxscramper | Which is not possible as they are not passed in arguments |
19:33:41 | disruptek | where are you reading this code? |
19:34:12 | * | Arrrrrrrrrrrrrrr quit (Remote host closed the connection) |
19:34:20 | FromGitter | <HJarausch> So, there is no method to change a parameter list before it get parsed by the compiler |
19:34:31 | saem | I'm having a look at nimsuggest tests, especially ones that were disabled. I have many of them working in this draft PR[1], but especially twithin_macro_prefix.nim I'm not sure about the intention and what I should actually check for, any guidance? [1]: https://github.com/nim-lang/Nim/pull/16401 |
19:34:32 | disbot | ➥ Saem nimsuggest re-enable tests |
19:34:39 | disruptek | oh i missed that message. 🤣 |
19:35:04 | disruptek | it could be done with term rewriting, but yeah, don't. |
19:35:04 | FromDiscord | <Daniel> @mratsim in a way, its form art 🙂 |
19:35:10 | FromGitter | <haxscramper> @HJarausch there is no easy-to-use method, yes |
19:35:20 | FromGitter | <haxscramper> Without writing `unpack(myfunc(a, foo())` that is |
19:35:32 | * | opal quit (Remote host closed the connection) |
19:36:17 | disruptek | !repo curry |
19:36:18 | disbot | https://github.com/t8m8/currying -- 9currying: 11Currying Library for Nim 15 38⭐ 4🍴 7& 1 more... |
19:36:25 | FromDiscord | <mratsim> maybe you can cook something by tagging `myfunc(a, b: params) {.myTransformermacro.}` |
19:36:35 | * | opal joined #nim |
19:36:41 | FromDiscord | <mratsim> and you generate whatever you want in the pragma |
19:36:52 | haxscramper | I guess earler it was a bad time for asking error-related questions, but what is wrong with this piece of code https://play.nim-lang.org/#ix=2IKO ? |
19:37:44 | haxscramper | I want to get default generic parameters using constructor proc |
19:38:27 | disruptek | i'm pretty sure the compiler doesn't allow custom user pragmas for expressions. |
19:38:27 | haxscramper | But I get 'cannot instantiate' error, while I have specified parameters for `initFunctor` |
19:39:02 | disruptek | it would be cool if we could, though. that's a feature i've mentioned using for cps. |
19:39:50 | FromDiscord | <Recruit_main707> would that allow the deprecated `unroll` pragma do be applied to for loops again? |
19:40:08 | FromDiscord | <mratsim> @haxscramper I think it's semcheck bug |
19:40:17 | FromDiscord | <Recruit_main707> (hand written unroll macro that is) |
19:40:19 | FromDiscord | <mratsim> default parameters have a couple of issues with generics |
19:40:37 | FromDiscord | <mratsim> I tried with default(Functor[T]) and Functor[T]() no dice |
19:41:05 | FromDiscord | <mratsim> but I even had issue myself with plain "tolerance = T(0.5)" woth T being SomeFloat |
19:42:11 | FromDiscord | <Recruit_main707> you can do this:↵`proc initGen[T; D: Functor[T]](arg: D = initFunctor[T]()): Gen[T, D] = discard` |
19:42:58 | FromDiscord | <mratsim> ooohh, someone who is even better than me at working around generics issue as appeared? |
19:43:30 | FromDiscord | <mratsim> or no I think D: Functor[T] will not work |
19:43:39 | FromDiscord | <mratsim> you need to hide higher-kinded types |
19:44:46 | FromDiscord | <haxscramper> This worked, now I probably need to make second overload with single parameter |
19:45:09 | FromDiscord | <haxscramper> And this should be actually usable |
19:45:17 | FromDiscord | <mratsim> really? |
19:45:45 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2IL1 well, in this form |
19:45:49 | FromDiscord | <Recruit_main707> ah, overloading functions fixes a lot of issues with generics, i always thought its a bit funny the compiler can handle the issue with function overloading, but not with generics |
19:46:00 | FromDiscord | <Recruit_main707> /certain issues/ |
19:46:25 | FromDiscord | <haxscramper> I'm still bashing my head against default templates in C++ and just decided to hook up all default-ness on constructor procs |
19:46:34 | disruptek | clever. |
19:46:44 | disruptek | until you need to understand why it exists. |
19:47:02 | FromDiscord | <mratsim> I've been stuck in Arraymancer with this syntax :/ maybe i can cookup something https://github.com/nim-lang/Nim/issues/7733 |
19:47:04 | disbot | ➥ Feature request: Generic result type construction from typedesc ; snippet at 12https://play.nim-lang.org/#ix=2IL2 |
19:48:09 | FromDiscord | <mratsim> and also I couldn't define `proc foo[T: TT: Tensor[T]]` |
19:48:22 | FromDiscord | <mratsim> `proc foo[T; TT: Tensor[T]]` |
19:48:58 | FromDiscord | <mratsim> this is so huge! |
19:49:30 | disruptek | quick, it had better be outlawed. |
19:50:16 | disruptek | did you try to build it with a template? |
19:50:50 | Zevv | Can we have macro[T] while we're at it |
19:51:00 | disruptek | right. |
19:51:29 | Zevv | we should reversion to 0.0.1 |
19:51:48 | disruptek | cps? |
19:51:53 | Zevv | Nim |
19:51:58 | Zevv | until it's like /done/ |
19:52:03 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2IL4 although this one does the same basically, but much simpler |
19:52:19 | disruptek | eh, i have enough nim to be dangerous. |
19:52:35 | Zevv | I lost both of my feet more then once |
19:52:48 | disruptek | i'm not too worried about the rest of it. |
19:52:48 | Zevv | 'safe' my a** |
19:53:00 | disruptek | look at what we did with c macros. |
19:53:08 | FromDiscord | <Recruit_main707> it is safe, unless you are unstable |
19:53:10 | disruptek | fucking monkeys. |
19:53:55 | Zevv | !eval var a: ref int; a[] = 42 |
19:53:57 | NimBot | Traceback (most recent call last)↵/usercode/in.nim(1) in↵SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
19:54:24 | FromDiscord | <Recruit_main707> makes sense to me? |
19:54:29 | disruptek | maybe define your target first. |
19:56:22 | * | narimiran quit (Quit: leaving) |
19:57:05 | FromDiscord | <mratsim> uninitialized ref that are dereferenced should have a not nil warning |
19:57:32 | disruptek | yeah, that guy alex something made the same criticism. |
19:57:43 | disruptek | it's not unfair, it's just, like, not a priority for people. |
19:57:54 | FromDiscord | <mratsim> I don't use ref objects :p |
19:58:01 | FromDiscord | <mratsim> or as little as possible |
19:58:25 | disruptek | yeah, but sometimes it's what you want. |
19:59:57 | FromDiscord | <Clyybber> type T = ref T |
20:00:10 | FromDiscord | <mratsim> that's like my type T = distinct T |
20:00:11 | disruptek | glwt |
20:00:42 | disruptek | distinct void seems useful, too. |
20:00:43 | FromDiscord | <Clyybber> @mratsim yeah, your bug report inspired me to take on the type g = proc(i: int): g issue |
20:01:15 | Prestige | Is there a shorthand or sugar to have a proc parameter to be optional, and just discard? Instead of redeclaring the signature |
20:01:24 | FromDiscord | <mratsim> mmmh, distinct void does have a nic ring to it |
20:01:32 | disruptek | right. |
20:01:44 | FromDiscord | <mratsim> I'll change my name to that |
20:01:48 | disruptek | lol |
20:02:08 | FromDiscord | <mratsim> Enjoy! |
20:02:10 | disruptek | i think nasa just misplaced a distinct void. |
20:02:19 | disruptek | isn't that what i read? |
20:02:20 | FromDiscord | <Clyybber> @mratsim it doesn't display on IRC :D |
20:02:25 | FromDiscord | <mratsim> argh :/ |
20:02:47 | disruptek | gah, you put your supermassive black hole down for just /one second/ and.. poof! you never see it again. |
20:03:00 | FromDiscord | <mratsim> @Prestige use `foo(a = 1)` |
20:03:09 | FromDiscord | <mratsim> you can call foo() or foo(2) |
20:03:13 | FromDiscord | <Clyybber> disruptek: T = ref T would be a sideeffect of making P = proc(): P work |
20:03:15 | saem | Are there any folks in particular I should talk to if I have questions about how nimsuggest should behave in various situations -- I'd like to have more regression tests before making any changes? |
20:03:34 | Prestige | this is what I mean https://play.nim-lang.org/#ix=2ILb @mratsim not sure if my explanation was clear |
20:03:37 | FromDiscord | <mratsim> My only want is to not use 100%CPU |
20:03:41 | FromDiscord | <Clyybber> disruptek: Its just a linked list containing very useful information |
20:03:49 | disruptek | yeah, it sounds great. |
20:03:53 | Prestige | the second declaration is something I'd like to be able to do |
20:03:58 | FromDiscord | <Clyybber> disruptek: right? |
20:04:00 | FromDiscord | <Clyybber> :p |
20:04:19 | FromDiscord | <Clyybber> shit way to encode a number |
20:04:23 | FromDiscord | <Clyybber> but definitely scalable |
20:04:37 | disruptek | the developer of kitty tried to tell me that my criticism of his infinite loop was somehow unfair. |
20:04:40 | FromDiscord | <Clyybber> @mratsim heres your bigint: T = ref T |
20:04:52 | disruptek | emphasis on the word /somehow/ ... |
20:05:09 | FromDiscord | <Clyybber> disruptek: Do you have a link? |
20:05:12 | FromDiscord | <mratsim> @Prestige is that what you want? https://play.nim-lang.org/#ix=2ILd |
20:05:28 | disruptek | disbot should have a link. |
20:05:33 | Prestige | oh you can do that? Very cool |
20:06:58 | saem | @mratsim "My only want is to not use 100%CPU" do you mean nimsuggest? |
20:07:24 | Prestige | @mratsim but I cannot invoke it like https://play.nim-lang.org/#ix=2ILe ? |
20:07:44 | FromDiscord | <mratsim> @saem, yes nimsuggest |
20:07:52 | * | lum joined #nim |
20:08:02 | FromDiscord | <mratsim> opening Weave is auto 100% CPU usage fromnimsuggest |
20:08:10 | FromDiscord | <mratsim> very annoying |
20:08:37 | FromDiscord | <nikki> just been not using nimsuggest / nimlsp and it's been mostly ok. def miss "goto def" tho |
20:08:59 | disruptek | what are you using that doesn't have goto def? |
20:09:11 | saem | @mratsim I know what you mean, I commented in your RFC and I've seen some of your posts and issues about it. Presently I'm trying to bolster the tests for it before I make actual changes and I'm not entirely sure if I'm appropriately specifying the behaviour. |
20:09:57 | FromDiscord | <nikki> disruptek: i was using goto def through nimlsp in coc.nvim. but i've just not been using nimlsp anymore after seeing some 100% cpu states |
20:10:12 | FromDiscord | <nikki> gonna just try to remember things and code gud |
20:10:13 | saem | mratsim: I've run into plenty of that myself as I worked on porting the TS extension to Nim. |
20:10:52 | FromDiscord | <nikki> i do have a build running on an fs watch in a terminal next to my editor which is helpful |
20:10:59 | FromDiscord | <mratsim> @Prestige: https://play.nim-lang.org/#ix=2ILf↵echo is a varargs proc hence why it doesn't typematch |
20:11:10 | Prestige | like how this works: https://play.nim-lang.org/#ix=2ILg just hoping there's a shorthand |
20:11:32 | Prestige | 'h |
20:11:38 | Prestige | ah* |
20:11:48 | FromDiscord | <mratsim> yes, there is a => shorthand in sugar |
20:12:19 | saem | Presently I'm just stuck on various bits and pieces mostly to do with not being familiar with where things are and likely not having an entirely productive set up for nim & nimsuggest development. |
20:14:50 | FromDiscord | <mratsim> Pretty sure this should work @Prestige but Nim semcheck is making my life difficult: https://play.nim-lang.org/#ix=2ILi |
20:14:53 | FromDiscord | <Recruit_main707> Prestige: as mratsim says, you can use sugar, or define you proc type before, `type MyProc = proc...` and then `bar: MyProc = proc...` |
20:15:32 | Prestige | I think what mratsim showed at the function signature for foo should work, trying it now in my code |
20:15:36 | FromDiscord | <mratsim> if only i didn't have those gcsafe required annotation ... and => deducing auto types properly |
20:17:26 | Prestige | oh, that's a new one for me - internal error: no environment found |
20:17:55 | saem | Looking at the git history, I think I'll have to see if I can hopefully catch Araq or alavis if I want to get into the weeds about nimsuggest. |
20:18:59 | Zevv | disruptek: your CPS RFC is getting contaminated and polluted. Do we want to talk about mratsim-level 1, or all levels? |
20:22:51 | Prestige | I think my best option is just https://i.imgur.com/jAtFpII.png (the actual use case in my code) |
20:23:25 | disruptek | cps should be the rainbow of concurrency solutions. |
20:23:32 | disruptek | all-inclusive, all the time. |
20:23:35 | disruptek | defund the police. |
20:24:31 | FromDiscord | <Recruit_main707> you are convincing me, i will have to check it |
20:28:02 | FromDiscord | <mratsim> I prefer ponies and unicorns |
20:28:09 | FromDiscord | <mratsim> rainbows are overrated |
20:28:55 | FromDiscord | <haxscramper> I need to come up with `reactor.nim` for `fusion` so people would `import fusion/reactor` |
20:29:25 | FromDiscord | <haxscramper> I determined the name, so now I only have easy part - figuring out what it should do, and implementing this |
20:30:22 | Zevv | maybe make it fission/reactor instead, because that actually _exists_ |
20:31:59 | FromDiscord | <Recruit_main707> fusion reactor is the one that would generate more energy than the one it consumed? |
20:31:59 | disruptek | well, i'm still trying to figure out how layer 1 can be elegant without refs. |
20:32:11 | disruptek | fission. |
20:32:12 | Zevv | whta's the problem, doctor |
20:32:20 | FromDiscord | <Recruit_main707> ok |
20:32:26 | Zevv | with the no-refs |
20:32:26 | disruptek | i dunno how to do the dispatcher without refs. |
20:32:56 | Zevv | you can use a ref in your dispatcher, right? |
20:33:01 | Zevv | just deref what you pass to the CPS procs |
20:33:03 | disruptek | only thing i can think of is to have a meta-dispatcher. |
20:33:43 | disruptek | how can you use a ref in your dispatcher? |
20:33:59 | Zevv | 'ref T' |
20:34:13 | disruptek | yeah, so what value do i put in it, wise guy. |
20:34:16 | Zevv | but of course I'm just here standing on the side, shouting out to you doing the work |
20:34:25 | disruptek | remember that your continuations may be stack-allocated. |
20:34:41 | disruptek | brb moose. |
20:34:45 | Zevv | sure. In our implementation, the initial env is allocated by the CPS generated bootstrap, right |
20:36:16 | FromDiscord | <mratsim> @haxscramper https://github.com/zielmicha/reactor.nim |
20:37:37 | FromDiscord | <tiatomee> What Nim version is required for the `monotimes` module? |
20:37:43 | FromDiscord | <tiatomee> I am on 1.0.4 and it doesn't seem to find it |
20:37:47 | FromDiscord | <lqdev> i think 1.2 |
20:37:54 | FromDiscord | <tiatomee> Ahw shoot |
20:38:01 | Zevv | 1.2. that's oooold |
20:38:04 | FromDiscord | <lqdev> why do you use 1.0.4 |
20:38:17 | FromDiscord | <mratsim> 1.2 is what Status uses ... |
20:38:29 | FromDiscord | <tiatomee> It's what's in the Fedora repos and I can't easily download niminstall |
20:38:40 | FromDiscord | <tiatomee> because github's aws is suuuuuuper slow for me |
20:38:42 | FromDiscord | <mratsim> can you try import "std/monotimes" |
20:38:48 | FromDiscord | <mratsim> instead of just monotimes |
20:38:52 | FromDiscord | <lqdev> ah yeah |
20:38:53 | FromDiscord | <tiatomee> like, 500 bytes/s slow |
20:38:55 | FromDiscord | <mratsim> I think this one was namespaced |
20:39:03 | FromDiscord | <lqdev> mratsim's right |
20:39:04 | FromDiscord | <tiatomee> hah, that works |
20:39:06 | FromDiscord | <tiatomee> Thanks! |
20:39:12 | FromDiscord | <lqdev> i always use the std/ prefix so never noticed lol |
20:41:07 | disruptek | Zevv: yeah, it's allocd by the bootstrap i think. but it wouldn't be. |
20:41:15 | Zevv | right. So the dispatcher allocs |
20:41:22 | Zevv | your dispatcher can then just new() it |
20:41:24 | Zevv | and you have your ref |
20:41:37 | Zevv | my dispatcher can have a global static one or alloc it on the heap |
20:41:38 | disruptek | no, you allow any way you normally alloc. |
20:41:44 | disruptek | alloc, too. |
20:41:46 | * | Q-Master quit (Ping timeout: 256 seconds) |
20:41:50 | disruptek | yeah, whatever. |
20:41:59 | Zevv | yeah. But if you new() it, you got your ref? |
20:42:09 | disruptek | yeah, sure. |
20:42:15 | Zevv | so is there a problem? |
20:42:21 | disruptek | yeah. |
20:42:24 | Zevv | because it's either me being stupid, or you |
20:42:35 | Zevv | or both, that's also not without precedent |
20:42:44 | disruptek | well, tell me how the dispatch works in a world with more than one continuation type. |
20:42:57 | Zevv | yeaah, *thats* a problem, right |
20:43:03 | disruptek | right. |
20:43:20 | Zevv | trampoline[T] |
20:43:58 | disruptek | no, it's more like dispatch knows how to make dispatch containers which can be refs. |
20:44:04 | Zevv | yeah I see now |
20:44:28 | Zevv | so, the alternative is that we go pull ptr |
20:44:33 | Zevv | mratsim would *love* that |
20:44:52 | disruptek | well, i have another idea but i don't know if it's clean enough. |
20:45:08 | disruptek | what if the trampoline has two sides -- the stack side and the heap side. |
20:45:20 | disruptek | you can migrate from side to side. |
20:45:29 | Zevv | there's more then stack and heap |
20:46:02 | Zevv | there's static globals. There's nim-doesn-know-where-this-came-from |
20:47:10 | disruptek | no, i mean dispatch is generic so you can just move with a copy. (what else?) |
20:48:44 | FromDiscord | <mratsim> you type erase |
20:48:55 | FromDiscord | <mratsim> proc fn(env: pointer) |
20:49:08 | Zevv | like I said. mratsim would *love* that |
20:49:16 | FromDiscord | <mratsim> but then you need to set a env maxsize if you want to stack allocate. |
20:49:22 | Zevv | that makes me sad |
20:49:30 | FromDiscord | <mratsim> unless you want to leave dangerously with alloca |
20:49:33 | disruptek | eh it's whatever. |
20:49:48 | disruptek | but i think using a pointer may be too big a concession. |
20:50:00 | FromDiscord | <mratsim> env maxsize is not really a problem most of the time, big stuff go on the heap anyway |
20:50:34 | FromDiscord | <mratsim> how do you type erase without a pointer? |
20:50:49 | FromDiscord | <mratsim> ref array[32, byte] doesn't count |
20:50:57 | * | habamax quit (Ping timeout: 260 seconds) |
20:51:40 | disruptek | hmm, we can use a pointer in the dispatcher without catching too much shit. maybe. |
20:51:48 | * | klaufir_ quit (Ping timeout: 272 seconds) |
20:52:49 | FromDiscord | <mratsim> In weave, the public API is typed but the internals have to be type-erased or I can't enqueue multiple tasks/closures on my worker threads. |
20:53:17 | disruptek | yeah, that's what we're talking about. |
20:53:24 | FromDiscord | <mratsim> The unified executor proposal from C++ somehow as a way around that but their syntax is an ergonomic nightmare. |
20:53:36 | disruptek | i've been thinking about syntax lately. |
20:53:42 | Zevv | technically, that should work. but it's a shame. |
20:53:44 | FromDiscord | <mratsim> (they mention specifically the need of type erasure in futures-based API) |
20:53:45 | Zevv | ooh tell me |
20:53:49 | Zevv | because syntax matters |
20:54:00 | FromDiscord | <mratsim> it's the most important thing. |
20:54:11 | disruptek | we've found that it's not that important to copy people. |
20:54:39 | disruptek | i'd rather have something sympathetic to the language that is net-net superior for that very reason. |
20:54:51 | FromDiscord | <mratsim> we aren't talking about copy here |
20:54:58 | disruptek | right. |
20:55:02 | FromDiscord | <mratsim> alloc != copy |
20:55:18 | FromDiscord | <mratsim> you can copy all you want on any platforms. |
20:55:28 | FromDiscord | <mratsim> you can't alloc on embedded or to be multithreading friendly. |
20:55:38 | FromDiscord | <mratsim> or at least you need to be very careful |
20:55:50 | FromDiscord | <mratsim> and you need to copy the environment anyway. |
20:56:24 | FromDiscord | <mratsim> whether alloc is stack or heap (though on stack you can point to your parent stack frame if you restrict the way continuations are scheduled) |
20:56:43 | * | tane joined #nim |
20:57:14 | disruptek | yeah, so my point is that the dispatcher may be better as a [P: T or ref T]. |
20:57:33 | Zevv | right |
20:57:36 | FromDiscord | <mratsim> so P: T |
20:57:40 | disruptek | yeah. |
20:57:44 | Zevv | that was mratsims earlier idea I think |
20:57:50 | FromDiscord | <mratsim> that's a breakthrough 😛 |
20:58:00 | * | fanta1 quit (Quit: fanta1) |
20:58:04 | Zevv | I don't even know why you take the time to interact with us |
20:58:14 | Zevv | your patience is unlimited |
20:58:20 | FromDiscord | <mratsim> because it's important |
20:58:38 | Zevv | I bet you could do all of this in a morning or two |
20:58:52 | FromDiscord | <mratsim> it's true that I'm not advancing much on my article in the mean time |
20:58:56 | FromDiscord | <mratsim> not true |
20:59:02 | Zevv | three, then |
20:59:17 | FromDiscord | <mratsim> it took me 6 months of intense work and like 3 more months or research to get Weave where it's at |
20:59:51 | disruptek | well, i'm not spending /that/ kinda time. |
20:59:55 | Zevv | I know the feeling. It took me 5 months to get npeg kind of right, and I spent a month or 2 on CPS from first contact to working versions |
20:59:57 | FromDiscord | <mratsim> And this part is even harder |
21:00:11 | disruptek | how do you figure? |
21:00:22 | Zevv | at our age, you can't even afford spending this kind of time |
21:00:29 | disruptek | lol |
21:00:29 | FromDiscord | <mratsim> With Weave I only need to satisfy myself |
21:00:38 | Zevv | hell, at our age, you better not even buy green bananas |
21:00:40 | disruptek | eh zevv is easy to satisfy. |
21:00:48 | disruptek | hehe |
21:01:00 | disruptek | bananas: they fit right, but they're not correct. |
21:01:25 | FromDiscord | <mratsim> so questions for you: how do you optimize IO tasks? |
21:01:41 | Zevv | "optimize" in what sense |
21:02:05 | Zevv | I've done my share of IO over the years, though |
21:02:11 | disruptek | there's no code faster than /no/ code, i always say. |
21:02:25 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/789960856448270366/unknown.png |
21:02:37 | disruptek | i spend no time on email since they cancelled my address for non-payment. |
21:03:06 | Zevv | that kind of optimizing is outside of CPS |
21:03:09 | Zevv | it's your level 3 |
21:03:11 | disruptek | wow, you wrote a markdown to image converter? |
21:03:18 | disruptek | you're blowin' my mind right now. |
21:03:23 | Zevv | yeah its called shiftPrintScreen |
21:03:35 | disruptek | genius. |
21:03:53 | Zevv | mratsim: I'm not sure what your question is |
21:04:29 | Zevv | I'm pretty excited about io_uring, but that's linux only |
21:04:34 | FromDiscord | <mratsim> when people have IO performance problems, what do they do. |
21:04:45 | disruptek | switch to nim. |
21:04:54 | Zevv | a lot is about syscall overhead. Do that as few as possible |
21:04:57 | FromDiscord | <mratsim> apart from using NVMe disk and 10GB connection |
21:05:09 | disruptek | not our problem. |
21:05:12 | Zevv | so writev() over write(), epoll() over poll() |
21:05:30 | Zevv | and now io_uring is the new valhalla, offering zero-copy ring buffers between kernel and user space |
21:05:42 | FromDiscord | <mratsim> IOCP is the same. |
21:05:44 | Zevv | I will *so* run the hell out of that when we got this stuff running |
21:06:04 | Zevv | it seems that the linux community is now about to move half of all possible syscalls onto io_uring |
21:06:12 | Zevv | async is the new orange |
21:06:32 | Zevv | so after decades we'll finally have truly async disk IO |
21:06:39 | Zevv | mixing with async network IO |
21:07:09 | FromDiscord | <mratsim> The Rust async/await implementation is interesting because it's tightly tuned for epoll, by allowing zero alloc with epoll, but with io_uring it's problematic because io_uring requires a buffer and so is completely contrary to Rust async philosophy. |
21:07:22 | Zevv | sure, that's a bad fit |
21:07:34 | Zevv | but I actually can't think of why this would not benefit us with Nim |
21:07:45 | disruptek | can't say i'm disappointed that we can't simply riir. |
21:08:07 | Zevv | riin |
21:08:09 | Zevv | we /riin/ |
21:08:23 | disruptek | maybe we can get ollie to take over my urine wrapper. |
21:08:31 | disruptek | or whatever i called it. |
21:09:06 | FromDiscord | <mratsim> Regarding epoll it still requires a syscall no? |
21:09:11 | disruptek | yeah. |
21:09:45 | Zevv | mutaing the watch list takes one as well |
21:09:48 | Zevv | which is actually a pain |
21:10:15 | disruptek | i can't even remember what my code does. |
21:10:32 | disruptek | i just remember that you were pissed it did like 11 calls on a sleep or something. |
21:10:47 | Zevv | I know we should reuse ioselectors, and we probably could, but it won't make for the best performance I guess |
21:11:00 | disruptek | there will be plenty of dispatchers. |
21:11:06 | Zevv | right. |
21:11:09 | FromDiscord | <mratsim> I skimmed into it. It only has one ref object 😉 |
21:11:09 | disruptek | right. |
21:11:23 | FromDiscord | <mratsim> otherwise just copy-paste Rust MIO |
21:11:41 | FromDiscord | <mratsim> https://github.com/tokio-rs/mio |
21:11:56 | Zevv | apart from that, it's basically just acting on events. That is mostly not different then any other form of IO happening in software |
21:12:00 | Zevv | y'olde 10k problem |
21:12:04 | Zevv | or is it 100k already |
21:13:08 | FromDiscord | <mratsim> well I know very well how to optimize compute, but I don't know how to optimize IO aka download a file faster :p |
21:13:16 | FromDiscord | <Clyybber> io uring is a bit like command buffers on modern graphics apis |
21:13:19 | Zevv | there is only so much you can do |
21:13:39 | Zevv | in the end, it is making sure the mechanism for telling the kernel what you are waiting for is low overhead |
21:14:11 | Zevv | select(), poll(), epoll(), io_uring() |
21:14:15 | disruptek | if you simply read the iouring api you'll intuit anything you need to know. |
21:14:24 | disruptek | it's pretty tight. |
21:14:40 | Zevv | right. so with the non-uring things you still have the syscall and copy overhead to pump the data |
21:14:49 | disruptek | yeah. |
21:15:08 | Zevv | but really, when doing things with TLS for example, the overhead gets small quickly |
21:15:37 | disruptek | i know, but i'm attracted to this because it seems like we have a shot at the title. |
21:15:51 | Zevv | so on the one hand, I look forward to making a razor thing uring interface to see how we can push this to the max. on the other hand, I do not care the least, since "there will be plenty of dispatchers" |
21:16:05 | disruptek | yeah, it's fast enough. |
21:16:21 | disruptek | this is the problem with a lot of nim. |
21:16:41 | disruptek | it's good, maybe it's even better, but it's /not better enough/ and so it's only modest bragging rights. |
21:18:16 | Zevv | how does rust aio work threads? |
21:18:28 | disruptek | no idea. |
21:18:47 | Zevv | because having mratsim on board, _that_ could make the difference, of course |
21:18:59 | Zevv | but there are so many darn smart people in the rust community |
21:19:12 | disruptek | i thought it was a similar state machine. i wasn't super impressed. |
21:19:17 | Zevv | and we only have, like, three or so |
21:19:32 | disruptek | i know, i wish they'd hang out here more often. |
21:19:38 | Zevv | I miss them too |
21:19:49 | FromDiscord | <Rebel> oh god |
21:19:51 | FromDiscord | <Rebel> I heard async |
21:19:53 | FromDiscord | <Rebel> disruptek are you ok? |
21:20:07 | disruptek | yeah, i stopped bleeding a little while ago. |
21:20:15 | FromDiscord | <Rebel> we can talk about async and my problems 😛 |
21:20:16 | FromDiscord | <Rebel> eventually |
21:20:21 | FromDiscord | <Rebel> I'm in Blazor land atm |
21:20:23 | disruptek | unlikely. |
21:20:26 | Zevv | if it's not surrounded by dots and curlies, it's not {.async.}, is it |
21:20:28 | FromDiscord | <Rebel> well I guess |
21:20:31 | disruptek | i told you, i gave up on you awhile ago. |
21:20:31 | FromDiscord | <Rebel> threading and my problems lol |
21:20:35 | FromDiscord | <Rebel> ouch |
21:20:41 | FromDiscord | <Rebel> that's ok |
21:20:45 | FromDiscord | <Rebel> I'll eat the beef and regain strength |
21:20:47 | disruptek | {.color.} |
21:21:02 | FromDiscord | <Rebel> get it? Because the next language I'll probably learn is beeflang lol |
21:21:03 | FromDiscord | <Rebel> or Dart |
21:21:17 | disruptek | dart -- famous red team tongue. |
21:24:08 | FromDiscord | <mratsim> @Zevv: Rust AIO doesn't have to worry about heap allocated futures. They have a threadpool and they have a scheduler based on work-stealing that also keep track of a time budget for each tasks to ensure fairness. |
21:24:44 | FromDiscord | <mratsim> The biggest unknown and most interesting for me is how do they allocate their closures. |
21:25:03 | FromDiscord | <mratsim> do they type-erase them? If yes do they use a max size? |
21:25:13 | FromDiscord | <Rebel> Also disruptek |
21:25:13 | FromDiscord | <mratsim> if not how do they hide that in the scheduler. |
21:25:16 | FromDiscord | <Rebel> never give up |
21:25:34 | disruptek | well it says right there that it's 0-alloc. |
21:25:44 | disruptek | zero alloc, not alloc0. |
21:26:01 | FromDiscord | <mratsim> Rust futures yes, but the scheduler can't be zero alloc. |
21:26:12 | FromDiscord | <mratsim> I'm talking about tokio |
21:26:27 | disruptek | i don't have it in front of me, but i read it off the mio page, which is basically ioselectors. |
21:26:45 | disruptek | or select, anyway. |
21:27:02 | disruptek | what's our level 1? weave? |
21:27:09 | FromDiscord | <mratsim> the system API is "easy" you don't have a choice :p |
21:27:12 | FromDiscord | <mratsim> no |
21:27:13 | disruptek | i kinda scanned through that part of the convo. |
21:27:28 | FromDiscord | <mratsim> Weave and async/await and other scheduler are level 2 |
21:27:50 | FromDiscord | <mratsim> level 1 is cpsLaunch and cpsSwitchTo |
21:28:24 | disruptek | i dunno what that is. |
21:28:36 | FromDiscord | <mratsim> Zevv Lua-like CPS |
21:28:48 | FromDiscord | <mratsim> imitating coroutines since 1867 |
21:29:44 | FromDiscord | <mratsim> cpsLaunch launches a suspendable/resumable function (as in will have a continuation) |
21:30:05 | FromDiscord | <mratsim> cpsSwitchTo resumes a particular function where it was suspended. |
21:30:19 | disruptek | i mean, that's not a thing. |
21:30:26 | FromDiscord | <mratsim> not yet |
21:30:44 | FromDiscord | <mratsim> but we all need dreams |
21:31:06 | disruptek | no, i mean that shit isn't in my dream. |
21:31:08 | FromDiscord | <mratsim> a dev routine job is to make it a reality |
21:31:11 | disruptek | lol |
21:32:21 | FromDiscord | <mratsim> anyway, that stuff make CPS usable for my formal verification of concurrent data structures use case |
21:32:29 | FromDiscord | <mratsim> it gives Zevv the Lua coroutines |
21:32:51 | FromDiscord | <mratsim> I think it can fit some embedded use cases as well. |
21:33:04 | FromDiscord | <mratsim> and a scheduler can work on top of those. |
21:33:10 | disruptek | maybe, but as far as i'm concerned, both those things are the same thing -- and we already have it. |
21:33:13 | FromDiscord | <mratsim> scheduler/dispatcher/trampoline |
21:40:56 | * | haxscramper quit (Remote host closed the connection) |
21:45:12 | FromDiscord | <krisppurg> yardanico, im releasing v1.2.4 soon with replies |
21:50:39 | FromDiscord | <ajusa> Is there any nice way to map an enum to a function? I tried just having the enum value be a proc but that isn't an ordinal type, so it doesn't compile. |
21:51:04 | disruptek | make your enum index an array. |
21:51:42 | FromDiscord | <ajusa> and then have a sequence/array of procs? that seems like it would work 😄 |
21:54:52 | FromDiscord | <polyjitter> i found nim literally yesterday and i think im already falling in love |
21:58:44 | * | Q-Master joined #nim |
21:59:13 | FromDiscord | <mratsim> @ajusa let myArray: [MyEnum, proc(){.nimcall.} = [A: proc1, B: proc2] |
21:59:35 | FromDiscord | <mratsim> let myArray: [MyEnum, proc(){.nimcall.}] = [A: proc1, B: proc2] |
22:00:43 | FromDiscord | <mratsim> using type inference: `let myArray = [A: proc1, B: proc2]` |
22:01:13 | FromDiscord | <mratsim> @polyjitter welcome, hopefully it's not past midnight in your location :p |
22:01:53 | disruptek | why? |
22:02:06 | disruptek | it's always past midnight here. |
22:02:15 | * | Allin joined #nim |
22:02:16 | disruptek | oh. |
22:04:11 | Allin | Sanity check: anybody out there (10 + years since used irssi)? |
22:04:30 | disruptek | yeah. |
22:05:22 | FromDiscord | <polyjitter> it is not, it is 5pm here |
22:05:27 | FromDiscord | <polyjitter> i am at work though so i shouldnt be on here |
22:05:29 | FromDiscord | <polyjitter> whoops :) |
22:05:37 | Allin | Hee: disruptek: you are the one to told me to join this channel! |
22:07:23 | Allin | Allin/Disruptek context: https://github.com/nim-lang/RFCs/issues/295 |
22:07:25 | disbot | ➥ next steps for CPS ; snippet at 12https://play.nim-lang.org/#ix=2Gti |
22:07:42 | disruptek | oh, hey. |
22:07:43 | * | natrys quit (Quit: natrys) |
22:07:53 | disruptek | chris hayes? |
22:08:26 | Allin | Allin = olliNiinivaara |
22:09:01 | FromDiscord | <mratsim> You missed bloody jolly discussions about CPS :p |
22:09:01 | superbia | Allin: what does that mean |
22:09:01 | * | superbia quit (Quit: WeeChat 2.9) |
22:09:03 | FromDiscord | <mratsim> and async |
22:09:09 | disruptek | yeah, US political commentator reference. |
22:09:56 | FromDiscord | <ajusa> how does this work? enum is being used as a key in this list? And how would I call a function given value A for example? myArray[val.ord]? |
22:10:09 | FromDiscord | <ajusa> (edit) "myArray[val.ord]?" => "myArray[val.ord]()?" |
22:10:13 | FromDiscord | <mratsim> myArray[A] |
22:10:16 | disruptek | yeah. assuming the procs all have the same type. |
22:10:30 | FromDiscord | <mratsim> ah yes the parenthesis are needed |
22:10:50 | FromDiscord | <mratsim> I'm sure I have code somewhere that does this. |
22:11:50 | FromDiscord | <ajusa> Alright, I'll try it! Using this along with cligen to have a user basically switch between how a number is calculated, so they would pass in the enum value and I would calculate the number based on the function it maps to |
22:13:09 | disruptek | it takes a special kind of person to hang a dead wolf from the tree in their front yard. |
22:13:31 | disruptek | or, that person and their brother. wolves are surprisingly heavy. |
22:14:17 | Allin | superbia: Allin is https://github.com/olliNiinivaara |
22:14:31 | disruptek | i'm just kidding, of course. |
22:14:45 | disruptek | i don't have a brother. |
22:15:23 | FromDiscord | <haxscramper> Allin: you might see previous discussion about async/CPS discussion from today in IRC logs - https://irclogs.nim-lang.org/19-12-2020.html#11:38:17 though I'm a little lost as to what was the beginning of the discussion, so linked first relevant message |
22:15:33 | disruptek | so what platform are you on, allin? |
22:17:40 | Allin | disruptek: no idea |
22:18:49 | disruptek | well, how many days ago did you reinstall your OS? |
22:19:40 | FromDiscord | <ajusa> disruptek: just read through the RFC for CPS, another gripe I had earlier with async/await is that there is still no cross platform way to read from stdin asynchronously in Nim. Nim in Action, which was written 3 (?) years ago uses a thread based workaround for that exact task. You make a pretty solid argument! |
22:20:21 | FromDiscord | <mratsim> that's because thread is the only way to read asynchronously from stdin |
22:20:31 | disruptek | dom is right that the test is engineered to omit the dispatcher. but that's also the point. |
22:20:31 | FromDiscord | <mratsim> stdin will block the thread, async or not |
22:20:34 | Allin | disruptek: currently VERSION="20.04.1 LTS (Focal Fossa)" |
22:20:59 | disruptek | okay, linux, then. |
22:23:25 | FromDiscord | <ajusa> Good point. I believe that you made an issue under weave to handle IO bound tasks better, which I will be super happy about when it gets implemented 😄 |
22:24:14 | FromDiscord | <mratsim> basically Python/Javascript and other lang know the calls that will block the thread/event loop and hand them over to libuv or equivalent |
22:25:09 | Allin | disruptek: we as clients are just browsers, servers and embedded systems are the targets of CPS/async |
22:25:37 | Allin | disruptek: and talking about servers: https://www.top500.org/statistics/details/osfam/1/ |
22:29:16 | FromDiscord | <ElegantBeef> @shadow. yep it's in devel |
22:30:43 | disruptek | allin: yeah, i was teasing that we'd get you to take over iouring support. but that could be limited if you weren't in a position to develop on the platform. |
22:35:40 | Allin | disruptek: You know I studied same time with Linus Torvalds at CS department of Helsinki...so I have special interest for Linux over some other OS's |
22:36:00 | FromDiscord | <ElegantBeef> Yea well i was born on the same planet, so take that |
22:36:52 | Allin | elegantbeef: if you can cope with Araq, you can cope with Linus |
22:50:37 | FromDiscord | <mratsim> lol |
23:05:31 | Allin | ...oh man, just skimmed through the nim logs on "async", there's more knowledge that I can accommodate... |
23:06:29 | FromDiscord | <tiatomee> Is there something like an iterator over `seq[T]` that gives me "windows" over the sequence? I'd like to view all adjacent elements together, so a "window of size 2" |
23:08:41 | FromDiscord | <mratsim> @Allin sorry :p, that's what happens when i research something. |
23:09:09 | FromDiscord | <mratsim> @tiatomee I don't think there is. |
23:09:31 | FromDiscord | <mratsim> it's pretty easy to implement though |
23:10:00 | Allin | Could it possible to design/imagine the end user API first? |
23:10:19 | FromDiscord | <tiatomee> I'm making an iterator for it now, it isn't hard, just as you said :) |
23:11:52 | FromDiscord | <tiatomee> Ahw, I can't destructive match on `array[0..N, T]`? |
23:12:00 | Allin | I mean - there should not be a two-colored stdlib, but {.async.} pragmas etc. could be no-op:s or effective by underlying implementation |
23:12:09 | FromDiscord | <tiatomee> I'm trying to do `for [a, b] in window(2, input): ...` |
23:12:26 | FromDiscord | <tiatomee> do I have to bind the whole array to one name and then index that instead or is there a way to do this? |
23:13:02 | FromDiscord | <mratsim> @tiatomee https://play.nim-lang.org/#ix=2IMd |
23:14:19 | disruptek | allin: you can just infer that or use an expr pragma. |
23:14:22 | FromDiscord | <tiatomee> I have it the same really, now I wonder if I can destruct the array in a loop |
23:16:03 | FromDiscord | <shadow.> sickkk |
23:17:20 | FromDiscord | <mratsim> @tiatomee the array is automatically destroyed at the end of the scope. |
23:17:55 | Allin | disruptek: I'd say that "designed by irc messages" is not enough; you/we need a repo with "hello world"-level examples |
23:17:55 | FromDiscord | <tiatomee> I meant a destructive assignment, something like `let [a, b] = elems` |
23:18:07 | FromDiscord | <tiatomee> which would bind `a` to `elems[0]` and `b` to `elems[1]` |
23:18:31 | FromDiscord | <mratsim> it works for tuples but not arrays |
23:18:49 | FromDiscord | <mratsim> for tuples you can to let (a, b) = elems |
23:19:27 | FromDiscord | <tiatomee> Ah, so for arrays that doesn't work, good to know |
23:20:33 | FromDiscord | <mratsim> @narimiran, what's the template for a blog post? I'd like to post this for review: https://gist.github.com/mratsim/61b2e25d098df0634143d501a77d8599 |
23:20:44 | FromDiscord | <mratsim> @Zevv @Araq ^ very relevant to CPS |
23:22:09 | FromDiscord | <mratsim> going to sleep now |
23:22:44 | FromDiscord | <mratsim> @Allin if you can review the section about optimizing for IO I'd appreciate it. |
23:23:02 | Allin | disruptek: Maybe there's a fundamental discrepancy between ergonomy and performance that NO programming language can solve... |
23:24:33 | FromDiscord | <mratsim> I like Kotlin suspend as a primitive and building async/await semantics on top. |
23:24:41 | FromDiscord | <mratsim> anyway, see you tomorrow |
23:25:03 | Allin | Going to sleep also, to gather some energy to read that... |
23:25:17 | FromDiscord | <mratsim> Ah one note. Regarding CPS, I think we will have coloring again |
23:25:28 | * | nyaayaya quit (Quit: Ping timeout (120 seconds)) |
23:25:40 | FromDiscord | <mratsim> in multithreading, the one multithreading approach that has "coloring" is Cilk which is cited in the continuation-passing C papers |
23:25:41 | * | nyaayaya joined #nim |
23:25:50 | Allin | I'll see colors in my dream |
23:26:00 | FromDiscord | <mratsim> and the reason it has coloring is because it does "continuation-stealing", as in any thread can resume any continuation |
23:26:24 | FromDiscord | <mratsim> if only the launching thread can resume a continuation, you don't have coloring problem (or i think so) |
23:27:07 | FromDiscord | <mratsim> good night |
23:27:12 | Allin | AS I see it, all I/O should be done in one dedicated thread... |
23:27:48 | FromDiscord | <mratsim> but we don't want 2 standard libraries, one with async and one without, though that can be solved with macros |
23:28:45 | Allin | Exactly! but disruptek had a solution, anyway bonne nuit |
23:28:50 | Allin | stop |
23:28:53 | Allin | exit |
23:29:50 | Allin | part |
23:29:52 | * | Allin left #nim (#nim) |
23:40:23 | * | Vladar quit (Quit: Leaving) |
23:40:36 | FromDiscord | <dom96> @ajusa AFAIK there is no way to do that asynchronously across all platforms. You need to use threads. The book does it in a pretty non-efficient way, but if we can just get the ability to await threads we can make it much simpler: https://github.com/nim-lang/RFCs/issues/304. |
23:40:37 | disbot | ➥ Completing the Nim async/await implementation |
23:44:26 | FromDiscord | <ajusa> Yes, I noticed that you mentioned that later in one of the discussions. I wasn't really clear by what I meant earlier, but the non-efficient solution that the book has (spawn a thread for each line) is clean, while the more performant solution (one thread listens for stdin) is complex and requires channels.↵Anyway, this is all above my head and I look forward to using something that works and is nice in the future. |
23:45:29 | FromDiscord | <ajusa> (edit) "Yes, I noticed that you mentioned that later in one of the discussions. I wasn't really clear by what I meant earlier, but the non-efficient solution that the book has (spawn a thread for each line) is clean, while the more performant solution (one thread listens for stdin) is ... complex" added "more" |
23:45:35 | FromDiscord | <dom96> I wouldn't consider the spawning of a thread per line to be a problem for that application (or for most), the more pressing problem is the polling. Ideally you want the OS to tell you when the thread is finished its work instead of checking every few ms. |
23:45:59 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IMn |
23:46:49 | FromDiscord | <shadow.> the resulting regex is invalid i think |
23:54:40 | * | krux02 quit (Remote host closed the connection) |
23:58:58 | FromDiscord | <dom96> Zevv: Reading the CPS/async discussions I'm seeing some excitement about better performance from you, but I wonder where you've run into performance problems? Nim already does very well in the HTTP Framework benchmarks https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=json. |
23:59:02 | FromDiscord | <polyjitter> question - is only the roman alphabet style-insensitive?↵↵i.e. `e_example` would be `eExample`, but `e_éxample` would not be `eÉxample` |
23:59:23 | FromDiscord | <dom96> @polyjitter yep, unicode not case insensitive |
23:59:44 | FromDiscord | <polyjitter> thats disappointing |