<< 19-12-2020 >>

00:00:12FromDiscord<tiatomee> Don't mind me. There was another error popping up somewhere else but it was unrelated
00:00:15FromDiscord<tiatomee> Thanks a lot @nikki
00:00:26FromDiscord<tiatomee> also you elegantbeef for trying 😬
00:02:01FromDiscord<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:20giacoInventorMatt thanks! -d:binaryparseEcho is quite difficult to read, but I will try
00:07:03FromDiscord<tiatomee> How can I give a `nil` literal a type?
00:08:48FromDiscord<nikki> nil.T maybe
00:09:00FromDiscord<nikki> depends if it's named or anonymous type tho
00:09:15FromDiscord<nikki> !eval echo (ptr int)(nil)
00:09:16NimBotCompile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <ptr int>
00:09:28mipri!eval var q = cast[ref int](nil); new(q); q[] = 2; echo q[]
00:09:31NimBot2
00:09:50FromDiscord<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:50FromDiscord<nikki> !eval (ptr int)(nil)
00:09:51NimBotCompile 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:13FromDiscord<nikki> cool i think that ^ works for this type at least but yeah also nil.T works if the name is T
00:11:20FromDiscord<tiatomee> Thank you very much!
00:11:39*krux02 quit (Remote host closed the connection)
00:25:33giacoInventorMatt failing hard to find out what's wrong with my proc return type that binaryparse doesn't like
00:28:35FromDiscord<InventorMatt> do you have some code you could show with it?
00:29:21giacoInventorMatt I've already posted it -> https://termbin.com/5yfw
00:30:20giacoInventorMatt and this is the line that is complaining about my return code: https://github.com/PMunch/binaryparse/blob/5f8f4a745ffded841975cd1166b328ee843ff81a/binaryparse.nim#L115
00:32:45giacoI'm now using tuple[foo: uint8] as proc return type instead, but same error
00:34:52FromDiscord<Rebel> Is there a PE parser in Nim?
00:35:22FromDiscord<ElegantBeef> Nah no physical education parser
00:37:16FromDiscord<Rebel> Portable Executable...
00:40:22FromDiscord<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:41FromDiscord<Rebel> might have to do IL weaving with costura and fody though
00:41:55*Fish-Face joined #nim
00:42:13FromDiscord<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:27FromDiscord<Cohjellah> Because websites like leetcode don't support Nim... Yet ;)
00:42:37Fish-Facedoes projecteuler count
00:43:31miprihttp://rosalind.info/problems/locations/
00:51:37*klaufir_ quit (Ping timeout: 260 seconds)
01:14:29*a_chou joined #nim
01:14:33giacomaybe 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:35giacorules
01:16:15giacoso 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:59giacoas it's length is dynamic, and math.sum(lengths_array) returns something strange
01:26:35Fish-Facefinally 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:12FromDiscord<ElegantBeef> day18?
01:27:22Fish-Faceno, 17
01:41:37Fish-FaceZevv: 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:10Fish-Facejust a shame that you can't re-use a parser, and you can't create two different parsers from the same lexer
01:45:14FromDiscord<shadow.> hmm
01:45:26FromDiscord<shadow.> i feel like
01:45:30FromDiscord<shadow.> day 17 was actually one of the easiest days lmao
01:45:31FromDiscord<shadow.> idk why
01:45:37FromDiscord<shadow.> prolly just my skillset i suppose
01:45:56*a_chou quit (Remote host closed the connection)
01:46:10FromDiscord<shadow.> also mine was slow asf but
01:46:10FromDiscord<ElegantBeef> day 18 i just phoned it in
01:46:13Fish-FaceI 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:15FromDiscord<shadow.> how'd you do day 18?
01:46:19FromDiscord<shadow.> lmao yeah
01:46:20FromDiscord<ElegantBeef> Using nimscripter
01:46:23FromDiscord<shadow.> i used a hash set of (int, int)
01:46:25FromDiscord<shadow.> LMAO
01:46:26FromDiscord<shadow.> same pretty much
01:46:37Fish-Facenot (int, int, int[, int])?
01:46:39FromDiscord<ElegantBeef> https://forum.nim-lang.org/t/7162#45998
01:46:45FromDiscord<shadow.> wait
01:46:46FromDiscord<shadow.> for which part
01:46:52FromDiscord<shadow.> for part two (int, int, int, int)
01:46:54Fish-FaceI wanted to learn how to write a parser, so I did that for today
01:46:57FromDiscord<shadow.> for part one (int, int, int)
01:46:59Fish-Faceyes
01:47:02Fish-Faceok cool
01:47:03FromDiscord<shadow.> fairly short
01:47:04FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2ICS
01:47:17FromDiscord<ElegantBeef> Hey we did it similarly
01:47:22FromDiscord<shadow.> haha ye
01:47:26Fish-Faceso I initially used a pairing function so that I could use a seq for 17.1
01:47:28FromDiscord<shadow.> a lot of ppl w metaprogramming abilities did
01:47:32FromDiscord<shadow.> like py, ruby, nim
01:47:32miprinpeg's precedence support works great for day 18.
01:47:36FromDiscord<ElegantBeef> I just used nimscripter to evaluate it
01:47:39FromDiscord<shadow.> lmaooo
01:47:40FromDiscord<shadow.> same
01:47:42FromDiscord<shadow.> parseExpr()
01:47:45FromDiscord<shadow.> and custom ops to remove precedence
01:47:47FromDiscord<ElegantBeef> No you didnt use nimscripter
01:47:49Fish-Facebut you run out of memory in part 2 unless you do something different
01:47:50FromDiscord<shadow.> ok but
01:47:51FromDiscord<shadow.> evaluate
01:47:52FromDiscord<shadow.> lmao
01:47:53FromDiscord<ElegantBeef> you used nimscript 😄
01:47:59FromDiscord<shadow.> i didnt mean nimscripter
01:48:02FromDiscord<shadow.> i just meant evaluating it
01:48:06Fish-Facemipri: do you have an npeg solution to hand?
01:48:22FromDiscord<ElegantBeef> Well mine is purely runtime, so it works on any data
01:48:27miprithere's one in the reddit thread that uses it
01:48:31FromDiscord<shadow.> oh nice nice
01:48:51FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2ICU
01:49:17Fish-Facemipri: I searched all the comments for "npeg" but didn't find it...
01:49:18FromDiscord<shadow.> it looks like a lightning bolt
01:49:32FromDiscord<shadow.> im considering learning dyalog apl so i can get fake internet points on the aoc megathreads
01:49:40Fish-Faceah, that's you shadow
01:49:46Fish-FaceI did find that solution :P
01:50:04FromDiscord<shadow.> you found it?
01:50:05FromDiscord<shadow.> on reddit?
01:50:12Fish-Faceyes while searching for nim solutions
01:50:16FromDiscord<shadow.> ohh nice nice
01:50:20FromDiscord<shadow.> i've only posted there like twice lmao
01:50:24FromDiscord<shadow.> all mine are on github tho
01:50:29Fish-Faceyeah
01:50:30FromDiscord<shadow.> !repo shadowninja55/aoc-2020
01:50:30disbothttps://github.com/shadowninja55/aoc-2020 -- 9aoc-2020: 11my attempt at advent of code 2020 in nim. 15 1⭐ 0🍴
01:50:32mipriFish-Face: there are more than 500 comments now, and it's hidden by default even if you expand to show 500.
01:50:33FromDiscord<shadow.> e
01:50:40miprihttps://old.reddit.com/r/adventofcode/comments/kfeldk/2020_day_18_solutions/gg8596t/
01:50:58FromDiscord<shadow.> jesus christ
01:50:59FromDiscord<shadow.> no way-
01:51:15FromDiscord<shadow.> wait
01:51:16FromDiscord<shadow.> nvm
01:51:18FromDiscord<shadow.> i didnt scroll all the way
01:51:19FromDiscord<shadow.> LMAO
01:51:29FromDiscord<shadow.> i went like halfway and it looked like it was over
01:51:43Fish-Facemipri: thanks, yeah I don't even know the logic behind reddit comment hiding.
01:51:49FromDiscord<shadow.> props on using old reddit
01:54:38Fish-Facemipri: hmm. I see kind of how it works... it seems to have some code to handle backtracking in the capture blocks
01:54:56Fish-Faceoh no, I misread
01:55:33Fish-Facein that case... is it just written to never backtrack over the rules which have capture blocks?
01:56:55*regreg_ joined #nim
01:57:40mipriright, that never happens.
01:58:15Fish-Facethis 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:42miprirun through some examples with -d:npegTrace
01:59:20Fish-Faceyeah - I did that when I was trying to write an npeg parser but it *was* backtracking over the relevant rules
01:59:27Fish-Facethen I gave up and used another library
02:07:43FromDiscord<bark> I... overcomplicated day 18 part 2 https://play.nim-lang.org/#ix=2Iz6
02:08:02FromDiscord<bark> (edit) "I... overcomplicated day 18 part 2 https://play.nim-lang.org/#ix=2Iz6 ... " added "(25 minute)"
02:08:06FromDiscord<bark> (edit) "minute)" => "minute solution)"
02:08:22Fish-FaceI took hours playing with parsing libraries :)
02:08:44FromDiscord<bark> yeah, it took me hours to figure out npeg on day 14
02:08:59FromDiscord<bark> reading documentation is slow
02:09:22Fish-Facemmm
02:09:35Fish-Facebut learning a language (which is what I am doing) means learning some of its libraries
02:09:45Fish-FaceI don't time my solutions
02:10:02Fish-Facecould bash out quick ugly solutions in python all day long :P
02:10:39FromDiscord<bark> yeah, I could also check new libs out out there
02:10:49FromDiscord<bark> or just new parts of the stdlib
02:11:10FromDiscord<bark> reading other people's aoc's has been helpful as well
02:11:19Fish-Faceyeah
02:11:32Fish-FaceI figure I might learn rust one day so I've been reading rust solutions too
02:11:56*blueberrypie quit (Quit: leaving)
02:13:39FromDiscord<shadow.> nice
02:13:45FromDiscord<shadow.> idk rust is kinda verbose for me lol
02:13:57Fish-Facemyeah
02:14:01Fish-Facemy friend is doing AoC in rust
02:14:14Fish-Faceit's interesting though
02:14:45Fish-Facesome things in nim are slow because of copy-by-default - with ownership checking you can avoid that more easily
02:16:39mipriit comes up. --gc:arc --expandArc:(module|proc) work well for sussing out unexpected copying.
02:18:10FromDiscord<nikki> sent a code paste, see https://play.nim-lang.org/#ix=2ID8
02:18:11Fish-FaceYes I ended up using that
02:18:42FromDiscord<nikki> strings are definitely copy-trigger-happy tho
02:18:47Fish-FaceMmm
02:19:14Fish-FaceAfter some experience I started defining more ref types
02:20:51FromDiscord<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:26miprieh, 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:26FromDiscord<nikki> but otherwise for non-`var` value type params nim will use pointers under the hood anyways if they are large
02:22:43FromDiscord<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:53Fish-FaceMmm, I was definitely being overly paranoid at some point
02:27:16Fish-FaceAoC 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:04FromDiscord<shadow.> tbh if your aoc solution takes a long time then you're doing it wrong anyways lmao
02:28:07Fish-FaceWhat 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:21Fish-Face"a long time" is subjective ;)
02:28:30*d10n-work joined #nim
02:28:33FromDiscord<shadow.> haha
02:28:37Fish-FaceAoC is an opportunity to try to optimise
02:28:37*BitPuffin joined #nim
02:28:38FromDiscord<shadow.> my longest one was 2s and that was the memory one
02:28:41FromDiscord<Quibono> 10ms
02:28:43FromDiscord<shadow.> everything else is under 250ms
02:28:44Fish-FaceIf you want
02:28:45FromDiscord<shadow.> lmao
02:28:45FromDiscord<Quibono> You have 10ms
02:28:48FromDiscord<shadow.> usually under 50ms
02:28:50FromDiscord<shadow.> id guess
02:28:53FromDiscord<shadow.> i meannn
02:28:57FromDiscord<Quibono> SLOW
02:29:01FromDiscord<shadow.> aoc is typically made for writing fast code and problem solving quickly
02:29:06FromDiscord<shadow.> id say leetcode is more for efficiency
02:29:10FromDiscord<shadow.> and optimization
02:29:14FromDiscord<shadow.> if only leetcode had nim
02:29:21FromDiscord<Quibono> In my day we did AOC in fortran and we had to finish in 1ms
02:29:37FromDiscord<shadow.> "in my day" boi you were just barely born last century don
02:29:40FromDiscord<shadow.> don't even
02:29:49Fish-FaceMaybe yes. Well, this year as I said, everything is "use a hash map" sand you're good
02:29:53FromDiscord<shadow.> yup
02:29:56FromDiscord<shadow.> use a hashmap or a set
02:30:04Fish-FaceSame difference ;)
02:30:08FromDiscord<shadow.> even day 1 lol
02:30:12FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IDd
02:30:15FromDiscord<shadow.> gotta use a set smh
02:30:58miprihttps://adventofcode.com/2017/day/1 <- the "everything has to be done in 1ms" year was 2017
02:31:57Fish-FaceHehe
02:32:47FromDiscord<shadow.> hm
02:32:54FromDiscord<shadow.> i rly wanna solve that in dyalog apl lmao
02:33:45FromDiscord<shadow.> its so intruguing to me
02:34:20miprithe 2017 one? yeah that's a very short APL program
02:34:33FromDiscord<shadow.> lol yes
02:35:12*regreg_ quit (Read error: Connection reset by peer)
02:36:04FromDiscord<shadow.> idk anywhere good to learn apl tho
02:36:34FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IDg
02:42:30FromDiscord<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:14giacoInventorMatt. Thanks a lot for the feedback
02:44:06FromDiscord<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:58FromDiscord<Quibono> Somethings just can't be helped, like the lack of macos arm support. :p
02:59:21FromGitter<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:12FromGitter<deech> I'm assuming `orc/arc` memory management.
03:08:06ForumUpdaterBotNew thread by Rockcavera: Domain Name System (DNS) protocol and client for Nim, see https://forum.nim-lang.org/t/7270
03:08:40FromDiscord<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:17FromDiscord<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:47FromDiscord<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:53FromDiscord<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:53giacoI 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:41disrupteknim doesn't have classes.
05:05:14giacooh, yeah, sorry for that ^^" still have to rewire the brain
05:05:29disruptekwell, i'm not really sure what you're asking for.
05:06:40disruptekyou'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:52disrupteksealmove is the expert on this stuff.
05:07:07giacodisruptek: 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:41disruptekhis 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:56disruptekstrange taste in cinema, though.
05:08:44giacoI'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:46giaco:D k thanks for the name
05:14:40disruptektreeform: license for jsony? i need a parser and want to compare it to eminim...
05:18:15FromDiscord<ElegantBeef> The nimble says MIT, so hopefully that
05:18:38disruptekgood catch, thank you.
05:19:55giacoapparently binaryparse can't handle variable strings. It refuses to template "s1: myfield[string_length]"
05:22:31FromGitter<bung87> `echo p.match("q=0.9")` `(ok: false, matchLen: 5, matchMax: 5, cs: (capList: ...))` why all matched still ok is false?
05:22:55FromGitter<bung87> use npeg
05:23:02disruptekgiaco: i've done variable fields with nesm.
05:23:10disruptek!package nesm
05:23:11disbotdisruptek hung like rhinocerous🦏
05:23:15disruptekhmm.
05:23:23disruptek!repo swayipc
05:23:24disbothttps://github.com/disruptek/swayipc -- 9swayipc: 11swayipc (i3ipc) for Nim 15 5⭐ 0🍴
05:23:29disruptekexample usage within.
05:24:35giacothanks! But now I am confused: how many tools do I have to accomplish same job?
05:24:52disruptekwell, i haven't used binaryparser. there's probably a way to do what you want.
05:24:59disruptekbut i have done what you want using nesm.
05:25:38disruptekemphasis: /there's probably a way to do what you want in binaryparser./
05:29:36*mfiano joined #nim
05:30:13giacore-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:41giacono, it seems not possible. I have to read the char as uint8 and then somehow convert it back. sad
05:45:27FromDiscord<treeform> @disruptek jsony license should be MIT, let me add that.
05:45:48disruptekgiaco: real out to sealmove.
05:45:51disruptekreach, too.
05:45:56disruptektreeform: aight, thanks.
05:46:16disruptektreeform: is it pretty solid? well tested or something?
05:48:26FromDiscord<treeform> I have not used it in production yet.
05:49:06FromDiscord<treeform> I am using it everyday for this project I am doing.
05:49:32FromDiscord<treeform> It has a test suite
05:51:05disruptekokay, cool. thank you. i will see how it runs. 😈
05:51:22FromDiscord<treeform> current bench mark:
05:51:28FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=2IE8
05:52:06FromDiscord<treeform> No support for case objects...
05:53:45miprigot 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:28disruptektreeform: do you use ggplotnim? like it?
05:57:43FromDiscord<treeform> I do not
05:57:54FromDiscord<treeform> I added LICENSE file for https://github.com/treeform/jsony
05:58:00disruptekdanke.
05:58:52*mfiano joined #nim
05:58:53FromDiscord<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:47disruptekright, i think you demo'd that a bit, maybe.
06:00:14disrupteki'm just thinking about something simple for time/space graphs on my repos and whatnot.
06:00:33disrupteki don't really want to look at all these benchmarks in text, y'know?
06:00:53FromDiscord<treeform> text is easy though
06:01:10*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
06:01:11FromDiscord<treeform> I just want to see "thing" --- number. I am simple.
06:01:17*njoseph joined #nim
06:01:41disruptekyeah, but you know how it is... once i write this thing once, boom, i'll have it everywhere.
06:03:34FromDiscord<treeform> you make a good point
06:04:19FromDiscord<treeform> Some thing like this can be really cool for multiple tests:
06:04:20FromDiscord<treeform> https://media.discordapp.net/attachments/371759389889003532/789734843490762752/68747470733a2f2f697269732d676f2e636f6d2f696d616765732f62656e63686d61726b732e737667.png
06:04:30disrupteksome of us don't have nifty reddit graphs. 😁
06:04:58*mfiano quit (Ping timeout: 256 seconds)
06:06:02disruptekcute.
06:06:26FromDiscord<treeform> Actually going vertically might be better, as you can go on for a long time.
06:06:31FromDiscord<treeform> https://media.discordapp.net/attachments/371759389889003532/789735392123027476/iphone-xs-benchmarks-geekbench4-fixed-100774085-large.png
06:06:49FromDiscord<treeform> Maybe I should add this to benchy
06:07:42FromDiscord<ElegantBeef> As a rendered image or just tui?
06:07:49disruptekyeah, 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:55FromDiscord<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:09FromDiscord<sealmove> @giaco hey
07:37:18giacohello
07:38:05FromDiscord<sealmove> Yesterday i launched a fork of binaryparse
07:38:50FromDiscord<sealmove> Strings are refurbished
07:39:03FromDiscord<sealmove> https://github.com/sealmove/binarylang
07:39:08giacosealmove, would you help me fixing my little experiment with binaryparse?
07:40:04giacooh! cool
07:40:25*mfiano quit (Ping timeout: 240 seconds)
07:40:25FromDiscord<sealmove> Yes sure.
07:43:17giacoI'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:01FromDiscord<sealmove> `s1` is wrong. It means "string were each character is 1 bit".
07:46:05FromDiscord<sealmove> use `s` or `s8`
07:46:17giacosealmove, no, docs says that it would mean 1 character, not 1 bit
07:46:48giacoI need to read a string long X characters where X comes from a previous field
07:47:44Zevvmipri: haha, too bad :) Every left recursive grammar can be expressed as a peg, so Ive been told
07:47:57giacoI'm using "u8: wrongstring[length_of_string]" as a workaround now
07:48:38FromDiscord<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:39FromDiscord<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:09giacos: myField[myPrevField] looks null terminated strings, that's not my case
07:53:33FromDiscord<sealmove> do your strings contain null bytes in-between?
07:55:45giacono, 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:59FromDiscord<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:47giacoI 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:10giacoogg 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:25giacoI tried something like "u8: segments[sum(segment_table)]" but was just a wild guess
08:03:11*mfiano joined #nim
08:05:16giacocurrently I'm handling it outside the library by running manually other parsers instead of chaining them inside the createParser definition
08:07:28FromDiscord<sealmove> hum, so you just need the length of the segment table?
08:07:57FromDiscord<sealmove> or total bytes read for segment table?
08:09:08giacothe total bytes. segment_table contains the lenghts of the N next fields
08:10:15giacoI 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:40FromDiscord<sealmove> i see, yes, the way you did it above works (at least in binarylang :P)
08:11:05FromDiscord<sealmove> you can use any valid nim expression for the size
08:11:16FromDiscord<sealmove> so `sum(segment_table)` should work
08:12:15FromDiscord<sealmove> also you know you can integrate custom parsers into binaryparse/lang right?
08:12:50FromDiscord<sealmove> (although absolutely not necessary the case you described)
08:13:00FromDiscord<sealmove> for the
08:15:44giacoThis -> "u8: segments[sum(segment_table)]" doesn't work in binaryparse
08:16:32giacoit compiles and runs, but returns incorrect results
08:17:43giacowell, apart from my questions. I'd like to thank you for the great work!
08:19:36FromDiscord<sealmove> thanks 😄
08:20:54FromDiscord<sealmove> giaco i am expecting feedback for binarylang 😛 let me know if those things worked or didn't.
08:21:59giacosure! but first I seriously need some sleep. Been forcing myself in learning nim in a weekend, let's see
08:23:01FromDiscord<sealmove> you won't regret nim 😉 gn
08:30:04giacoanother 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:05FromDiscord<sealmove> just for clarity, the original project (binaryparse) was not written by me, I made binarylang which is a rewrite 😛
08:33:24FromDiscord<sealmove> um, for magic numbers there is a special feature, so obviously you should use that
08:34:08FromDiscord<sealmove> i don't think you can do it with try/catch
08:34:38FromDiscord<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:06FromDiscord<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:04FromDiscord<mratsim> @Ricky Spanish t.squeeze(0) since the column 0 dim is 1
09:03:14FromDiscord<mratsim> ot t.squeeze() to remove all 1 dimension
09:03:28FromDiscord<Ricky Spanish> ah awesome thanks again @mratsim
09:04:09FromDiscord<mratsim> otherwise the usual way is t[0, _]
09:04:37FromDiscord<Ricky Spanish> yeh i was trying to slice that way but wasnt really able to get what i wanted
09:05:11FromDiscord<mratsim> likely because you want autoreduction of 1-dim like in Numpy
09:05:20FromDiscord<Ricky Spanish> yeh exactly
09:05:33FromDiscord<mratsim> I don't do it because from stackoverflow people often had to search for a way to get out of it
09:05:47FromDiscord<mratsim> when composing algorithm
09:06:18FromDiscord<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:43FromDiscord<mratsim> I have a "at" template that does slicing + squeeze
09:09:51FromDiscord<mratsim> t.at(0, _)
09:09:55*mfiano joined #nim
09:10:12FromDiscord<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:17FromDiscord<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:45Zevvhttps://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:34FromDiscord<mratsim> It's in the Nim forum
10:50:52FromDiscord<mratsim> The authors of Koka and Lean language are really working on very interesting stuff
10:51:09FromDiscord<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:05FromDiscord<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:28FromDiscord<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:17FromDiscord<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:58ZevvI don't care for any of those. I just want my Lua-style coroutines, that is all
11:39:03Zevvand a pony
11:40:59ZevvAnd 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:06FromDiscord<mratsim> Do they have a special somehing?
11:42:40FromDiscord<mratsim> seems very similar to greenlet https://github.com/treeform/greenlet
11:42:52Zevvnope. 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:18ZevvThe best part is the no-color.
11:43:39Zevvso A can resume B. B can call C taking a callback to D, then D can yield, and it all Just Works
11:44:00FromDiscord<mratsim> Why aren't they similar?
11:44:17FromDiscord<mratsim> I don't see the equivalent of "switchTo" in the CPS codebase though
11:44:39Zevvthat's not the task of CPS. It's just how you trampoline your continuation.
11:44:41FromDiscord<mratsim> LUA coroutines and greenlet seems to be scheduled manually while CPS has a "scheduler" called trampoline
11:44:42Zevvc.fn()
11:44:48Zevvno no no
11:44:51ZevvCPS has no scheduler
11:44:57Zevvor no trampoline
11:45:08Zevvthat's /outside/ CPS. CPS just makes the continuations.
11:45:15ZevvHow you trampoline them is your choice
11:45:15FromDiscord<mratsim> I thought your nope was about greenlet, misunderstanding
11:45:15*mfiano joined #nim
11:45:23Zevvah no sorry
11:45:24FromDiscord<mratsim> ah I see
11:45:48Zevvso resum() aka switchTo() is just a `while c: c = c.fn()`
11:46:01Zevvnothing more, nothing less
11:46:18FromDiscord<mratsim> I need manual control to implement formal verification of concurrent data structures
11:46:28Zevvthe 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:06ZevvThat 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:12Zevvwe will build that on top of CPS.
11:47:13FromDiscord<mratsim> yes agree
11:47:16FromDiscord<mratsim> https://github.com/mratsim/weave/pull/127/files
11:47:17disbot[WIP] Thread Collider: Race detection / Formal Verification of Nim concurrent programs ; snippet at 12https://play.nim-lang.org/#ix=2IwE
11:47:37Zevvbecause 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:38FromDiscord<mratsim> My formal verification of threading requires coroutines or equivalent without a scheduler
11:47:46Zevvright. that's good.
11:48:10Zevvso our 'spawn' is bascially a "create initial environment and call the first continuation stage"
11:49:11FromDiscord<mratsim> I need my own scheduler which is a thin wrapper around coroutines/fibers https://github.com/mratsim/weave/pull/127/files
11:49:13disbot[WIP] Thread Collider: Race detection / Formal Verification of Nim concurrent programs ; snippet at 12https://play.nim-lang.org/#ix=2IwE
11:49:45ZevvI 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:05ZevvAlso 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:39Zevvotoh, 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:52FromDiscord<mratsim> Well I'm also swamped with projects but I'll try to productionize something
11:52:27Zevvmost of what we did is straight out of the Gabriel Kerneis paper (1011.4558.pdf)
11:53:10ZevvI /almost/ got myself to start again from scratch the other day to make use of what we learned
12:06:57haxscramperCan 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:59haxscramperAfter 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:16FromDiscord<hugogranstrom> Today's AoC is crazy hard 😕
12:09:19haxscramperAlso '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:26haxscramperThough 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:46haxscramperBut 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:12FromDiscord<Cohjellah> No problem :) is there plans for an updated version in a couple years or perhaps a new book?
12:15:43FromDiscord<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:30FromDiscord<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:53FromDiscord<mratsim> it's interesting because it gives you the 5 (iirc) low-level primitives to make continuation passing C
12:19:31FromDiscord<mratsim> I have a better picture on how we can structure CPS.
12:20:38FromDiscord<mratsim> level 0 would be nim functions,↵level 1 would be suspend and switch↵level 2 would be schedulers (async/await, weave).
12:20:53FromDiscord<mratsim> so level 1 would be like Lua coroutines and greenlets
12:21:05FromDiscord<mratsim> and i think we should make level 1 usable on embedded.
12:21:22FromDiscord<dom96> what does "usable on embedded" mean though?
12:21:40FromDiscord<mratsim> level 2 would either tie in into the OS for IO tasks or Weave for compute tasks.
12:22:05FromDiscord<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:32ForumUpdaterBotNew question by Michal Marš&amp;#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:04FromDiscord<Ricky Spanish> is there a way to initialize a tensor in arraymancer to all zero's? aka np.zero's equivelant?
12:34:02FromDiscord<Vindaar> @Ricky Spanish there's `zeros`: https://mratsim.github.io/Arraymancer/init_cpu.html#zeros%2Cvarargs%5Bint%5D
12:34:23FromDiscord<Vindaar> but the default construction of a tensor zeros all elements anyways
12:34:44FromDiscord<Vindaar> only if you use `newTensorUninit` you get one that isn't initialized to zero
12:36:10FromDiscord<Ricky Spanish> ah ok i see thanks for the info
12:37:49*mfiano quit (Ping timeout: 256 seconds)
12:37:53Zevvdom96: yes it has the same ideas, it will do as a summary
12:38:09Zevvbut for actual implementation the 1101 has more details
12:38:48Zevvmratsim: i like your levels, it allows for a clear separation
12:39:38Zevvso 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:48Zevvit will not be able to splitup for loops though
12:41:54Zevvso the original intent was to make the work all the way in macros, as far as we can push it
12:42:00Zevvlearn, implement level 1 and 2
12:42:10Zevvand then one day maybe move level 0 into the compiler
12:42:25Zevvso we can make this work deep and everywhere
12:43:38FromDiscord<mratsim> splittable for loops are at the scheduler level anyway
12:44:02FromDiscord<mratsim> And it's only useful for Compute tasks
12:44:42FromDiscord<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:21FromDiscord<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:05Zevvwell its not only for compute task
12:50:17Zevvi might to do something IOish for all things in a list
12:50:30Zevvso i want to iterate them with a for because they live in a seq
12:50:59Zevvor i might want to read x things with an async recv
12:51:04Zevvand do that in a for loop
12:51:13Zevvso it is very much a use case
12:54:07Zevvit the optimal case, it'll "just work" for normal and closure iterators
12:54:35*mfiano joined #nim
12:55:39FromDiscord<mratsim> but beyond `for foo in list: cpsLaunch myFn(foo)` is there any optimization that you ought to do?
12:56:52Zevvnot about optimization i think. its about cps being able to do whatever is required to split the control flow into continuables
12:57:16Zevvif you do something "yieldable" in a for loop, we should be able to split that op and continue from there
12:57:36Zevvfor i in 0..parts: l.add magicRecv()
12:58:19Zevvthats tricky because the interaction with the nim iterator state, because that should be lifted into the env
12:58:32Zevvbut its not "available" from the macro, afaik
12:58:48Zevvits not explicit, so we can not find it, lift it off the stack onto the env
12:59:06FromDiscord<mratsim> I solved that problem in Weave
12:59:16Zevvand 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:30Zevvah look, i will have to check that out
12:59:42Zevvis it "nice" or is it a hack?
12:59:52FromDiscord<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:11Zevvyah for explicit `..`, that is?
13:00:13FromDiscord<mratsim> it's packaged with the function and the environment
13:00:19Zevvbut what about for a in items?
13:00:31Zevvwhere does the items state live?
13:00:43Zevvidealle we would rewrite for to while
13:00:48FromDiscord<mratsim> not a use case for compute tasks
13:00:49Zevvso we make everything explicit
13:00:52FromDiscord<mratsim> well most
13:00:55Zevvbut it is for io tasks
13:01:17Zevvmy point is, the gen 1 cps will have this problem until it is moved ito the compiler
13:01:21FromDiscord<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:37Zevvbut you cant do thayt for non-closure iterators
13:01:43Zevvcan you?
13:01:58FromDiscord<mratsim> inline iterators cannot be composed anyway
13:02:04Zevvright
13:02:05FromDiscord<mratsim> you can rewrite them using CPS
13:02:07Zevvthats my point
13:02:16Zevvyes but not from a macro
13:02:27FromDiscord<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:33FromDiscord<mratsim> for some you can just take the length + address of the container
13:02:33Zevvthe macro does not have access to the iterator implementation
13:02:51Zevvsure for some
13:02:54Zevvbut not for all
13:02:56Zevvjust sayin
13:03:20Zevvso itll be a know limitation. we can go a long way, but not all
13:03:23FromDiscord<mratsim> @juliuskiesian, that's called constant folding and loop hoisting
13:04:25FromDiscord<mratsim> also something of the form array[ax + b] can compile down to a single instruction using something called SIB addressing mode.
13:05:05FromDiscord<mratsim> https://github.com/mratsim/photon-jit/blob/master/photon_jit/x86_64/x86_64_base.nim#L191-L200
13:05:34FromDiscord<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:54Zevvif nim does not, the c compiler is likely to i believe
13:06:59Zevvbut trust mratsim on this
13:08:00Zevv~
13:08:01disbotno footnotes for ``. 🙁
13:08:44FromDiscord<mratsim> The Nim compiler only propagates compile-time constants, not scope constants.
13:09:30FromDiscord<mratsim> The code can be easily checked on godbolt.
13:09:33*mfiano quit (Ping timeout: 256 seconds)
13:10:53FromDiscord<Clyybber> Zevv: You could perhaps workaround it by looking at the post transf ast
13:10:57FromDiscord<shadow.> hm
13:11:02FromDiscord<shadow.> boost
13:11:04FromDiscord<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:04FromDiscord<shadow.> yay
13:11:10FromDiscord<Clyybber> @shadow. nice
13:11:22FromDiscord<shadow.> lol one more boost is needed for level 1
13:11:22*waleee-cl joined #nim
13:11:25FromDiscord<Clyybber> Zevv: macros.getImplTransformed
13:11:33haxscramperWhat 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:25haxscramperAnd 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:29miprihttps://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:58FromDiscord<shadow.> oh shit godbolt has nim?
13:14:01FromDiscord<shadow.> i never knew that
13:14:10FromDiscord<shadow.> i use to generate asm for cpp on there lol
13:15:04Zevvclyybber: how would that work? Looking at the post transf is not possible from a regular macro, is it?
13:15:14Zevvoh wait getImplTransformed, wow
13:15:52FromDiscord<shadow.> haven't taken a look at today's aoc but ive heard it's on parsing
13:15:58FromDiscord<shadow.> is it npeggable?
13:16:37mipriit'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:43FromDiscord<shadow.> oh ok
13:17:46federico3When compiling with --gc:arc --os:standalone I get "Error: system module needs: nimErrorFlag"
13:18:08FromDiscord<shadow.> yesterday's was fun lol
13:18:15FromDiscord<shadow.> bc i cheesed it ofc
13:18:26*fputs joined #nim
13:18:39FromDiscord<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:27FromDiscord<mratsim> CPS continuations are also on the heap, at least in the current PoC
13:20:43FromDiscord<mratsim> @mipri right, seems like a busy proc in assembly here
13:20:55Zevvdom96: yes, it's very much related
13:21:16Zevviterators are a subset of CPS
13:21:35Zevvif CPS would live at the compiler level, iterators could be implemented as a library
13:22:22Zevvit allows you express any kind of non-linear control flow in the language itself
13:22:46Zevvso things like setjmp/longjump, exceptions, goto, defer. These are all expressable in the language itself using CPS
13:22:53Zevvwhich I find pretty cool, IMHO
13:22:56FromDiscord<shadow.> how are people identified on irc by the bridge bot?
13:23:15FromDiscord<shadow.> since yk you guys always have the same profile pictures which im assuming is by identification
13:23:38haxscramperrobohash on nickname
13:24:14FromDiscord<shadow.> hmm
13:24:25FromDiscord<shadow.> is the bridge bot open source?
13:25:02haxscramper!repo ircord
13:25:02disbothttps://github.com/Yardanico/ircord -- 9ircord: 11Discord <-> IRC bridge in Nim 15 12⭐ 2🍴
13:25:03FromDiscord<mratsim> Sorry I can't release the source code of Skynet
13:25:10FromDiscord<shadow.> lol
13:25:13haxscramperI think it is this one
13:25:24FromDiscord<Rika> It is
13:25:29*mfiano joined #nim
13:25:50FromDiscord<shadow.> hmm
13:26:09FromDiscord<shadow.> im guessing it's using one webhook and just using avatar / name overloads in the json post?
13:27:11Zevvshodow.: In theory it's npeggable, if you create your peg compile time from your input
13:27:16FromDiscord<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:20FromDiscord<shadow.> ah i see
13:27:22FromDiscord<shadow.> thanks
13:27:31Zevvbut it's not worth it
13:27:33FromDiscord<Rika> I doubt they care
13:29:43mipria "circle slash discord" image would be amusing.
13:29:56*mfiano quit (Ping timeout: 240 seconds)
13:30:00miprimainly I want the bot to stop dropping normal ASCII characters.
13:30:35FromDiscord<shadow.> hmm
13:31:15FromDiscord<shadow.> im confused why like
13:31:19FromDiscord<shadow.> asterisks are dropped
13:31:33FromDiscord<shadow.> because in dapi it certainly doesn't drop the asterisks
13:31:37mipriprobably they have meaning for Discord, and need to be esacped
13:31:53FromDiscord<shadow.> well it's discord -> irc not other way
13:31:59FromDiscord<shadow.> does this work
13:32:03FromDiscord<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:11miprino, but it also drops them going irc -> discord
13:32:20FromDiscord<shadow.> ohh hm
13:32:29FromDiscord<shadow.> yeah in discord they mean italics
13:32:33FromDiscord<shadow.> you needa escape
13:32:44FromDiscord<shadow.> but yours dont even show as italics so
13:32:57FromDiscord<shadow.> ima take a look at the repo and maybe try and fix it
13:33:05FromDiscord<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:13miprihttps://irclogs.nim-lang.org/10-12-2020.html#19:11:30
13:33:17haxscramper`code`, *italic*, **bold**, __a__
13:33:53mipri!eval var s = "ab\0\0\0"; echo @($cast[cstring](s[0].addr)) # from paste in the log
13:33:56NimBot@['a', 'b']
13:34:01mipricast[cstring](that)
13:34:09mipriwhat's that look like?
13:34:14FromDiscord<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:16disbot[RFC] Async I/O with structural control flow (a.k.a. Enforced Awaits) ; snippet at 12https://play.nim-lang.org/#ix=2j7c
13:34:31haxscrampermipri: `cast[cstrin]` is completely destroyed
13:34:31FromDiscord<Quibono> How would I know when macos arm is supported, like where should I be checking?
13:34:43FromDiscord<mratsim> If you allow returning a future that you spawned, you have to heap allocated.
13:35:02FromDiscord<mratsim> if not you can stack allocate
13:35:10FromDiscord<mratsim> with the current async/await as well btw
13:35:31FromDiscord<mratsim> it's just "if something escapes it's caller scope you can't stack allocate it"
13:35:43mipriQuibono: github, just search for arm and this comes up: https://github.com/nim-lang/Nim/issues/16211
13:35:44disbotSupport for Apple Silicon / M1 ; snippet at 12https://play.nim-lang.org/#ix=2IBQ
13:35:59FromDiscord<mratsim> so either you need restrictions which zahary proposes, or you use borrow checking for optimization.
13:36:20FromDiscord<Quibono> So the issue will get closed when it's resolved?
13:36:36FromDiscord<mratsim> @dom96 can you look into disabling embeds for github links and nim-lang.org links?
13:36:42FromDiscord<mratsim> so annoying
13:36:50FromDiscord<dom96> Okay, I'm just trying to understand CPS in isolation for now, regardless of how it would be applied to async
13:36:55FromDiscord<shadow.> iiuc there's a workaround currently @Quibono
13:37:21FromDiscord<dom96> @mratsim yeah, it's very annoying, let me see
13:37:21FromDiscord<Quibono> Which one @shadow., I tried modifying the one file and it crashed
13:37:46FromDiscord<shadow.> hm
13:38:00FromDiscord<shadow.> he did some more lower, but it seems this isnt a good solution
13:38:05FromDiscord<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:05FromDiscord<dom96> looks like this is per-user https://support.discord.com/hc/en-us/articles/206342858--How-do-I-disable-auto-embed-
13:40:23FromDiscord<dom96> Test: <https://github.com/nim-lang/Nim/issues/16211>
13:40:24disbotSupport for Apple Silicon / M1 ; snippet at 12https://play.nim-lang.org/#ix=2IBQ
13:40:29FromDiscord<dom96> https://github.com/nim-lang/Nim/issues/16211
13:40:30disbotSupport for Apple Silicon / M1 ; snippet at 12https://play.nim-lang.org/#ix=2IBQ
13:40:38FromDiscord<dom96> yeah, so you can wrap in `<>`
13:40:52FromDiscord<dom96> but then it's up to every user to do that :/
13:42:01FromDiscord<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:10ZevvCPS 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:51Zevvwhen 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:18FromDiscord<dom96> looking at the paper the environment seems to be passed via the function arguments
13:44:23FromDiscord<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:28FromDiscord<Quibono> So I need to retry modifying build.sh
13:44:56*mfiano quit (Ping timeout: 272 seconds)
13:45:32FromDiscord<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:06FromDiscord<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:21FromDiscord<mratsim> This is orthogonal to CPS vs async vs Weave.
13:46:36FromDiscord<Quibono> @dom96 Which is what I needed another computer for. Gotcha. So just keep checking github
13:46:44Zevvdom96: right. When CPSing a function we construct an object type T which has one member `which his proc(env: T)`
13:46:57Zevvno, `proc(env: var T)`
13:47:23ZevvWe 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:29FromDiscord<Clyybber> test #6666
13:48:31disbothttps://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:33Zevvthe object has basically the same layout as the stack frames of the proc would have during function execution.
13:48:48FromDiscord<Clyybber> @dom96 maybe disable embeds for disbot; don't think I have the perms for that
13:48:52Zevvso 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:08Zevvit is exactly as large as it needs to be, not larger
13:50:20FromDiscord<dom96> well FromIRC had admin permissions
13:50:28FromDiscord<dom96> I disabled them, not sure if that will break it
13:50:52FromDiscord<Clyybber> lets test #12345
13:50:53disbothttps://github.com/nim-lang/Nim/issues/12345 -- 3Confusing error with static parameters ; snippet at 12https://play.nim-lang.org/#ix=26CQ
13:51:08FromDiscord<dom96> well that didn't help
13:52:11FromDiscord<mratsim> @Zevv, interesting where is that done?
13:53:01FromDiscord<mratsim> I wonder how to mix that with schedulers who needs type-erased continuations :/
13:53:09FromDiscord<mratsim> which
13:53:19FromDiscord<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:32FromDiscord<dom96> if I'm understanding correctly
13:54:23*NimBot joined #nim
13:54:30FromDiscord<mratsim> parameters are in the environment
13:54:39FromDiscord<mratsim> So I think it's 2
13:54:45*sk_ joined #nim
13:54:55FromDiscord<mratsim> correction, locals are in the environment
13:54:58Zevvmratsim: where is what done?
13:55:05FromDiscord<mratsim> parameters are passed like a regular function call
13:55:18FromDiscord<mratsim> The precise size usage thing.
13:55:32Zevvthat's the environment object we build
13:55:43sk_hi, how to write `if x not in y:` in nim
13:55:44Zevvthe current implementation from disruptek is not exactly like that because he was stuborn
13:55:54FromDiscord<mratsim> `if x notin y`
13:55:58Zevvhe now just puts all locals in one object, filling up the object
13:56:10FromDiscord<mratsim> that's what I do in Weave
13:56:29Zevvbut the ideal implementation (and we know how to do it), should generate a specific env object for each potential continuation
13:56:34Zevvwith exactly the objects that live at that time
13:56:47FromDiscord<mratsim> I do some hack with typles `env[] = (a, b, c, d)`
13:56:53Zevvthen the object type gets casted over between calls
13:57:07FromDiscord<mratsim> and on deserialization (a, b, c, d) = env[]
13:57:24Zevvso 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:27FromDiscord<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:27Zevvjust as the would on the stack
13:57:28FromDiscord<mratsim> with env being a cast[ptr EnvType]
13:57:35sk_mratsim haha thanks.
13:57:44Zevvdoes that make sense?
13:58:00FromDiscord<dom96> I’d say please do it for everyone
13:58:00FromDiscord<mratsim> yes it makes sense
13:58:18FromDiscord<dom96> Also, we need support for the new replies 🙂
13:58:19FromDiscord<mratsim> My main grip is github and nim links
13:58:27FromDiscord<mratsim> youtube links in offtopic are fine
13:58:43FromDiscord<mratsim> but github embeds don't add anything.
13:58:54*klaufir_ joined #nim
13:59:06FromDiscord<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:31FromDiscord<Yardanico> idk if Dimscord was updated with new replies
14:01:57FromDiscord<dom96> I think a quote of what you’re responding to would be nice
14:02:16FromDiscord<Yardanico> a few starting words from it, like the forum updater bot?
14:02:24FromDiscord<Yardanico> and yes, seems like the discord updated their api for replies https://media.discordapp.net/attachments/371759389889003532/789855154143756318/unknown.png
14:02:31FromDiscord<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:42FromDiscord<dom96> I think as much as can fit
14:06:55FromDiscord<dom96> Basically replicate the old reply functionality
14:07:16FromDiscord<Yardanico> the "quote" you mean
14:07:18FromDiscord<Yardanico> oh, they removed it completely?
14:07:22FromDiscord<dom96> Yeah
14:07:28FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2IH8
14:08:01FromDiscord<Yardanico> networking is the first thing that comes to mind obviously :D
14:08:14FromDiscord<Clyybber> oh hey Yard o/
14:08:15FromDiscord<mratsim> sure, P2P and all that jazz
14:08:18FromDiscord<Yardanico> @Clyybber hallo
14:08:44FromDiscord<mratsim> reading from a file, socket.
14:09:26FromDiscord<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:39FromDiscord<mratsim> for nim-lang.org and github.com
14:09:47FromDiscord<mratsim> youtube is OK 😉
14:09:48FromDiscord<dom96> Http server
14:09:57FromDiscord<Yardanico> @mratsim guess I should have both URL and username blacklist? :P
14:09:59FromDiscord<dom96> Thank you 🙂
14:10:08FromDiscord<mratsim> sounds flexible enough
14:10:39FromDiscord<Yardanico> disbot and ForumUpdaterBot for username, nim-lang, github for URL (maybe stackoverflow too)
14:11:10FromDiscord<mratsim> any unfurled URL that basically repeats the header instead of the content.
14:12:03FromDiscord<flywind> What's the time complexity of `cstring.len` in VM?
14:13:42FromDiscord<mratsim> in the VM cstring have the same representation as strings I think so I assume o(1).
14:14:10FromDiscord<flywind> I see, thanks
14:24:39FromDiscord<sealmove> hum, I can't publish on nimble
14:24:59FromDiscord<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:48FromDiscord<sealmove> oh so the "workflow" scope is also needed... hmm, I don't remember needing it last time
14:33:08FromDiscord<mratsim> Is everyone aware of those numbers? https://gist.github.com/hellerbarde/2843375
14:37:30*mfiano quit (Ping timeout: 272 seconds)
14:39:45ZevvI got that one hanging on the toilet door
14:40:21FromDiscord<sealmove> oh nice!
14:40:43federico3the numbers change over time - what's really important is the relations between them
14:40:46ZevvI must admit brusing my teeth usually does not take 100s
14:41:44ZevvI think it should be extended with some common things
14:41:47Zevv"calling a function"
14:41:50Zevv"dereferencing a pointer"
14:41:59Zevv"executing a system call"
14:42:37*audiofile joined #nim
14:42:46FromDiscord<Clyybber> @flywind hmm, maybe put the whole caseSenstivie check behind an if?
14:42:55FromDiscord<Clyybber> because otherwise we crash for empty string
14:44:34FromDiscord<flywind> sure
14:44:46FromDiscord<mratsim> @federico3, actually they don't change
14:45:06FromDiscord<mratsim> memory, disk and network are still as slow as 6 years before.
14:45:23FromDiscord<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:20FromDiscord<Yardanico> @mratsim electron developers will be like "what are those numbers?"
14:58:57FromDiscord<mratsim> Electron developers are the hobgobelins of your CPU resources.
15:00:49haxscramperHow 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:41haxscramperI 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:22FromDiscord<mratsim> sent a long message, see http://ix.io/2IHY
15:05:30FromDiscord<mratsim> 0.33 ns per cycle on a 3GHz CPU.
15:06:03FromDiscord<shadow.> @ElegantBeef is your scantuple in devel yet?
15:06:35FromDiscord<mratsim> so I would put function call in the same order of magnitude as a branch mispredict.
15:07:20FromDiscord<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:13FromDiscord<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:16FromDiscord<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:03FromDiscord<mratsim> the cost of closures is dwarfed by memory allocation cost
15:17:29FromDiscord<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:44FromDiscord<mratsim> plus they require a heap allocated object as well.
15:18:09FromDiscord<mratsim> in short, run this benchmark: https://github.com/mratsim/Arraymancer/blob/master/benchmarks/implementation/proc_method_closure_bench.nim
15:18:32FromDiscord<mratsim> and this one also: https://github.com/status-im/nimbus-eth1/wiki/Interpreter-optimization-resources#nim-implementation-benchmark
15:18:37federico3mratsim: "<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:58FromDiscord<mratsim> but none of the numbers here refere to CPU operations
15:19:02FromDiscord<mratsim> refers
15:19:21FromDiscord<mratsim> it's all memory, networking or disk.
15:19:44federico3yes and thats' unfortunate
15:22:59federico3well, things like compressing and branch mispredictions are CPU-bound, but timings on context switching, doing a fork & so on are equally important
15:22:59FromDiscord<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:20FromDiscord<mratsim> sure
15:24:09FromDiscord<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:25FromDiscord<haxscramper> It seems like I don't have access to editing wiki pages on this repo, sorry
15:25:47FromDiscord<mratsim> np
15:26:32federico3also, disk seeks and reads changed drastically between spinners, SSD, and recent NVMe
15:28:49FromDiscord<mratsim> HDD and SSD are in there.
15:29:08*clemens3_ is now known as clemens3
15:32:37federico3somewhere I've seen historical charts around CPU vs I/O vs network timings
15:33:22*mfiano joined #nim
15:34:20FromDiscord<shadow.> hmmm
15:34:43FromDiscord<shadow.> `>Num " " >Num " | " >Num " " >Num` (num being `+Digit`) why isn't that matching "1 2 | 3 4"
15:34:58FromDiscord<shadow.> or anything else like the example
15:35:38FromDiscord<shadow.> ah wait
15:35:43FromDiscord<shadow.> i think it's bc i have another rule above like it one sec
15:36:48FromDiscord<shadow.> ah yeah my other rule is eating it up lol
15:37:12FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IIf
15:39:02FromDiscord<shadow.> ah right just change the order in the `or` im guessing
15:39:05*mfiano quit (Ping timeout: 240 seconds)
15:39:43FromDiscord<shadow.> got it
15:45:37disruptekzevv: originally, we computed the ideal environments, but that results in more copies and harder pooling.
15:46:33disruptekmratsim: we just change the code to refer to the environment so there's no assignment needed.
15:47:07Zevv"harder pooling" ?
15:47:13Zevv"more copies"?
15:47:15disruptekthe objects aren't the same size.
15:47:30Zevvno but you only allocate the outermost biggest one originally
15:47:32Zevvthe rest "fits"
15:47:47Zevvyou allocate max of all possible envs for a split up proc
15:47:57Zevvand cast all permutations in there
15:47:58disruptekbut the location of the contents changes.
15:48:06Zevvnot if you do it right
15:48:13Zevvit's recursive. it's towers of hanoi
15:48:16disruptekwell, sure, but you would have to binpack the thing.
15:48:24Zevvnope
15:48:36Zevvyour natural stack does exactly the same. It grows. shrinks a bit, grows a bit
15:48:53Zevvso 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:20disrupteki remain unconvinced.
15:49:26ZevvI'll draw a picture
15:49:37*natrys joined #nim
15:49:45disruptekbut anyway, it doesn't matter.
15:49:54Zevvit does, a bit. We allocate Just Enough
15:50:11Zevvthe lazy solution is not bad as well. We allocate Just A bit More
15:50:19disruptekwell, turn the code back on. we splitting of envs is a simple if statement.
15:50:24disrupteks/we/the/
15:50:30Zevvsure
15:50:37Zevvdoesnt matter indeed for now
15:50:41disruptekyou can save us a couple bytes. 🙄
15:50:56ZevvClyybber mentioned there is a special peek mode in macros where you can see how your for loops expanded
15:51:05Zevvif it's that simple, we also support non-closure iterators
15:53:20FromDiscord<mratsim> @zevv, @disruptek, I think the allocation strategy should be managed by the scheduler anyway
15:53:50Zevvsure, but it's about allocating a bit more or a bit less, only
15:54:00Zevvbut indeed
15:54:08Zevvdisruptek: the other day it came up that our current envs are refs.
15:54:16Zevvwhat is the impact if we make them object type
15:54:20Zevvnon ref, non pointer
15:54:49*mfiano quit (Ping timeout: 264 seconds)
15:54:50FromDiscord<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:00Zevvthe 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:12disruptekhmm.
15:55:13Zevvright, that ^^
15:55:34ZevvCPS should not care a single bit
15:55:41Zevvjust drop the ref from your concept and var your args
15:55:43FromDiscord<mratsim> technically I don't want to pool but it depends on the constraint we put.
15:55:54Zevvsure. but if you want, you should be able to
15:56:10ZevvWe mainly target ARC, personally I want to target global allocations for tiny scale embedded
15:56:16disruptekthe /original/ idea, btw, was that the env types use inheritance. 😉
15:56:24FromDiscord<mratsim> meh
15:56:47Zevvsure, but we can just shove all stuff in like we do now, or create different types and cast along
15:56:54FromDiscord<mratsim> maybe with concepts and vtable but they aren't here
15:56:58disruptekit was an effort at **correct by construction**.
15:57:00Zevvdon't. there is no reason to
15:57:08ZevvOO does not make it correct
15:57:13Zevv /inheritence/
15:57:28*mfiano joined #nim
15:57:34disruptekit would put each symbol into the typedef just once.
15:57:43disrupteksingle source of truth.
15:58:10disrupteki'm just saying... that's why the original design split the envs.
15:59:10disruptekyou will have to use cast to pass different types around.
16:00:18disruptekmissing vtable is a deal-breaker, i think.
16:00:24Zevvshadow.: 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:27FromDiscord<gcao> sent a long message, see http://ix.io/2IIv
16:00:38Zevvit parses the grammar with npeg into a list of choices with sequences
16:00:44Zevvand then has a pretty trevial match function
16:00:51Zevv(which is broken somehow, still :) )
16:00:54disrupteklemme get some coffee and i will think about other reasons to shit on your objects.
16:00:55Zevvwhatever it's worth
16:00:56FromDiscord<lqdev> @gcao no.
16:01:09Zevvdisruptek: I can't think of any problems, actually
16:01:12FromDiscord<lqdev> why would you need that, what are you trying to do?
16:01:17FromDiscord<gcao> I
16:01:45disruptekthe problems are in the dispatcher, which is basically... someone else's problem.
16:01:49disruptekbut it's still a problem.
16:01:59disrupteki don't plan to use CPS without a dispatcher. 🤣
16:02:25ZevvI do
16:02:36disruptekno trampoline? really. you savage.
16:03:28FromDiscord<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:42FromDiscord<lqdev> oh
16:04:13FromDiscord<mratsim> @disruptek, I need coroutines without dispatcher to debug concurrent data structures like queues or hash tables 😉
16:04:17FromDiscord<lqdev> well, here's my idea: use a single `ref object` instead of globals.
16:04:32FromDiscord<mratsim> because the dispatcher would be a "mathematical" algorithm
16:04:35FromDiscord<lqdev> and then share that `ref object` between all your plugins
16:05:05*mfiano quit (Ping timeout: 256 seconds)
16:05:08FromDiscord<gcao> thanks I'll give it a try
16:05:19FromDiscord<mratsim> @gcao, use shallow seq
16:05:28FromDiscord<gcao> how?
16:05:32FromDiscord<mratsim> they will have reference semantics
16:05:53FromDiscord<lqdev> i think mratsim's referring to system.shallow
16:06:04FromDiscord<mratsim> https://github.com/mratsim/Arraymancer/blob/v0.6.0/src/tensor/data_structure.nim#L20-L30
16:06:10FromDiscord<gcao> thanks let me read about it.
16:06:16FromDiscord<mratsim> the {.shallow.} pragma
16:06:36Zevvi thought that was a mratsim-only pragma
16:06:41FromDiscord<mratsim> it makes string and seq in the object copy by reference instead of by value which is Nim default
16:06:56Zevv"This can cause serious semantic issues and break memory safety"
16:07:19FromDiscord<mratsim> that's because people often make mistakes with reference semantics
16:07:31FromDiscord<gcao> I suppose I still need to call a function in the extension to assign the global "first"?
16:07:46FromDiscord<mratsim> they to "a = b" then "b[0]=42" and don't realize that a has been changed.
16:07:49kinkinkijkinthere a way to fetch the running user's name in nim, with just the std?
16:07:53FromDiscord<mratsim> do
16:08:01*mfiano joined #nim
16:08:05FromDiscord<gcao> understood
16:08:06*axion joined #nim
16:08:09*mfiano quit (Client Quit)
16:08:59*axion quit (Client Quit)
16:09:33FromDiscord<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:04FromDiscord<gcao> is this necessary in order for the extension to access same "first" global variable
16:10:07FromDiscord<gcao> (edit) "variable" => "variable?"
16:12:00FromDiscord<shadow.> https://play.nim-lang.org/#ix=2IIP
16:12:09FromDiscord<shadow.> any idea why this peg is failing zevv?
16:13:12FromDiscord<mratsim> a shallow seq needs to be wrapped in an object
16:13:28FromDiscord<mratsim> but for parameter passing Nim doesn't copy.
16:13:50Zevvshadow: -d:npegTrace should tell you?
16:14:14*mfiano joined #nim
16:14:25FromDiscord<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:44FromDiscord<Ulrik> NIM what kind of language is this? what's its purpose instead of the other languages??
16:14:45FromDiscord<Zachary Carter> yeah I did
16:14:47FromDiscord<shadow.> with npeg trace what part should i be looking at specifically
16:14:51FromDiscord<shadow.> read faq
16:14:55Zevv.shadow: https://play.nim-lang.org/#ix=2IIZ
16:14:56Zevvworks for me
16:15:13FromDiscord<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:16Zevvare you doing part 2? Did you change rule 8 and 11 yet?
16:15:22FromDiscord<shadow.> > Nim is a statically typed compiled systems programming language.
16:15:23FromDiscord<shadow.> im doing part one
16:15:26Zevvok
16:15:28Fish-FaceI am still on part 1
16:15:31Fish-Facealso trying npeg today
16:15:42FromDiscord<shadow.> yeah i tried it on a small set like you did zevv and it worked
16:15:50FromDiscord<shadow.> but when i tried it on my file
16:15:51FromDiscord<shadow.> it doesn't work
16:16:00Zevvmy above link has a working parser
16:16:15FromDiscord<Ulrik> @shadow. What about go? it does exactly the same and is 100x more popular
16:16:16Zevvbut it's more flexible. It parses choices of seqs
16:16:22ZevvUlrik: true
16:16:25Zevvgo is great
16:16:27FromDiscord<gcao> @Zachary Carter any suggestions on how to approach this and gotchas?
16:16:30FromDiscord<shadow.> i mean
16:16:38FromDiscord<shadow.> does go have generics
16:16:40FromDiscord<shadow.> metaprogramming
16:16:45FromDiscord<haxscramper> It does approximately 30% of what nim does
16:16:46FromDiscord<shadow.> arguably more readable syntax
16:17:01FromDiscord<Ulrik> It dosnt have brackets language without brackets are messy
16:17:02Zevvit has a good thrading story
16:17:11FromDiscord<shadow.> that's objective.
16:17:17FromDiscord<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:43ZevvUlrik: but sure, if Go fits your needs, stick with it. Nim might not add anything useful for you
16:17:54FromDiscord<Zachary Carter> obviously, step 1, is compiling your program to a shared library
16:17:57ZevvThe Go stdlib is terrific as well
16:17:57FromDiscord<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:03FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IJ8
16:18:11FromDiscord<shadow.> i can certainly tell which is more verbose
16:18:17ZevvUlrik: it *is* nice and easy. But it's a beast if you unleash the power
16:18:32FromDiscord<Zachary Carter> then you need code to handle the loading / unloading of plugins and symbols inside their associated shared libraries
16:18:33ZevvWhile Go has its limits. Without generics and OO, your code tends to get verbose or repetative
16:18:37FromDiscord<shadow.> you don't have generics, ufcs, metaprogramming, ffi, etc in go
16:18:41FromDiscord<shadow.> and yeah no oo either
16:18:47Zevvshadow.: there is ffi allright
16:18:47FromDiscord<Ulrik> aware of taht
16:18:51FromDiscord<shadow.> there is?
16:18:52FromDiscord<shadow.> oh damn
16:18:53FromDiscord<Ulrik> but Is it really needed
16:18:59FromDiscord<shadow.> is it as good as nims tho lmao
16:19:01FromDiscord<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:04ZevvUlrik: Of course not.
16:19:10ZevvYou can write everything you want in assembly
16:19:10FromDiscord<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:28Zevvwhat is _needed_ is subjective.
16:19:41FromDiscord<Zachary Carter> I use this library - https://github.com/fungos/cr
16:19:50FromDiscord<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:05FromDiscord<Ulrik> I still don't see the need for nim
16:20:10FromDiscord<Ulrik> How old is it?
16:20:12FromDiscord<shadow.> then dont learn it
16:20:21FromDiscord<gcao> C and FFI are not my main concern. the extensions may be in Nim only
16:20:24FromDiscord<shadow.> if you dont need it there's no reason to learn it
16:20:29ZevvUlrik: 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:36ZevvUlrik: about 15 years old
16:20:44FromDiscord<Zachary Carter> so what problem are you having exactly?
16:20:55FromDiscord<Ulrik> Nim is 15 years old and bearly has even reached the top 99, that says alot.
16:21:08ZevvSure. That say s a lot.
16:21:15FromDiscord<shadow.> in all fairness go is kind of backed by google so it's not exactly a fair comparison
16:21:27FromDiscord<Ulrik> Well that is true
16:21:39FromDiscord<Zachary Carter> Is D in the top 99?
16:21:39ZevvUlrik: no one is saying you are wrong, are they?
16:21:49FromDiscord<haxscramper> Most of the hyped languages are either 40+ old or backed by google/mozilla etc.
16:21:49FromDiscord<Clyybber> greatness takes time
16:21:54FromDiscord<gcao> there are two main problems I'm concerned. The first is the global variables seem to be duplicated inside the extension
16:21:58FromDiscord<Zachary Carter> is Zig?
16:22:07ZevvUlrik: 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:11FromDiscord<Zachary Carter> do you have some example code?
16:22:49FromDiscord<Zachary Carter> I've encountered something similar - and I'll use a compiler define to handle that
16:23:02FromDiscord<shadow.> @Ulrik what do you like making?
16:23:04FromDiscord<Zachary Carter> so the symbols are only declared in a single compilation unit
16:23:05ZevvUlrik: 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:17FromDiscord<gcao> https://github.com/gcao/gene.nim/blob/http/src/genex/http.nim
16:23:41FromDiscord<Ulrik> @shadow. Web scrapping, discord bots. Websites currently uses node.js with EJS + express. Doing system calls, micro service, Programming network interfaces.
16:24:06FromDiscord<gcao> lots of global variables here https://github.com/gcao/gene.nim/blob/http/src/gene/types.nim#L971
16:24:06FromDiscord<shadow.> well if you're doing web scraping and discord bots why are you looking at compiled languages / statically typed ones?
16:24:12FromDiscord<shadow.> do you need high high efficiency?
16:24:36FromDiscord<shadow.> i would honestly typically recommend py or js over any other language for stuff like that
16:24:58FromDiscord<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:13FromDiscord<shadow.> hm
16:25:21FromDiscord<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:22FromDiscord<shadow.> well nim does have a pretty nice dapi library
16:25:25FromDiscord<Zachary Carter> @gcao I'm cloning the project now
16:25:35FromDiscord<shadow.> !repo dimscord
16:25:36disbothttps://github.com/krisppurg/dimscord -- 9dimscord: 11A Discord Bot & REST Library for Nim. 15 49⭐ 8🍴 7& 3 more...
16:25:59FromDiscord<gcao> the branch is to create a working http server in the extension. I have code in the interpreter will load extensions
16:26:42FromDiscord<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:56FromDiscord<shadow.> zevv: can i see which line or section it failed on in the npegtrace?
16:27:52Zevvyou can see your subject scrolling by in column #2
16:27:58FromDiscord<shadow.> kk lemme check
16:28:02Zevvalso, you can inspect your return value from the match()
16:28:06FromDiscord<Ulrik> Can NIM do webserver and do websites such as node.js with epxress and EJS can?
16:28:07Zevvand look at matchMax
16:28:12Zevvit's the offset up to where matching succeded
16:28:16Zevvtypically that's where you went wrong
16:28:33FromDiscord<shadow.> column two?
16:28:41FromDiscord<shadow.> the one with all 0's?
16:28:42FromDiscord<shadow.> lol
16:28:59Zevvcolumn 3 then, I dunno
16:29:05Zevvyou'll see your input data there
16:29:07FromDiscord<shadow.> matchMax: 967 hm
16:29:10FromDiscord<shadow.> is that the max character?
16:29:17FromDiscord<Zachary Carter> @gcao sure
16:29:25Zevvright. So then you dump your subject[967..^1]
16:29:28Zevvand see where that is
16:29:32FromDiscord<shadow.> ohhh nice nice
16:29:42ZevvI should write that stuff down, right
16:29:50FromDiscord<shadow.> hm?
16:29:52Zevv:)
16:30:45FromDiscord<shadow.> `8: 42`
16:30:48FromDiscord<shadow.> i didn't account for that
16:30:52FromDiscord<shadow.> rip
16:30:57Zevvthere you have it :)
16:31:06Zevvyour rules have a grammar, use that
16:31:15FromDiscord<shadow.> yup
16:31:21Zevveach rule consists of a squence of choices of (sequence of rule ids)
16:31:33FromDiscord<shadow.> thanks
16:31:45FromDiscord<shadow.> for the help lol
16:31:46Zevvnow you're only matching X X | X X
16:31:55Zevvbut make sure to also match other numbers or X's or number of choices
16:32:01Zevvlike X X | X X X | X X X
16:32:18FromDiscord<shadow.> if im not wrong those dont appear in my input, but yeah that'd probably be a good idea
16:32:31Zevvyour input mihgt change, right
16:33:19FromDiscord<shadow.> i see
16:33:52narimiranZevv: `X X | X X X | X X X` don't appear in the input
16:34:05FromDiscord<shadow.> ah `x | x` did tho
16:34:11narimiranit is just `x x` or `x x | x x`
16:34:24Zevvnarimiran: oh and what about rule 11 in part 2
16:34:48*letto_ quit (Quit: Konversation terminated!)
16:34:50narimiranno idea, i haven't even solved part 1
16:35:03FromDiscord<shadow.> alr ig im changing to a seq[seq[int]] lol
16:35:07Zevvhaha
16:35:20FromDiscord<shadow.> im guessing im just gonna wind up using a recursive regex builder
16:35:24FromDiscord<shadow.> for part one
16:35:29*letto joined #nim
16:35:54Zevvit's about matching a choice, and then commiting or backtracking
16:35:56narimiranwhen i saw the task i was "hmmm, maybe i should really start learning npeg"
16:35:56Zevvrecurse until done
16:36:11FromDiscord<shadow.> yeah
16:36:52narimiranbut i decided to do it myself, which — in hindsight — wasn't the smartest choice.
16:37:35narimiranand then after lots of failed attempts, i decided to give up. which *was* a smart choice.
16:39:09disruptekmratsim: CPS requires a trampoline unless we impl tailcall recursion in c, as you know. i use dispatcher<->trampoline interchangeably.
16:39:48Zevvthe trampoline is also nice for debugging, let's just keep that
16:40:57FromDiscord<mratsim> it would be nice if the compiler had trampolines in debug mode instead of crashing at 2000 recursions
16:41:52disrupteki would rather have tail calls.
16:41:57haxscramperI 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:57haxscramperMost likely I will go with this implementation for C++ interop, but if anyone has some input
16:41:57haxscramperIt would be nice to hear
16:41:57haxscramperOr some comments on overall code
16:42:18disruptekbut i don't care about exporting a 3 line template or whatever.
16:42:30Zevvdisruptek: well, we could make this work for the lucky folks who have a C compiler doing TCO
16:42:49Zevvor for the folks who know they will go to limited depth
16:43:16disrupteki guess one nice feature of non-ref env is that we can overload [] usefully, though it might confuse the reader a bit.
16:43:19Zevvwe might be able to tail-call-a-bit and then trampoline
16:43:25Zevvso you go, like, 30 deep, and then bail out
16:43:59Zevvtrampoline once, and go back in
16:44:27disruptekthat's the dispatcher's problem.
16:44:35disruptekthey can just have a state machine or whatever they want.
16:44:45Zevvnot if you want to natively tail call
16:44:51Zevvthen we should not return the fn, but call it
16:45:01disruptekthat's what mutant was.
16:45:04Zevvin the CPS transformed proc
16:45:44disrupteki would rather return the proc and not store it in the env.
16:46:21Zevvtalk talk talk but do we have somehing that works
16:46:21disrupteki don't see what it buys me to store a pointer to it.
16:46:27FromDiscord<shadow.> zevv: gottem
16:46:32Zevvnice
16:46:40FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IJJ
16:46:42FromDiscord<shadow.> shoulda just done that from the beginning lol
16:58:31*lritter joined #nim
17:04:18FromGitter<bung87> in quote do how do I prevent await expand too earlier ?
17:04:48FromGitter<bung87> I have ``body`` which contains `await`
17:05:54FromDiscord<Goel> Hello, which is the latest version of nim compiler?
17:06:25*mfx joined #nim
17:06:42FromGitter<bung87> stable 1.4 devel 1.5
17:07:40FromGitter<bung87> I got `internalRead(cast[type(resp(req, "Hello World", headers, Http200))](chronosInternalTmpFuture))' has no type (or is ambiguous)`
17:07:53disruptekdom96, 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:15FromDiscord<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:56FromGitter<bung87> you ever update versions ?
17:10:15FromDiscord<Goel> Of choosenim?
17:10:23*mfx quit (Remote host closed the connection)
17:11:03FromGitter<bung87> update stable or devel, looks like it doen't get latest versions
17:11:39FromDiscord<Goel> my choosenim version currently is 0.7.5
17:12:40FromGitter<bung87> not about tool, nim versions
17:12:53FromDiscord<Goel> Same goes if i use "nim -v" tells me im using nim compiler 1.0.6
17:13:02disruptekwhy does `nimble test` need to give me a stack trace when a test fails? so dumb.
17:13:13disruptekit's like no one tests this shit.
17:14:00FromGitter<bung87> I mean update your nim versions
17:14:04disruptekit's 10 lines of text to tell me one single bit of information.
17:16:05FromDiscord<Goel> With "choosenim update stable"?
17:16:22FromGitter<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:41disruptek~gitnim
17:16:42disbotgitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek
17:16:47FromDiscord<Goel> Ok now it works, thanks
17:17:36FromGitter<bung87> weird , it doesn't fetch meta info about versions
17:19:48FromDiscord<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:46disruptekneat.
17:37:10*hnOsmium0001 joined #nim
17:39:11FromDiscord<Daniel> how do i make nim forum send me email when some1 replies in the forum thread?
17:41:48disruptekhow do i make honor killings more socially acceptable in my community?
17:42:35FromDiscord<tiatomee> There is `Option[T]` but is there something like `Result[T, E]` or `Either[A, B]`?
17:46:15disruptek!repo badresults
17:46:16disbothttps://github.com/disruptek/badresults -- 9badresults: 11like results but worse 15 1⭐ 0🍴
17:47:00disruptekthe original implementation really should be linked there, but it's called, like, nim-results.
17:48:10disruptekaraq, clyybber: badresults tests demonstrate a cpp --gc:arc codegen bug.
17:51:00FromDiscord<mratsim> !repo nim-result
17:51:01disbothttps://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:11disruptekyeah, that one.
17:51:33FromDiscord<mratsim> !repo stew also has nim-results and a couple of standard utilities we use at Status
17:51:34disbotno results 😢
17:51:40FromDiscord<mratsim> !repo stew
17:51:41disbothttps://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:46disruptekit's funny, i just typing the link into the README.
17:51:47*audiofile quit (Quit: Connection closed)
17:51:58disruptekhow big is stew now?
17:52:31FromDiscord<mratsim> maybe 10 modules
17:52:56FromDiscord<mratsim> 25 actually
17:53:06FromDiscord<tiatomee> Interesting, thanks! I ended up making my own type for now 🙈
17:53:14FromDiscord<Clyybber> disruptek: ah cool
17:53:14FromDiscord<mratsim> I only use byteutils, endians2 and results
17:53:28disrupteknothin' wrong with that.
17:55:19FromDiscord<dom96> 0.7.5 is a pre-release, that's why you don't get a run.bat file
17:57:24leorizemratsim: if you find the time, can you port some of the heavily used modules to fusion? :)
17:58:07disruptekplease disregard my rant about `nimble test`. i don't know what it does. my exception was due to my own laziness.
18:00:59disruptekclyybber, araq: it's the bug i reported previously; explicit --exceptions:goto breaks codegen under cpp and arc.
18:01:19Zevvdisruptek: 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:42disruptekwhen does the caller not know both things, though?
18:02:06Zevvright, that's what I'm saying
18:02:21disruptekright.
18:02:24Zevvright.
18:02:28disrupteki got it, buddy.
18:02:32Zevvme too
18:02:33disrupteki GOTCHU.
18:02:35Zevvgreat pair, we, right
18:02:38disruptekright.
18:03:19disruptekso... cuckoo filter today, or more attention paid to my testes?
18:04:52disruptekif there's a `show tips? 🗵` that you leave checked, in what software does it appear?
18:08:50disrupteki guess you folks know everything.
18:11:02*Sembei joined #nim
18:11:12*lritter quit (Quit: Leaving)
18:13:36ZevvClyybber: how is this getImplTransformed supposed to work? Not like this I guess? https://play.nim-lang.org/#ix=2IKg
18:14:43FromDiscord<Clyybber> you give it a proc syn
18:14:48FromDiscord<Clyybber> (edit) "syn" => "sym"
18:15:05Zevvow and I just noticed "see tests/macros/tmacros_various.nim" in the manual
18:15:09Zevvfirst ask, then read
18:15:15Zevvfirst shoot, then ask, then read
18:15:38disruptekshoot, ask
18:15:48Zevvbut quickly
18:15:49disruptekor just shoot?
18:17:48*klaufir_ joined #nim
18:18:34leorizedisruptek: wdyt about this "feature"? :P https://github.com/alaviss/setup-nim/pull/5
18:18:41disbotAdd function to allow downloading compiler for other architecture
18:20:03Zevvwell well disruptek, would you look at this. You knew? https://play.nim-lang.org/#ix=2IKo
18:20:15disruptekhard to believe, i know.
18:20:58FromDiscord<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:40leorizestd/monotimes
18:21:59leorizehttps://nim-lang.org/docs/monotimes.html
18:22:08Zevvwho is anyone supposed to find that?!
18:22:15FromDiscord<Rebel> google?
18:22:20Zevvand why is it not in times?
18:22:25disruptekit's new.
18:22:29Zevvsweet
18:22:32leorizewe really need an autogenerator for the library page
18:22:36disruptekwell, it's not /that/ new.
18:22:43disruptektimes is a mess, imo.
18:22:44Zevvsour
18:22:44FromDiscord<tiatomee> Thanks a lot! I am having a bit of trouble finding my way through the docs I gotta admit
18:22:55leorizeZevv: it's in the index if anyone ever look at it
18:23:07FromDiscord<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:11FromDiscord<tiatomee> The Rust APIs and docs really treated me well, I need to adapt to Nim 😅
18:23:14Zevvtiatomee: 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:15FromDiscord<Rebel> (edit) "Also Disruptek do not think I forgot my problems will be fixed ... the" added "and"
18:23:19disruptekyou know what, we should really flip this whole problem of libraries on its head.
18:23:23leorize(and the index is a horrible mixed up mess)
18:23:35FromDiscord<mratsim> @leorize, time? where do you find that?
18:23:43disruptekblazor makes my pants tight.
18:23:48FromDiscord<mratsim> I tried to import the times module but it didn't work
18:23:57ZevvI 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:58leorizeimport std/monotimes
18:24:05FromDiscord<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:26FromDiscord<Rebel> Bruh what do you have against Blazor lol don't you dare and try rip on dependency injection
18:24:27FromDiscord<exelotl> +1, Rust really has a culture of writing excellent docs
18:24:31disruptekwhy don't we just version the library with incrementing majors and just monorepo whatever we want?
18:24:36Zevvtiatomee: it *is* a fair point.
18:24:55disruptekputting everyone at head will solve all our problems.
18:25:09Zevvand I'm just as guilty as anyone else, here I am sitting on my couch, not writing or improving the documentation
18:25:14leorizehttps://forum.nim-lang.org/c/3 <- we have a docs category to discuss on the forum
18:25:30disruptekaraq: seriously, tell me why this idea doesn't make sense.
18:25:35FromDiscord<mratsim> @tiatomee https://nim-lang.org/docs/theindex.html
18:26:20leorizewe need to organize yet-another-doc-rework tbh
18:26:28FromDiscord<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:50disruptekmaybe the solution to the docs is a tool to make writing docs RIDICULOUSLY easy.
18:26:57FromDiscord<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:02disrupteknot writing, /contributing docs/.
18:27:12leorizeand nim's biggest is docs
18:27:32disruptekmratsim: this is more true than you know.
18:27:33FromDiscord<Rebel> You want something like Sphinx but for Nim disruptek?
18:27:44disruptekno, i would just use sphinx.
18:27:50disruptekbut, not that. i'm talking about ndoc.
18:27:56FromDiscord<Rebel> ah
18:28:06disruptekndoc should be /primarily/ a way to /contribute/ documentation.
18:28:14disruptekas fast as it is, it should be even easier.
18:28:21leorize!repo ndoc
18:28:23disbothttps://github.com/nodeca/ndoc -- 9ndoc: 11js port of pdoc, with extentions 15 93⭐ 8🍴 7& 29 more...
18:28:26disrupteklol
18:28:29FromDiscord<mratsim> We can just use sphinx since Nim and sphinx are both using RST
18:28:31leorizewait what is ndoc?
18:28:41disruptekright, i prefer mkdocs but sphinx is good, too.
18:28:42FromDiscord<mratsim> nim doc foo.nim
18:28:49disruptekndoc is pydoc for nim.
18:28:56disruptek!repo disruptek/ndoc
18:28:57disbothttps://github.com/disruptek/ndoc -- 9ndoc: 11like pydoc but for nim 15 0⭐ 0🍴
18:28:58disruptekit's v-ware.
18:29:13FromDiscord<mratsim> we call that "readme-driven development"
18:29:14FromDiscord<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:25disruptek~vware is readme-driven development.
18:29:26disbotvware: 11readme-driven development.
18:29:52disruptekour doc gen is great, especially for runnable examples.
18:30:12leorizeif we ever want to push this forward I'd recommend using the forum to organize the effort
18:30:20disruptekwe should be able to have runnable examples include a toggle to add expandArc notations to the example.
18:30:28FromDiscord<mratsim> it doesn't work on repos with a private module and some functions imported and made public by another module
18:30:31disruptekthen you can see the resource impact of the example.
18:30:36leorizeirc is frequent by like 5-6 devs that actively work on nim
18:30:55disruptekleorize: you can be our liason.
18:31:00disrupteki really hate the web.
18:31:16FromDiscord<Rebel> If you want to see some good docs for a library check out fastapi docs those docs are no joke 😛
18:31:37disruptekif you really want someone to read something, provide a link. no joke.
18:31:43FromDiscord<mratsim> At Status we just use the Rust doc generator for documentation 😉
18:31:50disrupteki mean, i hate the web. i think i just mentioned that.
18:32:00disruptekdon't make me fucking search.
18:32:06FromDiscord<Rebel> well I mean you're not wrong lol
18:32:06FromDiscord<Rebel> https://fastapi.tiangolo.com/
18:32:16leorizedisruptek: dude I want to write software too, can't just organize stuff :P
18:32:27disruptekleorize: what.
18:32:41disruptekare you saying you want me to help you?
18:33:04FromDiscord<mratsim> @Rebel looks good
18:33:08FromDiscord<Rebel> We need Nim testimonies of people using Nim at companies and saying how much it helped or didn't lol
18:33:11leorizeyes, you're pretty good at making rants on how things suck :P
18:33:31FromDiscord<mratsim> Disruptek must be French inside
18:33:32disrupteki go to this fucking web-site and the first link is to Documentation.
18:33:36disruptekso of course i click that link.
18:33:41disruptekthat's what i want, right?
18:33:43disruptekDocumentation.
18:33:48disruptekso where do you think i end up?
18:33:52disruptekon the same fucking page.
18:34:02FromDiscord<Rebel> you are on the documentation you silly rabbit
18:34:12leorizeplease rant on the forum :)
18:34:18disruptekbut i can't tell because the masthead is so fucking large that i have to actually scroll.
18:34:24leorizeyou ranted once about cps and now 4raq gives it priority
18:34:28FromDiscord<mratsim> @Rebel "We need"? Are you evaluating whther or not to use Nim?
18:34:30leorizeplease do the same magic for docs
18:34:43disruptekno, we've been whispering about cps since like june.
18:34:59disruptekbut i do think ndoc could be easy to write.
18:34:59FromDiscord<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:01leorizepeople has been complaning about docs since nim is a thing
18:35:03FromDiscord<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:06disruptekand it could be a game changer for docs development.
18:35:24disruptekmratsim: wait, our rst doesn't support tables?
18:35:27Zevvtiatomee: see what you did there
18:35:31disruptekthat's insane.
18:35:41FromDiscord<mratsim> there are 2 types of tables in RST
18:36:05disruptekleorize demonstrated one form.
18:36:07FromDiscord<mratsim> Nim supports the easy one which no tools produce except pandoc after one Nimmers asked for it in Pandoc repo
18:36:27FromDiscord<mratsim> it created some kind of war with others that had a regression also
18:36:28FromDiscord<tiatomee> Zevv: all part of my secret plan >:D
18:36:29disruptekdoesn't /sound/ like the easy one.
18:36:51leorizehttps://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:59disruptekyeah, that's the one i'm talking about.
18:37:02FromDiscord<mratsim> anyway, everytime I produce a doc for Arraymancer, I spend like 30 min dealing with RST annoyances :/
18:37:04Zevvtiatomee: nah, we have this fit every few weeks
18:37:09FromDiscord<Rebel> With Nim inline assembly does it support MASM?
18:37:22FromDiscord<mratsim> it already support Intel masm
18:37:46FromDiscord<Rebel> interesting
18:37:47FromDiscord<mratsim> --passC:-masm=intel in the CLI
18:37:54FromDiscord<Rebel> that might be the easiest to do syscalls then
18:38:00FromDiscord<Rebel> in C# it's so janky
18:38:13leorize[m]!repo nim-syscall
18:38:14disbothttps://github.com/def-/nim-syscall -- 9nim-syscall: 11Raw system calls for Nim 15 19⭐ 3🍴 7& 2 more...
18:38:20FromDiscord<Rebel> no
18:38:23FromDiscord<Rebel> those are linux syscalls
18:38:25FromDiscord<Rebel> I need Windows lol
18:38:33FromDiscord<tiatomee> Uhm probably an easy question, but how do I parse a string to a `uint64`?
18:38:37FromDiscord<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:38disruptekdon't be a dick, no one here uses windows.
18:38:47superbiaI use windows
18:38:49FromDiscord<mratsim> @tiatomee, parseUint
18:38:49FromDiscord<Rebel> Well that's just a lie
18:39:01FromDiscord<Rebel> Go to any company and tell me which OS you will see more of Linux or Windows?
18:39:04superbiaalmost all of the houses in my village have windows
18:39:05FromDiscord<Rebel> typically ofc
18:39:05disrupteknim users don't use windows.
18:39:11FromDiscord<Rebel> that's a lie
18:39:14FromDiscord<Rebel> I do 😛
18:39:21FromDiscord<tiatomee> But that returns a `uint`, is it the same size as `uint64`?
18:39:22disruptekwell, they shouldn't be allowed to use windows.
18:39:23FromDiscord<tiatomee> I guess I need to cast ten
18:39:23superbiaah you mean windows OS
18:39:25FromDiscord<tiatomee> (edit) "ten" => "then"
18:39:27disruptekfriends don't let friends run windows.
18:39:43disrupteklike, you sorta owe it to a friend to get them off windows.
18:39:46FromDiscord<Rebel> don't tell me you use arch :/
18:39:52FromDiscord<mratsim> parseBiggestUint and convert
18:39:54disruptekit's a religion of ineptitude.
18:39:55FromDiscord<tiatomee> `Error: unhandled exception: invalid unsigned integer: [ValueError]` I guess not?
18:40:09FromDiscord<mratsim> integer was negative?
18:40:17leorize[m]@Rebel why would you ever wanna do syscalls on windows?
18:40:35FromDiscord<tiatomee> Nope, no negative numbers. Maybe it's the empty line at the end
18:40:44disrupteklook 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:57FromDiscord<mratsim> Apple of course
18:41:05disrupteklol
18:41:11Zevvtiatomee: don't cast, convert: https://play.nim-lang.org/#ix=2IKI
18:41:17FromDiscord<tiatomee> Yeah that was it, trying to parse an empty string. Also thanks for `parseBiggestUint`
18:41:48FromDiscord<tiatomee> Zevv: isn't that the same with UFCS?
18:41:49disruptekyeah, it used to be called parseTheBiggestUintYouCanFindLikeTheReallyReallyBittyBigOne.
18:42:06FromDiscord<mratsim> @tiatomee Nim has UFCS
18:42:13FromDiscord<tiatomee> Yeah that's what I mean
18:42:21FromDiscord<tiatomee> `uint64(x)` is the same as `x.uint64`
18:42:34FromDiscord<tiatomee> unless my lingo is wrong and the first one is not a "cast"
18:42:37FromDiscord<mratsim> myFn 1234 | 1234.myFn | 1234.myFn() | myFn(1234) are all valid
18:42:41Zevvtiatomee; yeah but casting is really doing `cast[uint64](sometThing)`
18:42:47disruptekprocs that conflate the name with the type make absolutely zero sense to me.
18:42:57FromDiscord<tiatomee> Ahh I see, yeah that makes sense then
18:42:58FromDiscord<mratsim> casting is reinterpreting the raw bit pattern
18:43:08FromDiscord<mratsim> no checks, you're on your own, unsafe
18:43:30FromDiscord<mratsim> conversion will have runtime checks (at least until we get formal verification)
18:44:03FromDiscord<dom96> conversion also has some compile-time checks
18:44:21FromDiscord<Rebel> Leorize I put why in offtopic
18:45:22*klaufir_ quit (Ping timeout: 256 seconds)
18:45:42FromDiscord<tiatomee> That all makes sense and I've already used conversions then!
18:45:45FromDiscord<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:54FromDiscord<fwsgonzo> it says that -d:useMalloc uses malloc, realloc and free, so it doesn't use calloc then?
18:51:15FromDiscord<mratsim> I'm pretty sure malloc = c_alloc that you have in `import system/ansi_c`
18:51:58leorize[m]@fwsgonzo, nim already do the zeroing so calloc is redundant
18:52:54FromDiscord<Clyybber> @mratsim not sure if it helps but there have been improvements to the table support lately
18:53:19FromDiscord<mratsim> tables? Do we have SortedTable now? :p
18:53:29FromDiscord<Clyybber> oh; rst tables :D https://github.com/nim-lang/Nim/pull/16040
18:53:30disbotRST tables: fix latex col number; allow <= 3 of =
18:54:08disrupteki was so confused.
18:55:11FromDiscord<mratsim> ah ok
18:56:54FromDiscord<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:05Zevvs[4..^1]
18:58:03FromDiscord<tiatomee> Thanks!
18:59:04*klaufir_ quit (Ping timeout: 272 seconds)
18:59:30FromDiscord<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:55Zevvmratsim: don't scare the newbies dude
19:00:02FromDiscord<mratsim> hopefully we change that soon
19:00:07Zevvright.
19:00:12disruptekright.
19:00:17*lum quit (Quit: Lum: Bye!)
19:00:18FromDiscord<mratsim> @Araq^
19:00:50FromDiscord<tiatomee> That's good to know, thanks @mratsim
19:01:03FromDiscord<tiatomee> still feels weird to not have borrow semantics in the language at all times
19:01:09FromDiscord<tiatomee> same with ownership
19:01:10FromDiscord<mratsim> it has
19:01:16disruptekthat's the beauty of it.
19:01:35disruptekwe don't ask you to compose the annotations; we do it for you.
19:01:38FromDiscord<mratsim> https://nim-lang.org/docs/manual_experimental.html#view-types
19:01:40FromDiscord<tiatomee> I've seen the `lent` before, but I mean like "Oh a substring of the input? Just return a new `string`"
19:02:00FromDiscord<haxscramper> What is the possible reason `cannot instantiate:` error on this code https://play.nim-lang.org/#ix=2IKO ?
19:02:24FromDiscord<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:24FromDiscord<mratsim> The thing is, lent types are pretty young and the stdlib is being reworked to use them
19:03:02FromDiscord<mratsim> we won't make Nim like Rust, more likely like Ada/Sparks if anything
19:03:21FromDiscord<tiatomee> That's great, I like those too 😄
19:03:43FromDiscord<mratsim> That's my hope: https://github.com/nim-lang/RFCs/issues/222
19:03:45disbotCorrect-by-construction Nim programs ; snippet at 12https://play.nim-lang.org/#ix=2lbm
19:04:19FromDiscord<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:33FromDiscord<mratsim> You have dependent types in Nim
19:04:40FromDiscord<mratsim> and monads if you want
19:04:55FromDiscord<mratsim> Monadic construct: https://github.com/unicredit/emmy
19:05:36ZevvMonads. I heard these are some kind of burrito's, right
19:05:39FromDiscord<tiatomee> I'm already happy with range types existing in Nim, I really miss those in Rust
19:05:43FromDiscord<mratsim> And for dependent types: https://github.com/mratsim/constantine/blob/master/constantine/tower_field_extensions/tower_instantiation.nim#L27-L29
19:05:57FromDiscord<mratsim> Curve is an enum corresponding to elliptic curve
19:06:14*Arrrrrrrrrrrrrrr joined #nim
19:06:20FromDiscord<mratsim> and I do bigint precomputation at compile time
19:06:48ArrrrrrrrrrrrrrrFast question: In nimscript I import times and I get "Error: cannot evaluate at compile time: localInstance", does times work in vm?
19:06:57FromDiscord<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:10FromDiscord<tiatomee> performance is a big issue with full dependent types
19:07:14ArrrrrrrrrrrrrrrAlso, any workaround?
19:07:16FromDiscord<tiatomee> and Nim already seems really powerful!
19:07:32FromDiscord<mratsim> Nim compile-time VM is as fast as Python
19:07:42FromDiscord<mratsim> so you can do BigInt in the type system 😉
19:08:54FromDiscord<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:17FromDiscord<mratsim> int or enums can be part of a function type
19:09:25FromDiscord<mratsim> a type "type
19:09:27FromDiscord<mratsim> sorry
19:09:42FromDiscord<mratsim> what do you need for full support of dependent types?
19:10:01FromDiscord<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:21FromDiscord<tiatomee> I'm already happy with what I'm seeing
19:10:22disrupteknah, it's cool.
19:10:24FromDiscord<mratsim> don't worry, it's me who wants to understanding the full need
19:10:45FromDiscord<tiatomee> Sigma types, aka `proc(x: T): computeType(x) = ...`
19:10:50FromDiscord<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:53FromDiscord<tiatomee> where x can be a runtime value
19:11:07FromDiscord<tiatomee> That's not a sigma type
19:11:11FromDiscord<tiatomee> but it's a similar effect
19:11:27FromDiscord<mratsim> oh, so return type overloading?
19:11:37disruptek: auto
19:11:42FromDiscord<tiatomee> a sigma type would be like `proc[T](x: int): (x, array[0..x, T])`
19:11:49disruptekis, i think what they want.
19:11:56FromDiscord<mratsim> auto is a hack :p
19:12:00FromDiscord<Clyybber> yeah, nim's types are compile time only :)
19:12:05FromDiscord<tiatomee> it's like a tuple, but the type of the second member depends on the value of the first member
19:12:14FromDiscord<mratsim> if at compile-time we have that
19:12:16disruptekah, that's just a generic.
19:12:20FromDiscord<tiatomee> also lifting runtime values into the type system and doing proofs with that
19:12:34*blueberrypie joined #nim
19:12:39disruptekmratsim: indeed, but no more so than converters.
19:13:08FromDiscord<mratsim> for proofs there is a plan to integrate Z3, with a PoC https://nim-lang.org/docs/drnim.html
19:13:08FromDiscord<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:16FromDiscord<tiatomee> I saw DrNim, it's super interesting
19:13:30disruptektiatomee: tell me more. this is what i want to do with CPS.
19:13:51disruptekbasically, encode the transition in the type so it doesn't get stored at all.
19:13:54FromDiscord<tiatomee> You mean about run length encoding lists?
19:14:10disruptekno, i'm talking about free continuation dispatch.
19:14:35FromDiscord<tiatomee> I'm not sure what you mean with that
19:14:54FromDiscord<tiatomee> or how that relates to dependent types
19:14:54disrupteki think what you're talking about we already do with statics.
19:15:18FromDiscord<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:36disruptekcps is a boon to your verification problems, btw.
19:15:43disrupteki don't know if we ever talked about that.
19:16:10FromDiscord<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:13FromDiscord<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:28disruptekyeah, we'll be able to do that for you.
19:16:31FromDiscord<mratsim> so that would be my first usecase for CPS
19:16:44FromDiscord<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:49disruptekyep, that's a good one that would be very tough for something like async to beat.
19:17:11FromDiscord<mratsim> this means no dispatcher 😉
19:17:15disruptektiatomee: yeah, we have that.
19:17:22FromGitter<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:22FromGitter... or pointers, ⏎ Helmut [https://gitter.im/nim-lang/Nim?at=5fde51c193af5216fc4fa345]
19:18:09FromDiscord<mratsim> I think there is one in the wiki or the forum
19:18:16Zevvthis is so getting out of hand
19:18:19FromDiscord<mratsim> also check unpackArgs in the macro or sugar module
19:18:39Zevvsomethimes I think I know what this is all about, do fun stuff with continuations. And then this kind of talk happens. dudes.
19:18:52disruptekwut
19:18:57FromDiscord<tiatomee> didn't mean to derail 🙈
19:19:13ZevvI lack the general smarts, no problem, my fault
19:19:13FromDiscord<mratsim> I already told you about this use case for formal verification of concurrent data structure
19:19:19FromDiscord<mratsim> like this morning
19:19:36disruptekshit man, read a wikipedia article once in awhile.
19:19:37FromDiscord<mratsim> ah no it was in the #science channel maybe?
19:19:41*blueberrypie quit (Quit: leaving)
19:19:51FromDiscord<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:15FromDiscord<tiatomee> and at some point it kind of becomes clearer if you don't think about it too hard for too long 😆
19:20:48FromDiscord<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:35disrupteki probably should have saved that typedef of a (-1 or 1) type. i feel like it'd be a good example.
19:23:25FromDiscord<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:19FromDiscord<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:25FromDiscord<Daniel> (edit) "thouhts." => "thoughts."
19:24:42FromDiscord<Daniel> (edit) removed "and"
19:24:55disrupteki think a story came out this week about the different parts of the brain involved in each.
19:25:10disrupteki feel like i saw an article on /r/programming or something.
19:25:21*lum quit (Client Quit)
19:25:47FromDiscord<mratsim> Araq posted it this morning in the channel
19:26:08FromGitter<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:18FromDiscord<mratsim> TLDR: programming is different from both natural language and math/logic in terms of the brain areas it activates.
19:26:55FromDiscord<Daniel> I would say it is more connected to logic than to anything else.
19:27:08*lum joined #nim
19:27:49FromGitter<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:44FromDiscord<mratsim> @Daniel the article mentions that programming also used the creativity part of the brain
19:30:29disruptekhaxscramper: why can't they just use a macro?
19:31:00disruptekand, i wouldn't use term-rewriting macros. they are probably going to change somehow.
19:31:22FromGitter<HJarausch> @haxscramper I'd just like to understand the mechanism. If I un
19:32:48*klaufir_ joined #nim
19:33:23haxscramperdisruptek: because for `myfunc(a, unpack(foo())` `unpack()` must have access to `myfunc` and `a` in order to use them in generated code
19:33:32haxscramperWhich is not possible as they are not passed in arguments
19:33:41disruptekwhere are you reading this code?
19:34:12*Arrrrrrrrrrrrrrr quit (Remote host closed the connection)
19:34:20FromGitter<HJarausch> So, there is no method to change a parameter list before it get parsed by the compiler
19:34:31saemI'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:32disbotSaem nimsuggest re-enable tests
19:34:39disruptekoh i missed that message. 🤣
19:35:04disruptekit could be done with term rewriting, but yeah, don't.
19:35:04FromDiscord<Daniel> @mratsim in a way, its form art 🙂
19:35:10FromGitter<haxscramper> @HJarausch there is no easy-to-use method, yes
19:35:20FromGitter<haxscramper> Without writing `unpack(myfunc(a, foo())` that is
19:35:32*opal quit (Remote host closed the connection)
19:36:17disruptek!repo curry
19:36:18disbothttps://github.com/t8m8/currying -- 9currying: 11Currying Library for Nim 15 38⭐ 4🍴 7& 1 more...
19:36:25FromDiscord<mratsim> maybe you can cook something by tagging `myfunc(a, b: params) {.myTransformermacro.}`
19:36:35*opal joined #nim
19:36:41FromDiscord<mratsim> and you generate whatever you want in the pragma
19:36:52haxscramperI 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:44haxscramperI want to get default generic parameters using constructor proc
19:38:27disrupteki'm pretty sure the compiler doesn't allow custom user pragmas for expressions.
19:38:27haxscramperBut I get 'cannot instantiate' error, while I have specified parameters for `initFunctor`
19:39:02disruptekit would be cool if we could, though. that's a feature i've mentioned using for cps.
19:39:50FromDiscord<Recruit_main707> would that allow the deprecated `unroll` pragma do be applied to for loops again?
19:40:08FromDiscord<mratsim> @haxscramper I think it's semcheck bug
19:40:17FromDiscord<Recruit_main707> (hand written unroll macro that is)
19:40:19FromDiscord<mratsim> default parameters have a couple of issues with generics
19:40:37FromDiscord<mratsim> I tried with default(Functor[T]) and Functor[T]() no dice
19:41:05FromDiscord<mratsim> but I even had issue myself with plain "tolerance = T(0.5)" woth T being SomeFloat
19:42:11FromDiscord<Recruit_main707> you can do this:↵`proc initGen[T; D: Functor[T]](arg: D = initFunctor[T]()): Gen[T, D] = discard`
19:42:58FromDiscord<mratsim> ooohh, someone who is even better than me at working around generics issue as appeared?
19:43:30FromDiscord<mratsim> or no I think D: Functor[T] will not work
19:43:39FromDiscord<mratsim> you need to hide higher-kinded types
19:44:46FromDiscord<haxscramper> This worked, now I probably need to make second overload with single parameter
19:45:09FromDiscord<haxscramper> And this should be actually usable
19:45:17FromDiscord<mratsim> really?
19:45:45FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2IL1 well, in this form
19:45:49FromDiscord<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:00FromDiscord<Recruit_main707> /certain issues/
19:46:25FromDiscord<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:34disruptekclever.
19:46:44disruptekuntil you need to understand why it exists.
19:47:02FromDiscord<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:04disbotFeature request: Generic result type construction from typedesc ; snippet at 12https://play.nim-lang.org/#ix=2IL2
19:48:09FromDiscord<mratsim> and also I couldn't define `proc foo[T: TT: Tensor[T]]`
19:48:22FromDiscord<mratsim> `proc foo[T; TT: Tensor[T]]`
19:48:58FromDiscord<mratsim> this is so huge!
19:49:30disruptekquick, it had better be outlawed.
19:50:16disruptekdid you try to build it with a template?
19:50:50ZevvCan we have macro[T] while we're at it
19:51:00disruptekright.
19:51:29Zevvwe should reversion to 0.0.1
19:51:48disruptekcps?
19:51:53ZevvNim
19:51:58Zevvuntil it's like /done/
19:52:03FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2IL4 although this one does the same basically, but much simpler
19:52:19disruptekeh, i have enough nim to be dangerous.
19:52:35ZevvI lost both of my feet more then once
19:52:48disrupteki'm not too worried about the rest of it.
19:52:48Zevv'safe' my a**
19:53:00disrupteklook at what we did with c macros.
19:53:08FromDiscord<Recruit_main707> it is safe, unless you are unstable
19:53:10disruptekfucking monkeys.
19:53:55Zevv!eval var a: ref int; a[] = 42
19:53:57NimBotTraceback (most recent call last)↵/usercode/in.nim(1) in↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)
19:54:24FromDiscord<Recruit_main707> makes sense to me?
19:54:29disruptekmaybe define your target first.
19:56:22*narimiran quit (Quit: leaving)
19:57:05FromDiscord<mratsim> uninitialized ref that are dereferenced should have a not nil warning
19:57:32disruptekyeah, that guy alex something made the same criticism.
19:57:43disruptekit's not unfair, it's just, like, not a priority for people.
19:57:54FromDiscord<mratsim> I don't use ref objects :p
19:58:01FromDiscord<mratsim> or as little as possible
19:58:25disruptekyeah, but sometimes it's what you want.
19:59:57FromDiscord<Clyybber> type T = ref T
20:00:10FromDiscord<mratsim> that's like my type T = distinct T
20:00:11disruptekglwt
20:00:42disruptekdistinct void seems useful, too.
20:00:43FromDiscord<Clyybber> @mratsim yeah, your bug report inspired me to take on the type g = proc(i: int): g issue
20:01:15PrestigeIs there a shorthand or sugar to have a proc parameter to be optional, and just discard? Instead of redeclaring the signature
20:01:24FromDiscord<mratsim> mmmh, distinct void does have a nic ring to it
20:01:32disruptekright.
20:01:44FromDiscord<mratsim> I'll change my name to that
20:01:48disrupteklol
20:02:08FromDiscord<mratsim> Enjoy!
20:02:10disrupteki think nasa just misplaced a distinct void.
20:02:19disruptekisn't that what i read?
20:02:20FromDiscord<Clyybber> @mratsim it doesn't display on IRC :D
20:02:25FromDiscord<mratsim> argh :/
20:02:47disruptekgah, you put your supermassive black hole down for just /one second/ and.. poof! you never see it again.
20:03:00FromDiscord<mratsim> @Prestige use `foo(a = 1)`
20:03:09FromDiscord<mratsim> you can call foo() or foo(2)
20:03:13FromDiscord<Clyybber> disruptek: T = ref T would be a sideeffect of making P = proc(): P work
20:03:15saemAre 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:34Prestigethis is what I mean https://play.nim-lang.org/#ix=2ILb @mratsim not sure if my explanation was clear
20:03:37FromDiscord<mratsim> My only want is to not use 100%CPU
20:03:41FromDiscord<Clyybber> disruptek: Its just a linked list containing very useful information
20:03:49disruptekyeah, it sounds great.
20:03:53Prestigethe second declaration is something I'd like to be able to do
20:03:58FromDiscord<Clyybber> disruptek: right?
20:04:00FromDiscord<Clyybber> :p
20:04:19FromDiscord<Clyybber> shit way to encode a number
20:04:23FromDiscord<Clyybber> but definitely scalable
20:04:37disruptekthe developer of kitty tried to tell me that my criticism of his infinite loop was somehow unfair.
20:04:40FromDiscord<Clyybber> @mratsim heres your bigint: T = ref T
20:04:52disruptekemphasis on the word /somehow/ ...
20:05:09FromDiscord<Clyybber> disruptek: Do you have a link?
20:05:12FromDiscord<mratsim> @Prestige is that what you want? https://play.nim-lang.org/#ix=2ILd
20:05:28disruptekdisbot should have a link.
20:05:33Prestigeoh you can do that? Very cool
20:06:58saem@mratsim "My only want is to not use 100%CPU" do you mean nimsuggest?
20:07:24Prestige@mratsim but I cannot invoke it like https://play.nim-lang.org/#ix=2ILe ?
20:07:44FromDiscord<mratsim> @saem, yes nimsuggest
20:07:52*lum joined #nim
20:08:02FromDiscord<mratsim> opening Weave is auto 100% CPU usage fromnimsuggest
20:08:10FromDiscord<mratsim> very annoying
20:08:37FromDiscord<nikki> just been not using nimsuggest / nimlsp and it's been mostly ok. def miss "goto def" tho
20:08:59disruptekwhat are you using that doesn't have goto def?
20:09:11saem@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:57FromDiscord<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:12FromDiscord<nikki> gonna just try to remember things and code gud
20:10:13saemmratsim: I've run into plenty of that myself as I worked on porting the TS extension to Nim.
20:10:52FromDiscord<nikki> i do have a build running on an fs watch in a terminal next to my editor which is helpful
20:10:59FromDiscord<mratsim> @Prestige: https://play.nim-lang.org/#ix=2ILf↵echo is a varargs proc hence why it doesn't typematch
20:11:10Prestigelike how this works: https://play.nim-lang.org/#ix=2ILg just hoping there's a shorthand
20:11:32Prestige'h
20:11:38Prestigeah*
20:11:48FromDiscord<mratsim> yes, there is a => shorthand in sugar
20:12:19saemPresently 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:50FromDiscord<mratsim> Pretty sure this should work @Prestige but Nim semcheck is making my life difficult: https://play.nim-lang.org/#ix=2ILi
20:14:53FromDiscord<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:32PrestigeI think what mratsim showed at the function signature for foo should work, trying it now in my code
20:15:36FromDiscord<mratsim> if only i didn't have those gcsafe required annotation ... and => deducing auto types properly
20:17:26Prestigeoh, that's a new one for me - internal error: no environment found
20:17:55saemLooking 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:59Zevvdisruptek: your CPS RFC is getting contaminated and polluted. Do we want to talk about mratsim-level 1, or all levels?
20:22:51PrestigeI think my best option is just https://i.imgur.com/jAtFpII.png (the actual use case in my code)
20:23:25disruptekcps should be the rainbow of concurrency solutions.
20:23:32disruptekall-inclusive, all the time.
20:23:35disruptekdefund the police.
20:24:31FromDiscord<Recruit_main707> you are convincing me, i will have to check it
20:28:02FromDiscord<mratsim> I prefer ponies and unicorns
20:28:09FromDiscord<mratsim> rainbows are overrated
20:28:55FromDiscord<haxscramper> I need to come up with `reactor.nim` for `fusion` so people would `import fusion/reactor`
20:29:25FromDiscord<haxscramper> I determined the name, so now I only have easy part - figuring out what it should do, and implementing this
20:30:22Zevvmaybe make it fission/reactor instead, because that actually _exists_
20:31:59FromDiscord<Recruit_main707> fusion reactor is the one that would generate more energy than the one it consumed?
20:31:59disruptekwell, i'm still trying to figure out how layer 1 can be elegant without refs.
20:32:11disruptekfission.
20:32:12Zevvwhta's the problem, doctor
20:32:20FromDiscord<Recruit_main707> ok
20:32:26Zevvwith the no-refs
20:32:26disrupteki dunno how to do the dispatcher without refs.
20:32:56Zevvyou can use a ref in your dispatcher, right?
20:33:01Zevvjust deref what you pass to the CPS procs
20:33:03disruptekonly thing i can think of is to have a meta-dispatcher.
20:33:43disruptekhow can you use a ref in your dispatcher?
20:33:59Zevv'ref T'
20:34:13disruptekyeah, so what value do i put in it, wise guy.
20:34:16Zevvbut of course I'm just here standing on the side, shouting out to you doing the work
20:34:25disruptekremember that your continuations may be stack-allocated.
20:34:41disruptekbrb moose.
20:34:45Zevvsure. In our implementation, the initial env is allocated by the CPS generated bootstrap, right
20:36:16FromDiscord<mratsim> @haxscramper https://github.com/zielmicha/reactor.nim
20:37:37FromDiscord<tiatomee> What Nim version is required for the `monotimes` module?
20:37:43FromDiscord<tiatomee> I am on 1.0.4 and it doesn't seem to find it
20:37:47FromDiscord<lqdev> i think 1.2
20:37:54FromDiscord<tiatomee> Ahw shoot
20:38:01Zevv1.2. that's oooold
20:38:04FromDiscord<lqdev> why do you use 1.0.4
20:38:17FromDiscord<mratsim> 1.2 is what Status uses ...
20:38:29FromDiscord<tiatomee> It's what's in the Fedora repos and I can't easily download niminstall
20:38:40FromDiscord<tiatomee> because github's aws is suuuuuuper slow for me
20:38:42FromDiscord<mratsim> can you try import "std/monotimes"
20:38:48FromDiscord<mratsim> instead of just monotimes
20:38:52FromDiscord<lqdev> ah yeah
20:38:53FromDiscord<tiatomee> like, 500 bytes/s slow
20:38:55FromDiscord<mratsim> I think this one was namespaced
20:39:03FromDiscord<lqdev> mratsim's right
20:39:04FromDiscord<tiatomee> hah, that works
20:39:06FromDiscord<tiatomee> Thanks!
20:39:12FromDiscord<lqdev> i always use the std/ prefix so never noticed lol
20:41:07disruptekZevv: yeah, it's allocd by the bootstrap i think. but it wouldn't be.
20:41:15Zevvright. So the dispatcher allocs
20:41:22Zevvyour dispatcher can then just new() it
20:41:24Zevvand you have your ref
20:41:37Zevvmy dispatcher can have a global static one or alloc it on the heap
20:41:38disruptekno, you allow any way you normally alloc.
20:41:44disruptekalloc, too.
20:41:46*Q-Master quit (Ping timeout: 256 seconds)
20:41:50disruptekyeah, whatever.
20:41:59Zevvyeah. But if you new() it, you got your ref?
20:42:09disruptekyeah, sure.
20:42:15Zevvso is there a problem?
20:42:21disruptekyeah.
20:42:24Zevvbecause it's either me being stupid, or you
20:42:35Zevvor both, that's also not without precedent
20:42:44disruptekwell, tell me how the dispatch works in a world with more than one continuation type.
20:42:57Zevvyeaah, *thats* a problem, right
20:43:03disruptekright.
20:43:20Zevvtrampoline[T]
20:43:58disruptekno, it's more like dispatch knows how to make dispatch containers which can be refs.
20:44:04Zevvyeah I see now
20:44:28Zevvso, the alternative is that we go pull ptr
20:44:33Zevvmratsim would *love* that
20:44:52disruptekwell, i have another idea but i don't know if it's clean enough.
20:45:08disruptekwhat if the trampoline has two sides -- the stack side and the heap side.
20:45:20disruptekyou can migrate from side to side.
20:45:29Zevvthere's more then stack and heap
20:46:02Zevvthere's static globals. There's nim-doesn-know-where-this-came-from
20:47:10disruptekno, i mean dispatch is generic so you can just move with a copy. (what else?)
20:48:44FromDiscord<mratsim> you type erase
20:48:55FromDiscord<mratsim> proc fn(env: pointer)
20:49:08Zevvlike I said. mratsim would *love* that
20:49:16FromDiscord<mratsim> but then you need to set a env maxsize if you want to stack allocate.
20:49:22Zevvthat makes me sad
20:49:30FromDiscord<mratsim> unless you want to leave dangerously with alloca
20:49:33disruptekeh it's whatever.
20:49:48disruptekbut i think using a pointer may be too big a concession.
20:50:00FromDiscord<mratsim> env maxsize is not really a problem most of the time, big stuff go on the heap anyway
20:50:34FromDiscord<mratsim> how do you type erase without a pointer?
20:50:49FromDiscord<mratsim> ref array[32, byte] doesn't count
20:50:57*habamax quit (Ping timeout: 260 seconds)
20:51:40disruptekhmm, 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:49FromDiscord<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:17disruptekyeah, that's what we're talking about.
20:53:24FromDiscord<mratsim> The unified executor proposal from C++ somehow as a way around that but their syntax is an ergonomic nightmare.
20:53:36disrupteki've been thinking about syntax lately.
20:53:42Zevvtechnically, that should work. but it's a shame.
20:53:44FromDiscord<mratsim> (they mention specifically the need of type erasure in futures-based API)
20:53:45Zevvooh tell me
20:53:49Zevvbecause syntax matters
20:54:00FromDiscord<mratsim> it's the most important thing.
20:54:11disruptekwe've found that it's not that important to copy people.
20:54:39disrupteki'd rather have something sympathetic to the language that is net-net superior for that very reason.
20:54:51FromDiscord<mratsim> we aren't talking about copy here
20:54:58disruptekright.
20:55:02FromDiscord<mratsim> alloc != copy
20:55:18FromDiscord<mratsim> you can copy all you want on any platforms.
20:55:28FromDiscord<mratsim> you can't alloc on embedded or to be multithreading friendly.
20:55:38FromDiscord<mratsim> or at least you need to be very careful
20:55:50FromDiscord<mratsim> and you need to copy the environment anyway.
20:56:24FromDiscord<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:14disruptekyeah, so my point is that the dispatcher may be better as a [P: T or ref T].
20:57:33Zevvright
20:57:36FromDiscord<mratsim> so P: T
20:57:40disruptekyeah.
20:57:44Zevvthat was mratsims earlier idea I think
20:57:50FromDiscord<mratsim> that's a breakthrough 😛
20:58:00*fanta1 quit (Quit: fanta1)
20:58:04ZevvI don't even know why you take the time to interact with us
20:58:14Zevvyour patience is unlimited
20:58:20FromDiscord<mratsim> because it's important
20:58:38ZevvI bet you could do all of this in a morning or two
20:58:52FromDiscord<mratsim> it's true that I'm not advancing much on my article in the mean time
20:58:56FromDiscord<mratsim> not true
20:59:02Zevvthree, then
20:59:17FromDiscord<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:51disruptekwell, i'm not spending /that/ kinda time.
20:59:55ZevvI 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:57FromDiscord<mratsim> And this part is even harder
21:00:11disruptekhow do you figure?
21:00:22Zevvat our age, you can't even afford spending this kind of time
21:00:29disrupteklol
21:00:29FromDiscord<mratsim> With Weave I only need to satisfy myself
21:00:38Zevvhell, at our age, you better not even buy green bananas
21:00:40disruptekeh zevv is easy to satisfy.
21:00:48disruptekhehe
21:01:00disruptekbananas: they fit right, but they're not correct.
21:01:25FromDiscord<mratsim> so questions for you: how do you optimize IO tasks?
21:01:41Zevv"optimize" in what sense
21:02:05ZevvI've done my share of IO over the years, though
21:02:11disruptekthere's no code faster than /no/ code, i always say.
21:02:25FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/789960856448270366/unknown.png
21:02:37disrupteki spend no time on email since they cancelled my address for non-payment.
21:03:06Zevvthat kind of optimizing is outside of CPS
21:03:09Zevvit's your level 3
21:03:11disruptekwow, you wrote a markdown to image converter?
21:03:18disruptekyou're blowin' my mind right now.
21:03:23Zevvyeah its called shiftPrintScreen
21:03:35disruptekgenius.
21:03:53Zevvmratsim: I'm not sure what your question is
21:04:29ZevvI'm pretty excited about io_uring, but that's linux only
21:04:34FromDiscord<mratsim> when people have IO performance problems, what do they do.
21:04:45disruptekswitch to nim.
21:04:54Zevva lot is about syscall overhead. Do that as few as possible
21:04:57FromDiscord<mratsim> apart from using NVMe disk and 10GB connection
21:05:09disrupteknot our problem.
21:05:12Zevvso writev() over write(), epoll() over poll()
21:05:30Zevvand now io_uring is the new valhalla, offering zero-copy ring buffers between kernel and user space
21:05:42FromDiscord<mratsim> IOCP is the same.
21:05:44ZevvI will *so* run the hell out of that when we got this stuff running
21:06:04Zevvit seems that the linux community is now about to move half of all possible syscalls onto io_uring
21:06:12Zevvasync is the new orange
21:06:32Zevvso after decades we'll finally have truly async disk IO
21:06:39Zevvmixing with async network IO
21:07:09FromDiscord<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:22Zevvsure, that's a bad fit
21:07:34Zevvbut I actually can't think of why this would not benefit us with Nim
21:07:45disruptekcan't say i'm disappointed that we can't simply riir.
21:08:07Zevvriin
21:08:09Zevvwe /riin/
21:08:23disruptekmaybe we can get ollie to take over my urine wrapper.
21:08:31disruptekor whatever i called it.
21:09:06FromDiscord<mratsim> Regarding epoll it still requires a syscall no?
21:09:11disruptekyeah.
21:09:45Zevvmutaing the watch list takes one as well
21:09:48Zevvwhich is actually a pain
21:10:15disrupteki can't even remember what my code does.
21:10:32disrupteki just remember that you were pissed it did like 11 calls on a sleep or something.
21:10:47ZevvI know we should reuse ioselectors, and we probably could, but it won't make for the best performance I guess
21:11:00disruptekthere will be plenty of dispatchers.
21:11:06Zevvright.
21:11:09FromDiscord<mratsim> I skimmed into it. It only has one ref object 😉
21:11:09disruptekright.
21:11:23FromDiscord<mratsim> otherwise just copy-paste Rust MIO
21:11:41FromDiscord<mratsim> https://github.com/tokio-rs/mio
21:11:56Zevvapart 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:00Zevvy'olde 10k problem
21:12:04Zevvor is it 100k already
21:13:08FromDiscord<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:16FromDiscord<Clyybber> io uring is a bit like command buffers on modern graphics apis
21:13:19Zevvthere is only so much you can do
21:13:39Zevvin the end, it is making sure the mechanism for telling the kernel what you are waiting for is low overhead
21:14:11Zevvselect(), poll(), epoll(), io_uring()
21:14:15disruptekif you simply read the iouring api you'll intuit anything you need to know.
21:14:24disruptekit's pretty tight.
21:14:40Zevvright. so with the non-uring things you still have the syscall and copy overhead to pump the data
21:14:49disruptekyeah.
21:15:08Zevvbut really, when doing things with TLS for example, the overhead gets small quickly
21:15:37disrupteki know, but i'm attracted to this because it seems like we have a shot at the title.
21:15:51Zevvso 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:05disruptekyeah, it's fast enough.
21:16:21disruptekthis is the problem with a lot of nim.
21:16:41disruptekit's good, maybe it's even better, but it's /not better enough/ and so it's only modest bragging rights.
21:18:16Zevvhow does rust aio work threads?
21:18:28disruptekno idea.
21:18:47Zevvbecause having mratsim on board, _that_ could make the difference, of course
21:18:59Zevvbut there are so many darn smart people in the rust community
21:19:12disrupteki thought it was a similar state machine. i wasn't super impressed.
21:19:17Zevvand we only have, like, three or so
21:19:32disrupteki know, i wish they'd hang out here more often.
21:19:38ZevvI miss them too
21:19:49FromDiscord<Rebel> oh god
21:19:51FromDiscord<Rebel> I heard async
21:19:53FromDiscord<Rebel> disruptek are you ok?
21:20:07disruptekyeah, i stopped bleeding a little while ago.
21:20:15FromDiscord<Rebel> we can talk about async and my problems 😛
21:20:16FromDiscord<Rebel> eventually
21:20:21FromDiscord<Rebel> I'm in Blazor land atm
21:20:23disruptekunlikely.
21:20:26Zevvif it's not surrounded by dots and curlies, it's not {.async.}, is it
21:20:28FromDiscord<Rebel> well I guess
21:20:31disrupteki told you, i gave up on you awhile ago.
21:20:31FromDiscord<Rebel> threading and my problems lol
21:20:35FromDiscord<Rebel> ouch
21:20:41FromDiscord<Rebel> that's ok
21:20:45FromDiscord<Rebel> I'll eat the beef and regain strength
21:20:47disruptek{.color.}
21:21:02FromDiscord<Rebel> get it? Because the next language I'll probably learn is beeflang lol
21:21:03FromDiscord<Rebel> or Dart
21:21:17disruptekdart -- famous red team tongue.
21:24:08FromDiscord<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:44FromDiscord<mratsim> The biggest unknown and most interesting for me is how do they allocate their closures.
21:25:03FromDiscord<mratsim> do they type-erase them? If yes do they use a max size?
21:25:13FromDiscord<Rebel> Also disruptek
21:25:13FromDiscord<mratsim> if not how do they hide that in the scheduler.
21:25:16FromDiscord<Rebel> never give up
21:25:34disruptekwell it says right there that it's 0-alloc.
21:25:44disruptekzero alloc, not alloc0.
21:26:01FromDiscord<mratsim> Rust futures yes, but the scheduler can't be zero alloc.
21:26:12FromDiscord<mratsim> I'm talking about tokio
21:26:27disrupteki don't have it in front of me, but i read it off the mio page, which is basically ioselectors.
21:26:45disruptekor select, anyway.
21:27:02disruptekwhat's our level 1? weave?
21:27:09FromDiscord<mratsim> the system API is "easy" you don't have a choice :p
21:27:12FromDiscord<mratsim> no
21:27:13disrupteki kinda scanned through that part of the convo.
21:27:28FromDiscord<mratsim> Weave and async/await and other scheduler are level 2
21:27:50FromDiscord<mratsim> level 1 is cpsLaunch and cpsSwitchTo
21:28:24disrupteki dunno what that is.
21:28:36FromDiscord<mratsim> Zevv Lua-like CPS
21:28:48FromDiscord<mratsim> imitating coroutines since 1867
21:29:44FromDiscord<mratsim> cpsLaunch launches a suspendable/resumable function (as in will have a continuation)
21:30:05FromDiscord<mratsim> cpsSwitchTo resumes a particular function where it was suspended.
21:30:19disrupteki mean, that's not a thing.
21:30:26FromDiscord<mratsim> not yet
21:30:44FromDiscord<mratsim> but we all need dreams
21:31:06disruptekno, i mean that shit isn't in my dream.
21:31:08FromDiscord<mratsim> a dev routine job is to make it a reality
21:31:11disrupteklol
21:32:21FromDiscord<mratsim> anyway, that stuff make CPS usable for my formal verification of concurrent data structures use case
21:32:29FromDiscord<mratsim> it gives Zevv the Lua coroutines
21:32:51FromDiscord<mratsim> I think it can fit some embedded use cases as well.
21:33:04FromDiscord<mratsim> and a scheduler can work on top of those.
21:33:10disruptekmaybe, but as far as i'm concerned, both those things are the same thing -- and we already have it.
21:33:13FromDiscord<mratsim> scheduler/dispatcher/trampoline
21:40:56*haxscramper quit (Remote host closed the connection)
21:45:12FromDiscord<krisppurg> yardanico, im releasing v1.2.4 soon with replies
21:50:39FromDiscord<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:04disruptekmake your enum index an array.
21:51:42FromDiscord<ajusa> and then have a sequence/array of procs? that seems like it would work 😄
21:54:52FromDiscord<polyjitter> i found nim literally yesterday and i think im already falling in love
21:58:44*Q-Master joined #nim
21:59:13FromDiscord<mratsim> @ajusa let myArray: [MyEnum, proc(){.nimcall.} = [A: proc1, B: proc2]
21:59:35FromDiscord<mratsim> let myArray: [MyEnum, proc(){.nimcall.}] = [A: proc1, B: proc2]
22:00:43FromDiscord<mratsim> using type inference: `let myArray = [A: proc1, B: proc2]`
22:01:13FromDiscord<mratsim> @polyjitter welcome, hopefully it's not past midnight in your location :p
22:01:53disruptekwhy?
22:02:06disruptekit's always past midnight here.
22:02:15*Allin joined #nim
22:02:16disruptekoh.
22:04:11AllinSanity check: anybody out there (10 + years since used irssi)?
22:04:30disruptekyeah.
22:05:22FromDiscord<polyjitter> it is not, it is 5pm here
22:05:27FromDiscord<polyjitter> i am at work though so i shouldnt be on here
22:05:29FromDiscord<polyjitter> whoops :)
22:05:37AllinHee: disruptek: you are the one to told me to join this channel!
22:07:23AllinAllin/Disruptek context: https://github.com/nim-lang/RFCs/issues/295
22:07:25disbotnext steps for CPS ; snippet at 12https://play.nim-lang.org/#ix=2Gti
22:07:42disruptekoh, hey.
22:07:43*natrys quit (Quit: natrys)
22:07:53disruptekchris hayes?
22:08:26AllinAllin = olliNiinivaara
22:09:01FromDiscord<mratsim> You missed bloody jolly discussions about CPS :p
22:09:01superbiaAllin: what does that mean
22:09:01*superbia quit (Quit: WeeChat 2.9)
22:09:03FromDiscord<mratsim> and async
22:09:09disruptekyeah, US political commentator reference.
22:09:56FromDiscord<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:09FromDiscord<ajusa> (edit) "myArray[val.ord]?" => "myArray[val.ord]()?"
22:10:13FromDiscord<mratsim> myArray[A]
22:10:16disruptekyeah. assuming the procs all have the same type.
22:10:30FromDiscord<mratsim> ah yes the parenthesis are needed
22:10:50FromDiscord<mratsim> I'm sure I have code somewhere that does this.
22:11:50FromDiscord<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:09disruptekit takes a special kind of person to hang a dead wolf from the tree in their front yard.
22:13:31disruptekor, that person and their brother. wolves are surprisingly heavy.
22:14:17Allinsuperbia: Allin is https://github.com/olliNiinivaara
22:14:31disrupteki'm just kidding, of course.
22:14:45disrupteki don't have a brother.
22:15:23FromDiscord<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:33disruptekso what platform are you on, allin?
22:17:40Allindisruptek: no idea
22:18:49disruptekwell, how many days ago did you reinstall your OS?
22:19:40FromDiscord<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:21FromDiscord<mratsim> that's because thread is the only way to read asynchronously from stdin
22:20:31disruptekdom is right that the test is engineered to omit the dispatcher. but that's also the point.
22:20:31FromDiscord<mratsim> stdin will block the thread, async or not
22:20:34Allindisruptek: currently VERSION="20.04.1 LTS (Focal Fossa)"
22:20:59disruptekokay, linux, then.
22:23:25FromDiscord<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:14FromDiscord<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:09Allindisruptek: we as clients are just browsers, servers and embedded systems are the targets of CPS/async
22:25:37Allindisruptek: and talking about servers: https://www.top500.org/statistics/details/osfam/1/
22:29:16FromDiscord<ElegantBeef> @shadow. yep it's in devel
22:30:43disruptekallin: 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:40Allindisruptek: 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:00FromDiscord<ElegantBeef> Yea well i was born on the same planet, so take that
22:36:52Allinelegantbeef: if you can cope with Araq, you can cope with Linus
22:50:37FromDiscord<mratsim> lol
23:05:31Allin...oh man, just skimmed through the nim logs on "async", there's more knowledge that I can accommodate...
23:06:29FromDiscord<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:41FromDiscord<mratsim> @Allin sorry :p, that's what happens when i research something.
23:09:09FromDiscord<mratsim> @tiatomee I don't think there is.
23:09:31FromDiscord<mratsim> it's pretty easy to implement though
23:10:00AllinCould it possible to design/imagine the end user API first?
23:10:19FromDiscord<tiatomee> I'm making an iterator for it now, it isn't hard, just as you said :)
23:11:52FromDiscord<tiatomee> Ahw, I can't destructive match on `array[0..N, T]`?
23:12:00AllinI 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:09FromDiscord<tiatomee> I'm trying to do `for [a, b] in window(2, input): ...`
23:12:26FromDiscord<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:02FromDiscord<mratsim> @tiatomee https://play.nim-lang.org/#ix=2IMd
23:14:19disruptekallin: you can just infer that or use an expr pragma.
23:14:22FromDiscord<tiatomee> I have it the same really, now I wonder if I can destruct the array in a loop
23:16:03FromDiscord<shadow.> sickkk
23:17:20FromDiscord<mratsim> @tiatomee the array is automatically destroyed at the end of the scope.
23:17:55Allindisruptek: I'd say that "designed by irc messages" is not enough; you/we need a repo with "hello world"-level examples
23:17:55FromDiscord<tiatomee> I meant a destructive assignment, something like `let [a, b] = elems`
23:18:07FromDiscord<tiatomee> which would bind `a` to `elems[0]` and `b` to `elems[1]`
23:18:31FromDiscord<mratsim> it works for tuples but not arrays
23:18:49FromDiscord<mratsim> for tuples you can to let (a, b) = elems
23:19:27FromDiscord<tiatomee> Ah, so for arrays that doesn't work, good to know
23:20:33FromDiscord<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:44FromDiscord<mratsim> @Zevv @Araq ^ very relevant to CPS
23:22:09FromDiscord<mratsim> going to sleep now
23:22:44FromDiscord<mratsim> @Allin if you can review the section about optimizing for IO I'd appreciate it.
23:23:02Allindisruptek: Maybe there's a fundamental discrepancy between ergonomy and performance that NO programming language can solve...
23:24:33FromDiscord<mratsim> I like Kotlin suspend as a primitive and building async/await semantics on top.
23:24:41FromDiscord<mratsim> anyway, see you tomorrow
23:25:03AllinGoing to sleep also, to gather some energy to read that...
23:25:17FromDiscord<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:40FromDiscord<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:50AllinI'll see colors in my dream
23:26:00FromDiscord<mratsim> and the reason it has coloring is because it does "continuation-stealing", as in any thread can resume any continuation
23:26:24FromDiscord<mratsim> if only the launching thread can resume a continuation, you don't have coloring problem (or i think so)
23:27:07FromDiscord<mratsim> good night
23:27:12AllinAS I see it, all I/O should be done in one dedicated thread...
23:27:48FromDiscord<mratsim> but we don't want 2 standard libraries, one with async and one without, though that can be solved with macros
23:28:45AllinExactly! but disruptek had a solution, anyway bonne nuit
23:28:50Allinstop
23:28:53Allinexit
23:29:50Allinpart
23:29:52*Allin left #nim (#nim)
23:40:23*Vladar quit (Quit: Leaving)
23:40:36FromDiscord<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:37disbotCompleting the Nim async/await implementation
23:44:26FromDiscord<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:29FromDiscord<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:35FromDiscord<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:59FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2IMn
23:46:49FromDiscord<shadow.> the resulting regex is invalid i think
23:54:40*krux02 quit (Remote host closed the connection)
23:58:58FromDiscord<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:02FromDiscord<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:23FromDiscord<dom96> @polyjitter yep, unicode not case insensitive
23:59:44FromDiscord<polyjitter> thats disappointing