00:10:12FromDiscord<byt3bl33d3r> Stupid question that i've still not figured out, what's the simplest way of turning a char array into a string in nim?
00:12:13*lritter quit (Ping timeout: 264 seconds)
00:13:16FromDiscord<Zachary Carter> @byt3bl33d3r a sequence of characters or a C char array?
00:13:21FromDiscord<Zachary Carter> or a Nim array?
00:15:26FromDiscord<Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2LHN
00:15:45FromDiscord<Zachary Carter> but I don't really know what you're trying to do either so...
00:16:56FromDiscord<shadow.> for a `seq[char]` `import strutils; seq.join("")` could work but idk how efficient that is
00:17:11FromDiscord<shadow.> and for a cstring you can just use stringify operator iirc
00:19:26*u0_a216 joined #nim
00:19:30miprihttps://play.nim-lang.org/#ix=2LHQ , https://play.nim-lang.org/#ix=2LHT
00:25:59*u0_a216 quit (Read error: Connection reset by peer)
00:26:29*u0_a216 joined #nim
00:35:36*u0_a216 quit (Read error: Connection reset by peer)
00:36:19*u0_a216 joined #nim
00:39:01*muffindrake quit (Quit: muffindrake)
00:45:40*u0_a216 quit (Ping timeout: 246 seconds)
00:45:59*muffindrake joined #nim
00:53:44*oddp quit (Quit: quit)
00:56:14*u0_a216 joined #nim
01:04:34*u0_a216 quit (Ping timeout: 246 seconds)
01:11:29*u0_a216 joined #nim
01:15:26*PMunch quit (Quit: leaving)
01:23:16FromDiscord<Daniel> Seems there is no other book, altho text, like from Dr. Stefan Salewski is rather good for total beginners.
01:23:35*Tanger joined #nim
01:25:55*u0_a216 quit (Ping timeout: 246 seconds)
01:30:02*u0_a216 joined #nim
01:33:02*D_ joined #nim
01:36:36*u0_a216 quit (Ping timeout: 240 seconds)
01:41:33*grfork joined #nim
01:41:58*abm quit (Read error: Connection reset by peer)
01:44:01*greenfork quit (Ping timeout: 264 seconds)
02:17:05*xet7 quit (Ping timeout: 240 seconds)
02:31:13*xet7 joined #nim
02:32:38FromDiscord<ElegantBeef> @tomck i've cleaned it up a bit and made it more of a proper nimble package, so hopefully it's more usable, if you run into any issues feel free to spam me
02:39:56TangerHey folks, I want to write a language parser for a custom lispish DSL. I can access all available commands at compile time and run them against some static rules, but I wanted to do something like put together a pegs grammar file and validate each expression against a pegs definition
02:40:52TangerI'm not sure if this is even use the way to use pegs, but it seemed like it might be possible to do something like generate a peg definition file at compile time and use that for runtime validation
02:41:04disruptek!repo npeg
02:41:05disbot12https://github.com/zevv/npeg -- 9npeg: 11PEGs for Nim, another take 15 149โญ 7๐Ÿด
02:41:22leorize[m]can npeg generate pegs files?
02:41:50disruptekno, but you can compose grammers for npeg.
02:41:58disruptekat compile-time, i mean.
02:42:12disruptekgrammars, too.
02:42:57leorizeI think Tanger wants to generate pegs file as spec for their language
02:44:36disruptek"I want to write a language parser"
02:45:01disrupteknpeg will do this thing. and it works at compile-time, runtime, even on js.
02:45:03disruptekgo nuts.
02:45:11TangerEven on js?
02:45:15TangerGet out of town
02:45:22disruptekSHUT THE FRONT DOOR
02:45:23disruptekyes, js.
02:45:33leorize[m]npeg is magic, literally
02:45:53leorize[m]it even tells you exactly what's wrong with your grammar
02:46:25TangerWell, the end goal was to write an auto-completing/formatting textarea in js and validate it against a language parsing server
02:46:29TangerBut this skips the middle man
02:46:39TangerI'm pumped with optimism now, thanks guys!
02:46:44leorize[m]npeg is better at errors than the compiler the last time I checked
02:47:02leorize[m]have fun :)
02:51:11*xet7 quit (Quit: Leaving)
03:02:16FromDiscord<Varriount> <3 NPeg
03:03:05FromDiscord<Varriount> mratsim: It seems to me that continuation passing is similar to Windows's Fibers API
03:03:15disruptekit's not.
03:22:02*muffindrake quit (Ping timeout: 246 seconds)
03:24:12*muffindrake joined #nim
03:26:20*u0_a216 joined #nim
03:34:05*sagax joined #nim
03:35:42*D_ quit (Quit: ๐Ÿ’จ)
03:36:16*D_ joined #nim
03:36:55*u0_a216 quit (Ping timeout: 265 seconds)
03:37:57leorizedo we perform overflow checks for uint in nim?
03:38:11leorize!eval var a = high uint; a += 1; echo a
03:38:21leorizeappears not
03:38:29disrupteklongstanding problem.
03:41:24*grfork is now known as greenfork
03:45:11*u0_a216 joined #nim
03:52:35FromDiscord<byt3bl33d3r> @Zachary Carter a C char array
03:53:04FromDiscord<byt3bl33d3r> Yeah thats exactly what i've been doing
03:53:47FromDiscord<byt3bl33d3r> I thought there would have been a better way like a built in method on array objects
03:55:08FromDiscord<byt3bl33d3r> Oh! thanks mipri for the examples!
03:55:34*u0_a216 quit (Ping timeout: 256 seconds)
03:57:22FromDiscord<flywind> I don't think there is a built-in method, but you could use `copyMem`
03:57:31saemI was all like I wonder what cool convos I missed out on today while working... then I caught up... now I feel less bad about work.
03:57:38FromDiscord<flywind> sent a code paste, see https://play.nim-lang.org/#ix=2LJ4
03:58:23saemam I wrong?
04:00:15disruptekyou have to go easy on dom; he is but a child, only a few years older than clyybber.
04:06:19saemI mean, I walked away with, gram seems cool
04:06:19saemAlso, folks want to say build me x according to some build of materials, and for all the things they don't specify the compiler either makes some guesses or barfs. But exactly how they do that is _very_ important.
04:06:52*Gustavo6046 quit (Ping timeout: 260 seconds)
04:08:36disruptekwell, easy comments first: gram is very simple by design; it's for when you just need some graph-y structures. it's not designed to be fast, and someone is writing a proper graph database in nim that will have all the bells and whistles.
04:09:08disrupteki just wanted a way to do quick hacks because doing this shit by hand every time is a pita.
04:09:42disruptekthe problem with nim's configuration is really deep-seated. i really think it's going to take a long time to fix.
04:11:39*sagax quit (Quit: Konversation terminated!)
04:11:45disruptek!last gyllou
04:11:46disbot9Gyllou spoke in 12#nim 73 weeks ago 12https://irclogs.nim-lang.org/17-12-2020.html#13:23:36
04:11:55disruptek^ doing the graph lib.
04:14:42*a_chou joined #nim
04:22:09FromDiscord<byt3bl33d3r> ah ok so i have a `array[0..259, WCHAR]`
04:23:03*a_chou quit (Quit: a_chou)
04:23:15FromDiscord<byt3bl33d3r> `$cast[cstring](myarray[0].unsafeAddr)` in this case won't work to turn it into a string it seems
04:26:38saemI think a package needs a config and that shouldn't be nimble, but something smaller. Nim does the building. Package and project shouldn't get conflated up, project is a precise definition to build something. And none of those things should be the unit of distribution when it comes to thing you download from the internet that people call packages.
04:26:53*sagax joined #nim
04:28:16saemA cohesive collection of module and/or an not yet complied program aren't packages, they're a distribution of stuff.
04:28:39saemBut that might be decomposing things far too much for some folks
04:29:33saemThe fact that some nimble "packages" are programs, while others are libraries is silly.
04:29:40disruptekwe currently version .nimble files, of which only one exists per directory.
04:29:56disruptekergo, the unit of measure for a versioned component (package?) is a directory.
04:31:25saemExcept a natural namespace problem, wherein the a fully qualified name is needed and two versions can't exist at once because they're hogging the same folder
04:32:01disruptekit's not a problem, because two versions cannot occupy the same folder at the same time.
04:32:23disruptekor, if they can, more power to you.
04:33:39saemThen the multiple versions of the same thing folks get a bit sadder, but it's not an impossible thing to solve
04:35:12disruptekno, but it's another case of a problem where if you can't solve it 100%, then please... don't even try.
04:35:46saemI think we're thinking the same way with a different tact about the meta aspects of this.
04:36:08saemDecompose the thing into it's actual primitive parts...
04:36:13saemFigure those out
04:36:59saemThen in order to make a cohesive system wide solution combine them and clearly describe the new things that arise from interactions
04:37:13saemKeep merging up until it's a cohesive thing
04:38:04disruptekyou make it sound complex.
04:38:51saemI'm not against a nimble, npm, cargo, whatever where it does the thing and you don't have to learn all these separate things at once, but the difference between it working well and not is very hard to describe... apenwarr's system design explains the world type thing.
04:40:22disruptekseems like it's worth reading.
04:40:46saemI do don't I? I'm sure Hickey is somewhere really mad right now and inexplicably muttering "just use clojure"
04:41:00saemI'll link shortly, dinner
04:41:01disruptekwell, he's not wrong. ๐Ÿ˜‰
04:41:24disrupteki'm reading it now.
04:43:42*vicfred quit (Quit: Leaving)
04:49:50saemHis giant treatise on bugs etc is pretty amazing, but he's a Deming fan
04:53:18disruptek"Disruption" is an exciting word, everybody wants to do it!
04:53:23disruptekahh, if only he knew.
05:00:17*u0_a216 joined #nim
05:04:16*Gustavo6046 joined #nim
05:04:24*Gustavo6046 quit (Remote host closed the connection)
05:04:59*Gustavo6046 joined #nim
05:06:49*u0_a216 quit (Ping timeout: 264 seconds)
05:07:52FromDiscord<apollo> could someone care to explain to me how proc works
05:08:07FromDiscord<apollo> i've been trying to use my previous programming knowledge to understand it but the tutorials are kinda out of my scope
05:08:22FromDiscord<apollo> i dont understand does proc have an automatic return value or how does it work?
05:10:15disruptekwhat did you code in before?
05:10:18disruptekproc is like bash's function.
05:10:41disruptekyou specify the return value.
05:10:41FromDiscord<apollo> https://play.nim-lang.org/#ix=2LJl
05:10:49FromDiscord<apollo> basic code is what im testing
05:11:13disruptekwhat do you think that code does?
05:11:32*u0_a216 joined #nim
05:12:14FromDiscord<apollo> i was just testing how the proc works so i was just trying random stuff
05:12:39FromDiscord<apollo> https://play.nim-lang.org/#ix=2LJn
05:12:43disruptekscience is best conducted with hypotheses.
05:12:45FromDiscord<apollo> could you check this one please/
05:12:52FromDiscord<apollo> agreed
05:14:36FromDiscord<Rika> @apollo check what in the second code?
05:14:50FromDiscord<apollo> it works but i want to know why?
05:15:06FromDiscord<Rika> because you set the return type to be int
05:15:12FromDiscord<apollo> if i call a function that has an echo in it i still have to specify echo when trying to print it on the scren
05:15:17FromDiscord<apollo> (edit) "scren" => "screen"
05:15:24FromDiscord<apollo> and why does a 0 show at the end..
05:15:25FromDiscord<Rika> and by default, the return is 0, unless you return something else or change the value in `result`
05:15:46FromDiscord<Rika> you dont need to specify echo when it has no return value
05:16:12FromDiscord<Rika> https://play.nim-lang.org/#ix=2LJo
05:17:03FromDiscord<apollo> i see but when it does have a return value i have to?
05:17:31FromDiscord<Rika> you have to use the return value, aka set it to a variable, echo it, whatever
05:18:06FromDiscord<Rika> just cannot implicitly do nothing with it, explicit is possible with `discart myFunc()`
05:18:07FromDiscord<apollo> hmm thanks for the help i'll practice more till i get it
05:18:09FromDiscord<Rika> (edit) "`discart" => "`discard"
05:18:41FromDiscord<Rika> why? because a lot of bugs happen when implicitly discarding values
05:19:37FromDiscord<apollo> i see
05:23:22*u0_a2161 joined #nim
05:23:23*u0_a216 quit (Read error: Connection reset by peer)
05:31:34FromDiscord<ElegantBeef> Depending on what you're doing you can use the `discardable` pragma to make it so you do not need to manuall discard the proc
05:39:13*u0_a2161 quit (Ping timeout: 264 seconds)
05:40:58disruptekplease don't use discardable unless you really understand its risk.
05:42:44saemThe only time I've used it is when dealing with non-Nim APIs and it's JS so they of course are super sloppy about return types and all that... reinforcing the sentiment, discardable is a smell.
05:43:52disrupteki'm using it in gitnim for running a process where i often don't care about the output; a failure of the process is a failure of the program. but, seriously, i almost never use it.
05:44:06disruptekdo as i say, not as i do.
05:44:28*u0_a2161 joined #nim
05:45:37saemI've had a long enough career to have had more than enough bugs from forgetting to deal use a return value (or handle errors), having to explicitly discard is very nice.
05:45:53disruptekyeah, it's great.
05:46:01disruptekalso exhaustive case.
05:47:04saemi do wish Nim had more of a culture of Result/Try so errors had to be more explicitly handled, but not dumb like checked exceptions.
05:47:13disruptek!repo badresults
05:47:13disbot12https://github.com/disruptek/badresults -- 9badresults: 11a less fascist fork of nim-result 15 1โญ 0๐Ÿด
05:47:32disrupteksee the `:=` template.
05:53:30saemwhat now?
05:55:03disruptekit's a way to use results that promotes error handling.
05:55:56saemWhere is that template defined I couldnt' find it in stdlib or the repo... (I might be having a moment)
05:56:19disrupteksorry, i'm dumb.
05:56:33disruptekthe template is from gittyup. i haven't put it in badresults yet i guess.
05:56:35disruptek!repo gittyup
05:56:35saemthank you, i feel less bad now
05:56:36disbot12https://github.com/disruptek/gittyup -- 9gittyup: 11higher-level libgit2 bindings that build upon nimgit2 15 6โญ 1๐Ÿด
05:57:41disruptekit's a lil messy because i wrote most of this before i had figured out which bits i wanted to use.
05:57:56saemonly the good ones obviously
05:59:00disruptekit's actually a really nice library.
05:59:01saemugh... I need to stop talking to my buddy bastard keeps filling my head with all sorts of PL ideas.
05:59:54saemoh yeah... well your review goes against ethics in game journalism.
06:00:07disruptekfair, fair.
06:00:10*adnan338 joined #nim
06:00:19*adnan338 quit (Client Quit)
06:00:31*adnan338 joined #nim
06:01:10saemyour life will be better if you read "popped" as "pooped"
06:01:32disruptekmaybe i should just s/pop/poop/ before i push each gitnim release.
06:02:20saemI'm all for more butt jokes.
06:02:29disruptekright? life is too short.
06:17:33saemI need to stop staring at this CPS code.
06:18:16disruptekit has cost me more than a few sleepless nights.
06:18:58disruptekmy continuations-in-the-cloud project is a bit of a mind-fuck.
06:19:30saemYeah, because like a jerk you decided that liveness problems weren't hard enough.
06:19:55disrupteki don't know what they are, so it helps.
06:20:04saemIgnorance is bliss
06:20:35disruptekbut seriously, csp isn't all that difficult once you have cps rockin'.
06:21:27saemI'm referencing program correctness, specifically whether a computation will return an answer at all and when-ish vs whether it's correct or not. In distributed systems land, this all got restated as the CAP theorem, but no one really realized it until later.
06:21:33FromDiscord<ryanford> hey all, how well does Nim in Action reflect the currect state of Nim?
06:21:39saemAnd FLP is basically the halting problem.
06:21:51disruptekryanford: care has been taken to keep it working correctly.
06:21:57FromDiscord<Rika> i believe theres a page for errata
06:22:00FromDiscord<Rika> but i dont remember where
06:22:01FromDiscord<ryanford> nice, thank you
06:22:06disruptekit's not bad, is the point.
06:22:16disrupteksaem: yes, but liveness is not hard.
06:22:26FromDiscord<Rika> i mean, the errata page would make it better since it "updates the book"
06:22:27saemdisruptek: looooool
06:23:32saemIt's like the one thing that generation after generation of computer scientists have looked past because so many never bothered understanding the halting problem itself and how weak of an assertion it really is. Wherein the vast majority of research in program correctness, the most pervasive of which being type systems basically ignore it.
06:23:38disrupteki mean, i'm pretty relaxed about it.
06:25:34*narimiran joined #nim
06:25:40saemI mean I stop caring about type systems pretty fast after sum, product, and parameterized types. I'd like rows, but that seems to be greedy. Any how, after those first three I'd much rather see something better than totality.
06:25:41*opal quit (Read error: Connection reset by peer)
06:25:58*opal joined #nim
06:28:08saemIt'd probably just make it easier when I can finally stop having to explain to folks that at scale the network is the enemy, disks are marginally better than dev null, and computer catch on fire every time you blink.
06:28:20*habamax joined #nim
06:28:31disruptekwell, yeah, but so what, is the thing.
06:28:44disruptekyou shouldn't be trusting computers in any event; they will only let you down.
06:28:56disrupteki can't see why you couldn't do rows with concepts.
06:29:46saemDo concepts preserve type information after? I think the way nim does generics it does.
06:30:12*u0_a2161 quit (Ping timeout: 272 seconds)
06:30:36disruptekyes. what i'm curious about is whether we cannot simply use types to model our rendezvous. it might be a bridge too far, but we could completely unwrap the continuation so it's just data.
06:31:30saemFuck, I need to load some vocabulary in my brain, gimmie a sec gotta remember what a rendezvous is exactly
06:31:32disruptekthe code part of the thing is static in any event, right? so what are we really talking about, here?
06:31:58disruptekit's when two processes trade fluids.
06:32:09disrupteker, when two processes synchronize.
06:32:57saemthat's under a state machine mode of a process, yes?
06:33:11disruptek"process" can be practically anything.
06:33:34disruptekwe're just talking algebra at this point.
06:33:44saemYeah, I mean this could be shapes and layouts, yes?
06:33:53saemLike stupid abstract.
06:34:06disruptekbut it's like this, what do you write down on the page?
06:34:23disruptekjust the data, not the interaction.
06:34:49disruptekwe already know how the data is going to interact at compile-time -- why do we need to express that at runtime?
06:34:54disruptekor carry it around with us.
06:35:09saemthis smells like session types and I'm thinking you can use types to model it but the definition of the rendezvous needs to be closed -- as in it needs to be defined in some reasonably enumerable number of steps.
06:35:32saemwhat I mean here is not types in general, but types as in what Nim has at its disposal
06:36:43saemOnly reason would be if you want to defer a decision to runtime (and here come those flooding thoughts about PL design, that fucker).
06:37:09disruptekbut what decision could you possibly not know statically?
06:37:49disruptekyou can't have an interaction that you haven't coded ahead of time. ๐Ÿคฃ
06:38:31saemSo as you accept more user input you eventually get to a point where you're effectively going more and more towards an interpreter.
06:39:07disruptekmakes sense.
06:39:09saemSo if whatever you build is all in static land, that's great, but lifting it into something a programmer can reuse again isn't going to be a thing.
06:39:29saemI mean, that can be outside the scope the design, but it's a thing.
06:39:34*waleee-cl quit (Quit: Connection closed for inactivity)
06:39:55*mbomba joined #nim
06:40:02saemUgh... I'm thinking Futumura projections at this time of night, this is going to go so well.
06:41:45disrupteki guess you don't lose the static analysis as long as you you're careful, but i doubt this is really a concern for nim's csp impl.
06:43:18saemhmm, maybe this isn't a big deal. If everything that CPS does is basically a very thin/narrow interface of macros/templates. Then that's just the surface, the rest of the code is regular code which _could_ technical run in non-macro land, it does because that's basically the VM, so as long as someone who wants to delay a decision either does the heavy lifting or lives with that part not being accounted for it's ok
06:43:20disrupteki'm probably wrong about the scale of growth, though. just too many possible interactions.
06:43:36saemWell that's the thing I was trying to state about it being closed.
06:44:17disrupteki mean, we don't want state machines with billions of states.
06:44:24saemIt's like natural numbers the expression itself is closed, 0 plus a successor, but definition is not.
06:45:02disruptekwe already have a growth problem that we need to fix, perhaps even before cps enters production.
06:45:02*krux02 joined #nim
06:45:18disrupteki think araq has some plans to solve it, though.
06:45:19saemWhat's that?
06:45:39disruptekjust with folding generics.
06:46:35disruptekthe compiler should scrunch them down into the minimal ast via i dunno what, a jit typeclass or something.
06:46:52disruptekor maybe it's even simpler.
06:47:36disrupteki mean, it's not like this has to be re-rendered as nim per se.
06:47:56disruptekokay, gitnim works with dist now. for some value of "works."
06:48:32leorizedisruptek: does your testes not signal error for arc failures? https://github.com/alaviss/nim-sys/runs/1686305486?check_suite_focus=true#step:6:68
06:48:33disruptektakes 5.4mins for me to setup a new nim branch on my shit-ass-pet-fuckers adsl.
06:48:48disruptekleorize: it no longer does, no, because arc failures are too common.
06:49:33leorizeweird, I could not reproduce whatever is shown here
06:49:45leorizeprobably because my testes is older than the CI
06:49:47disruptekthat has been my experience of late, also.
06:50:07saemI mean having a type system (read bunch of if statements + errors) that's in the CPS implementation for CPS is a thing, in which case you don't need to worry too much about what Nim supports or doesn't.
06:50:37saemI'm guessing that's what mratsim was alluding towards
06:50:54FromDiscord<mratsim> mmmmh?
06:51:00FromDiscord<mratsim> You woke up the slumbering beast
06:51:05disruptekoh shoot.
06:51:50FromDiscord<mratsim> I assume by "growth" and "millions of state" you mean compiler generated code for generics and concepts?
06:52:27disruptekno, unique interactions between processes.
06:52:44saemtime to get the Jaeger
06:52:47disrupteka static value per each rendezvous.
06:53:14FromDiscord<mratsim> Well Erlang could deal with that in the 90
06:53:23FromDiscord<mratsim> though static is maybe overkill
06:53:32saemIt never could statically.
06:56:03*opal quit (Ping timeout: 272 seconds)
06:56:22saemfuck... now I remember why I hate type theory papers.
06:57:18disruptekdat url
06:57:29FromDiscord<mratsim> seems OK until chapter 2.1
06:57:35saemchill, I'm just rickrolling you.
06:58:32saemYeah... man I wish I had access to a printer again. I need to be able to print these things and write all over them only way that stuff really lands.
06:58:46FromDiscord<mratsim> Look at this multithreading paper, after chapter 4.4: https://fzn.fr/readings/ppopp13.pdf
06:59:05FromDiscord<mratsim> well even 4.1
06:59:06saemsooooo close to poop, they failed
06:59:47disruptekit's really a pita to even write these expressions.
06:59:53saemat least they have the decency to make a table unlike most who just litter that shit all over prose
07:00:03FromDiscord<mratsim> (i'm waiting for the "data-race free" borrow-checker that apparently handles all that for the programmer.
07:00:20saemYou're holding your breath too, right?
07:00:21FromDiscord<mratsim> Looking at you Rust and your false promises.
07:01:03disrupteki just wanna know what they typeset in.
07:01:22saemLatex because "tradition" paying your dues, etc...
07:01:54FromDiscord<mratsim> not holding my breath, I'm actually writing a model checker to formally verify concurrent data structure: https://github.com/mratsim/weave/pull/127/files
07:01:56disbotโžฅ 3[WIP] Thread Collider: Race detection / Formal Verification of Nim concurrent programs ; snippet at 12https://play.nim-lang.org/#ix=2IwE
07:01:56saemI mean Pony did it, but they took on a GC and they are more precise about their various borrowing/lending and life time flags.
07:02:40saemI've checked out weave and I think synthesis is pretty skookum
07:02:51FromDiscord<mratsim> but I need coroutines or continuations, and they need to be very very very low-overhead, to simulate threads that I can suspend and resume at will.
07:03:43FromDiscord<mratsim> bonus point if I can multi-thread those because verifying aven a simple queue system takes 10min in multithreaded Java formal verif tool
07:03:51FromDiscord<mratsim> (TLA+ from the same author as latex)
07:04:23FromDiscord<mratsim> 10min on a 18 cores machine, overclocked
07:04:28saemI mean if you're basically rendering out functions they're near free outside of any state they have to snapshot and calls you can't coalesce/inline. The rest is micro-batching of data, but it feels like there isn't enough information to hazard that.
07:05:21FromDiscord<mratsim> I think you lost me
07:05:32disruptekskookum, heh
07:07:00saemAs in the overhead of CPS, given the current approach y'all seem to be taking, are basically render out a bunch of functions + snapshot any state because people be mutating. If all that code that got barfed out during that elaboration is relatively straightforward fort he compiler to inline then that's tonnes of overhead gone
07:07:02*opal joined #nim
07:07:51disruptekyes but if he wants his 1ns switch, it cannot be done with just compiler wizardry.
07:07:55saemThe rest is the snapshot and the dispatcher itself, the latter which _may_ get in the way of inlining
07:07:57FromDiscord<mratsim> as it turns out, I've mention the two codegen we can take here: https://github.com/weavers-guild/weave-io/tree/master/implementation#the-cps-transform
07:08:12FromDiscord<mratsim> either we gnerate a state machine or a bunch of function
07:08:29disruptekif cond1: callback1(env) else: callback1(env)
07:08:33disruptek2nd one needs a 2.
07:08:36*mbomba quit (Quit: WeeChat 3.0)
07:08:54FromDiscord<mratsim> The C++ CoroutineTS designers and LLVM compiler devs looked at it, and figured out that functions are easier to optimize and fold and transformation into state machine should be done as late as possible
07:09:30saemThat makes sense, give all the hours poured into the former
07:09:31disruptekanother reason not to worry too much about the cps papers.
07:10:01saemoutside of the ones that tease apart the nuances and show the various trade-offs of different algebras?
07:10:17FromDiscord<mratsim> sent a long message, see https://paste.rs/a1h
07:10:40FromDiscord<mratsim> you have the slides and the talk
07:10:55saemI like how chrome is all like, translate from Norwegian?
07:11:24FromDiscord<mratsim> And with functions and stack coroutine this is what C++ is able to do with LLVM (not MSVC or GCC yet): https://godbolt.org/g/26viuZ
07:11:36FromDiscord<mratsim> constant fold across 3 iterators
07:12:37saemalso fuck reading C++, content warning that shit next time. ;)
07:12:50disrupteklol so tame.
07:13:17saemI made some minor patches to LLVM a long time ago and that's enough C++ for me.
07:14:08FromDiscord<mratsim> I wrapped a C++ library last week
07:14:16saemI'm sorry, are you OK?
07:14:34disruptekthat code is pretty cute, actually.
07:15:08disruptekbut also, no, nim will be quite a bit nicer.
07:15:23FromDiscord<mratsim> warning, dangerous content ahead: https://media.discordapp.net/attachments/371759389889003532/798450029346029608/unknown.png
07:15:27saemI get disruptek's point though, the llvm magic + state machine magic to wring out the last bits, means that's all in translation land. So the algebra is the "IR" here which needs to be nailed.
07:15:30saemHahaha, thanks
07:16:13FromDiscord<mratsim> I've spelled the LLVM API out, but I think this is a stretch goal
07:16:28FromDiscord<mratsim> they are working with both C++ and Swft to stabilize their coroutine API
07:16:32saemDoes that arrow point to where the bad code hurt you?
07:16:48FromDiscord<mratsim> I'll be fine with 5ns coroutines for the time being ๐Ÿ˜‰
07:17:09FromDiscord<mratsim> No it's the type I need to translate properly into C++
07:17:23FromDiscord<mratsim> or get properly from C++
07:17:37saemYeah, i was gonna ask, thought you were consuming here
07:18:12FromDiscord<mratsim> I do both, I have proc that accept typedescs and generate the corresponding C++ type
07:18:41FromDiscord<mratsim> I need to get the type right because you can't cheat with "auto" in Nim ๐Ÿ˜‰
07:18:52FromDiscord<mratsim> in the C++ codegen at least.
07:19:15disruptekyour text about the storage makes sense to me, mratsim.
07:19:43FromDiscord<mratsim> That was what we agreed on 3 weeks ago, just spelled out.
07:19:55disrupteki'm just not sure that our continuations are one-shot and can overwrite the storage, etc.
07:20:30FromDiscord<mratsim> one-shot means foo.resume() and afterwards foo has been replaced or destroyed, and you cannot copy foo, only move.
07:21:16FromDiscord<mratsim> the mutant continuations are one-shot for sure, the non-mutant are one-shot unless the user copy the continuation and use it multiple times
07:21:47disruptekyes. i just don't want to give that up and i don't understand why i hafta.
07:22:57FromDiscord<mratsim> Well, I've tried to give all the rational justifications and I'm bad at emotional reason over Discord so shrug :p
07:23:19saemThat's if you want to "compose" handlers that voltron into a dispatcher?
07:23:20disruptekwhere are the rational justifications?
07:23:31FromDiscord<mratsim> we can allow that for trivial types, those without ref or destructors.
07:23:52*u0_a2161 joined #nim
07:26:55FromDiscord<mratsim> This is the short summary: if you allow that for continuations that contains `free(foo)` you have the "enter the room once and exit twice" problem, you construct the object once but somehow by copying the continuation you can run `free(foo)` twice http://okmij.org/ftp/continuations/against-callcc.html#dynamic_wind
07:27:27FromDiscord<mratsim> So Scheme has a complex thing called dynamic-wind to handle that
07:27:54FromDiscord<mratsim> that's the first part. Now the second part fo the argument is that in a decade they didn't find any use-case for this feature.
07:28:13FromDiscord<mratsim> It complexify the memory management and the language but doesn't seem to bring benefit.
07:29:26FromDiscord<mratsim> so what we can do `proc =copy[T: not supportsCopyMem](dst: var Continuation[T], src: Continuation[T]){.error: "non-trivial continuation cannot be copied".} `
07:30:05FromDiscord<mratsim> and even so, that doesn't solves the problem of continuations that have a raw "free(pointer)" inside.
07:30:05disruptekhow is it that we would ever have a finalizer run on read-only input?
07:30:21disruptekhow could they exist, though?
07:30:29disruptekwe're talking about strictFuncs.
07:31:09FromDiscord<mratsim> Are Sockets or Database handle var in strictfunct?
07:31:16disruptekof course.
07:31:32FromDiscord<mratsim> https://nim-lang.org/docs/nativesockets.html#close%2CSocketHandle
07:31:44FromDiscord<mratsim> close is not var here.
07:32:03FromDiscord<mratsim> so a continuation that closes a socket will close it twice if copied.
07:32:52disruptekwell, c'mon, it makes a posix call.
07:35:36*adnan338 quit (Quit: adnan338)
07:35:45*adnan338 joined #nim
07:35:46*adnan338 quit (Remote host closed the connection)
07:35:48FromDiscord<mratsim> I'm pretty sure SQLite connections are the same. In general I think it's way more likely to shoot yourself in the foot. with that. And also when you debug, you will have the stacktrace maybe point to `close(handle)`, but will you see the copy of the continuation?
07:35:54*adnan338 joined #nim
07:36:16FromDiscord<mratsim> that's why I think this capability should be separate from core CPS.
07:36:18disruptekare you telling me that your argument against my semantics is nim's standard library?
07:38:16FromDiscord<mratsim> No, it's that we can do most of what we need with non-copyable continations. Over a decade of Scheme didn't find a use-case for multishot continuations, and enabling copying too early will likely lead to hard to understand and debug double-free.
07:39:01disruptekwe don't even have to expose it yet, but it should be built into the design.
07:39:45disrupteknim is not scheme and not being a scheme coder, it's hard for me to understand how exactly it failed to compose for them.
07:39:52FromDiscord<mratsim> I'm advocating to put a `=copy` that prevents copying. This is easy to lift afterwards once we understand mroe the implication.
07:39:55disruptekbut i do understand how strictFuncs can compose for me.
07:40:06disruptekokay, i'm fine with gating it.
07:40:15disrupteki just want to ensure that the logic works.
07:40:34FromDiscord<mratsim> we can even add a "-d:copyableContinuation" flag
07:40:52disruptekas long as it can be tested, i'm fine with it.
07:40:59FromDiscord<mratsim> sounds good
07:43:55disruptekso that's #3 on your third list of reminders.
07:44:07disruptekwhy can't i have the other 2?
07:44:30FromDiscord<Ulrik> So i decided to checkout nim but what is NIM why is it so little popular?
07:44:46disrupteki don't know.
07:45:36FromDiscord<ElegantBeef> It's picking up in popularity, but probably that it's a rather weird language from all the popular languages
07:46:43FromDiscord<Ulrik> But it has not yet even reached the TIOBE programming language rankings list yet, i wonder where NIM stands what makes it so uniqe?
07:48:10FromDiscord<haxscramper> We are in 'next 50' on tiobe
07:48:23FromDiscord<mratsim> @disruptek, the other 2?
07:48:36FromDiscord<ElegantBeef> It's a systems programming language with a non abrasive syntax, it's inspired by oberon, ada, lisp and pascal which is why i figure it's not overly popular ๐Ÿ˜„
07:48:50FromDiscord<mratsim> btw, will have 5 hours electicity cut in 10min so if I stop suddenly you know why
07:49:09disruptekeh we'll talk later; it's 0300 here.
07:49:50FromDiscord<mratsim> gn
07:50:05FromDiscord<0xc45> sent a code paste, see https://play.nim-lang.org/#ix=2LKc
07:50:30FromDiscord<haxscramper> You need to generate asm statement via macros probably
07:50:57FromDiscord<haxscramper> https://nim-lang.org/docs/macros.html#statements-asm-statement
07:52:21FromDiscord<mratsim> You can use inline asm or {.emit: asm """
07:53:56FromDiscord<mratsim> if in C it works but not in Nim asm
07:54:33FromDiscord<mratsim> also if your proc is pure assembly you can use {.asmNoStackFrame.}" to avoid a prologue and epilogue, this is equivalent to attribute((naked))"
07:55:07FromDiscord<mratsim> This is the library with the most ASM in Nim I think: https://github.com/mratsim/constantine/search?q=asm
07:55:21FromDiscord<mratsim> it includes an compile-time assembler for x86
07:55:51FromDiscord<0xc45> Awesome, thanks both! I'll look into those references! ๐Ÿ™‚
07:56:02FromDiscord<mratsim> and this is what I'm talking about when you can use C asm: https://github.com/mratsim/constantine/blob/master/benchmarks/platforms/x86.nim#L65-L71
07:56:50FromDiscord<0xc45> Oh that's an interesting example! Thanks
07:58:07FromDiscord<mratsim> and this repo has a couple of experiments I used to understand asm statement codegen: https://github.com/mratsim/finite-fields/blob/master/macro_add_carry.nim
08:17:43FromDiscord<faith_james || Nim Developer> Helllo
08:17:54FromDiscord<ElegantBeef> Hello
08:20:10*NimBot joined #nim
08:28:32FromDiscord<eye contacts for nyagito komaeda> are there any good tutorials out there on using nim with the js backend?
08:28:42FromDiscord<eye contacts for nyagito komaeda> specifically on binding js libraries for use in nim
08:28:51FromDiscord<eye contacts for nyagito komaeda> (to then be compiled back into js)
08:36:46*piron joined #nim
08:40:44FromDiscord<ElegantBeef> I have this small example of one way of doing it lazily https://github.com/beef331/mrapi
08:56:04*himu joined #nim
09:01:04greenforkeye contacts for nyagito komaeda, if you want just to use it (not to write a complete wrapper), you can leverage jsffi like so https://github.com/greenfork/colorvisualization/blob/master/src/animation.nim
09:01:20*jkiesian joined #nim
09:01:29FromDiscord<0xc45> sent a code paste, see https://play.nim-lang.org/#ix=2LKv
09:07:34FromDiscord<haxscramper> I'm pretty sure you can't emit `asm` at runtime, it is just not possible
09:07:56FromDiscord<haxscramper> Because it has to be present in compiled binary, otherwise it won't work
09:08:11FromDiscord<haxscramper> You might be looking into JIT territory if you need to do this at runtime
09:08:32FromDiscord<0xc45> Hmm yeah that makes sense if you put it like that. That's a shame, guess I'll have to find another way to make this work ๐Ÿ™‚
09:16:31*u0_a2161 quit (Ping timeout: 256 seconds)
09:37:03*cyraxjoe quit (Ping timeout: 260 seconds)
09:52:28*habamax quit (Ping timeout: 265 seconds)
10:01:50*himu quit (Ping timeout: 264 seconds)
10:06:08*piron_ joined #nim
10:08:33*piron quit (Ping timeout: 260 seconds)
10:11:57*himu joined #nim
10:13:40*Tanger quit (Quit: Leaving)
10:16:35*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:17:54FromGitter<gogolxdong> When will CPS ready for use?
10:23:05*PMunch joined #nim
10:26:29adnan338Hello, I want to get the Appdata folder in windows. In powershell, this can be done by executing `$env:APPDATA`. How can I get environment variables in Nim?
10:27:53*u0_a2161 joined #nim
10:28:09Prestigehttps://nim-lang.org/docs/os.html#getEnv%2Cstring%2Cstring adnan338
10:28:38adnan338thank you Prestige
10:29:01Prestigeno prob! had to know where to look, unfortunately
10:31:02*superbia joined #nim
10:37:31*u0_a2161 quit (Ping timeout: 246 seconds)
10:50:45*superbia quit (Quit: WeeChat 3.0)
10:52:57*filcuc_ joined #nim
10:52:58*habamax joined #nim
10:56:39FromGitter<gogolxdong> I know where caused GUI crashed, it's an global orderedTable accessing from different threads.
10:57:41FromGitter<gogolxdong> Which way to make it thread-safe and GC-safe?
10:58:35FromGitter<vinodvinu> Is there any GUI tutorial in Nim ? Especially for Windows GUI ?
10:59:08FromGitter<gogolxdong> https://github.com/khchen/wNim
10:59:40FromGitter<vinodvinu> Thank you @gogolxdong :)
11:00:07FromGitter<gogolxdong> https://github.com/gogolxdong/2DeFi uses wNim, there is an English REAMD-EN.md
11:01:12FromGitter<vinodvinu> Yeah, found it.
11:01:23PMunch@gogol, there is https://nim-lang.org/docs/sharedtables.html but it doesn't have orderedTable
11:01:27FromGitter<gogolxdong> https://www.bilibili.com/video/BV1E54y147xg here is my demo
11:01:45*filcuc joined #nim
11:01:54*filcuc_ quit (Ping timeout: 272 seconds)
11:02:17PMunchOne option is to set up a request/response system using channels and have only the main thread access the table
11:03:02FromGitter<gogolxdong> Is sharedtables engough, I considered channel option.
11:03:36FromGitter<vinodvinu> @gogolxdong , Nice !.
11:05:48FromGitter<gogolxdong> channel will work , just no so elegant or straightforward. I think CPS will solve these issue.
11:07:22FromGitter<gogolxdong> Let's try sharedtables
11:10:28PMunchIt's not ordered though
11:11:35*abm joined #nim
11:13:19FromGitter<gogolxdong> Thanks for reminding, I remember you worked on satellite right? It's awesome. Someday XSpace will run Nim in their rockets :)
11:14:46PMunchI used to work with satellite reception, but I don't any wore
11:17:07narimiranif anyone is interested, i wrote an article about various parsing methods in nim (based on my advent of code solutions): https://narimiran.github.io/2021/01/11/nim-parsing.html
11:18:59PMunchDid you change mut from the version I read?
11:19:41narimiranPMunch: it's basically the same thing! (i didn't add any regex examples per your suggestion, sorry)
11:21:35*Tanger joined #nim
11:22:35FromGitter<gogolxdong> What kind of satellite it was, communication or climate.
11:23:25*Vladar joined #nim
11:25:15PMunchIt was the EPS-SG satellites
11:26:43FromGitter<gogolxdong> awesome!
11:30:12FromGitter<gogolxdong> still crash
11:33:33FromGitter<gogolxdong> https://play.nim-lang.org/#ix=2LLi comment out the last lines of table accessing make it more robust
11:35:02*Torro joined #nim
11:36:49FromGitter<gogolxdong> Have no idea.
11:41:26PMunchWhat does it complain about if you remove {.gcsafe.} on line 40?
11:47:10*PMunch quit (Ping timeout: 246 seconds)
11:49:10FromGitter<gogolxdong> `Error: 'status_continue' is not GC-safe as it accesses 'nameIterVar`gensym319' which is a global using GC'ed memory`
11:51:25FromGitter<gogolxdong> https://play.nim-lang.org/#ix=2LLn this is whole part , there isn't something like name...
11:52:26piron_hello everybody, I am learning nim, is there a "Ninety-Nine Nim problems" type or resource?
11:56:12*filcuc quit (Ping timeout: 265 seconds)
11:56:24FromGitter<gogolxdong> ```code paste, see link```
11:56:34FromGitter<gogolxdong> it's from chronos
11:59:26*D_ quit (Ping timeout: 264 seconds)
12:00:37*PMunch joined #nim
12:01:12*Tanger quit (Remote host closed the connection)
12:02:08FromDiscord<haxscramper> piron_: you can try AOC problems
12:04:45*himu quit (Ping timeout: 240 seconds)
12:05:59FromGitter<gogolxdong> It doesn't show which GC'ed memory it's accessing ,not as a normal error.
12:11:12*himu joined #nim
12:16:01*himu quit (Ping timeout: 265 seconds)
12:19:14*leorize quit (Remote host closed the connection)
12:19:39*leorize joined #nim
12:30:25*jkiesian quit (Ping timeout: 240 seconds)
12:32:29FromDiscord<Rika> Iโ€™m being dumb again, how would I go about writing something with global state and async again?
12:32:59*Tanger joined #nim
12:38:03*gangstacat quit (Ping timeout: 272 seconds)
12:41:53*gangstacat joined #nim
12:42:42*jkiesian joined #nim
12:45:46*Lord_Nightmare quit (Ping timeout: 272 seconds)
12:51:11PMunch@Rika, just do it?
12:51:21PMunchThere's nothing special to keep in mind in that case :P
12:53:38FromDiscord<mratsim> @0xc45, ycan't emit ".byte 0xfoo" at runtime with an ASM macro you need a JIT
12:53:43FromDiscord<mratsim> you can't
12:54:06FromDiscord<mratsim> there is a small example of a JIT here: https://github.com/mratsim/photon-jit
12:56:05FromDiscord<mratsim> basically, you allocate a page, make write your ASM function to it, make it executable, cast the pointer to a function and run it: https://github.com/mratsim/photon-jit/blob/ef1954406d6f23677f702151397fcd6d3889aad3/photon_jit/photon_types.nim#L60-L93
12:59:15*adnan338 quit (Quit: adnan338)
13:01:12*FromDiscord quit (Remote host closed the connection)
13:01:25*himu joined #nim
13:01:29*FromDiscord joined #nim
13:03:12FromDiscord<Rika> Pmunch and get gcsafe issues yeah lol
13:03:40PMunchgcsafe in async?
13:04:08FromDiscord<mratsim> (edit) basically, you allocate a page, make write your ASM function to it, make it executable, cast the pointer to a function and run it: https://github.com/mratsim/photon-jit/blob/ef1954406d6f23677f702151397fcd6d3889aad3/photon_jit/photon_types.nim#L60-L93
13:04:09*FromDiscord quit (Remote host closed the connection)
13:04:23*FromDiscord joined #nim
13:04:41FromDiscord<mratsim> (edit) and this repo has a couple of experiments I used to understand asm statement codegen: https://github.com/mratsim/finite-fields/blob/master/macro_add_carry.nim
13:04:42*FromDiscord quit (Remote host closed the connection)
13:04:58*FromDiscord joined #nim
13:06:13*himu quit (Ping timeout: 264 seconds)
13:07:09*jkiesian quit (Ping timeout: 256 seconds)
13:14:17*mbomba joined #nim
13:14:23*himu joined #nim
13:19:34*jkiesian joined #nim
13:23:57*u0_a2161 joined #nim
13:25:02FromDiscord<Rika> well i had to deal with some gcsafe issue when i used a global so yeah
13:25:29FromDiscord<Rika> i dont remember what i do to deal with those anymore sooo
13:26:47TangerHey folks, I've been tinkering with the npeg library and I figured it's worth asking if it's possible to create a grammar for a lispish language.
13:27:37TangerI've been hitting issues with recursion, which is understandable given that the language can be recursive
13:29:57TangerIs there a way to specify a recursion limit? ie cap it at X so compiling expressions doesn't just hang
13:31:43TangerNevermind, I think I just need to rewrite it if they have a JSON parser in the examples
13:32:41FromDiscord<lqdev> well, there's -d:nimCallDepthLimit=x iirc
13:32:56FromDiscord<lqdev> but that's for Nim and not npeg
13:33:21*Lord_Nightmare joined #nim
13:34:12FromGitter<gogolxdong> @PMunch, seems there is only one option , using channel
13:34:42PMunchTanger, you can use capture and a counter
13:35:17PMunch@gogolxdong, there are some less safe options that can work if you are careful
13:35:28PMunchBut the easiest is to use channels if you don't need absolute performance
13:35:58FromGitter<gogolxdong> what's the less safe options, using ptr?
13:37:42FromGitter<gogolxdong> How do you do for multithreading programming with performance at the same time.
13:38:04PMunchWell it depends on why you're using threads
13:38:24PMunchIf you just don't want your UI to lock up while you do stuff in the background then a channel is fine
13:38:33*greenfork quit (Quit: Leaving)
13:38:49PMunchBut if you extreme performance then you will have to architect some better solution
13:42:40FromDiscord<0xc45> sent a long message, see http://ix.io/2LMd
13:43:06FromDiscord<0xc45> (before anyone asks - yes this is legit, it's for my job as a pentester / red teamer ๐Ÿ˜› )
13:43:34FromDiscord<mratsim> seems like Nim is making inroads in offensive security?
13:44:22PMunchHeh, reminds me of the time I unknowingly helped optimise a honeypot-finder <_<
13:44:59FromDiscord<0xc45> It is! There's a couple of people that have published blogs/articles on why Nim is very useful in the context of offensive security tooling, so more and more people are picking it up. A nice example is here: https://github.com/byt3bl33d3r/OffensiveNim
13:45:14PMunchOh cool
13:46:01FromDiscord<0xc45> The project I'm personally working on is a packer that wraps either C# binaries or plain shellcode in a Nim executable, deobfuscating and decrypting the payload at runtime
13:46:10FromDiscord<0xc45> Nim works really well for that ๐Ÿ™‚
13:47:25FromDiscord<mratsim> interesting. Well if you have questions feel free. I'm more familiar with the cryptographic world and security auditors (we finished our security audit in december) but pentesting looks very interesting as well.
13:48:44FromDiscord<0xc45> Cool! Yeah you guys have been very helpful so far! ๐Ÿ˜„
13:49:55FromDiscord<mratsim> if many of your domains come here we can create an opsec-crypto channel on Discord
13:50:02FromDiscord<mratsim> experts in your domain
13:50:38FromDiscord<0xc45> Indeed! Haven't seen a lot of familiar names yet though
13:50:48FromDiscord<0xc45> But I'm sure there's some people lurking
13:50:50*EastByte quit (Quit: WeeChat 2.7.1)
13:58:13FromGitter<gogolxdong> good question, if there is an workaround in async like this https://play.nim-lang.org/#ix=2LMk works, there is no need for threads.
13:58:27FromGitter<gogolxdong> @PMunch
14:00:17PMunchWhat do you mean workaround?
14:00:46FromGitter<gogolxdong> how to achieve wait at the same time.
14:01:23PMunchBy using sleepAsync?
14:02:04*tane joined #nim
14:02:14FromGitter<gogolxdong> sleepAsync only echo "A"
14:04:00FromDiscord<Rika> dont discard c()
14:04:03FromDiscord<Rika> use waitfor
14:04:22FromDiscord<Rika> pmunch youre in charge of playground right? i think i fucked it
14:04:36FromDiscord<Rika> oh okay nvm its back xd
14:07:28*PMunch quit (Ping timeout: 272 seconds)
14:10:04FromGitter<gogolxdong> main thread is for rendering GUI.
14:16:00FromGitter<gogolxdong> I think it's one reason, then I can try to manage other three while true logics in another thread.
14:17:35*EastByte joined #nim
14:17:42*EastByte quit (Client Quit)
14:20:59*PMunch joined #nim
14:22:30Oddmongerasyncnet.nim , it's like using select() with C ?
14:22:50Oddmongeri mean, non blocking listening ?
14:24:13Oddmongerin fact, it seems a socket wrapper
14:25:47*xet7 joined #nim
14:26:14ForumUpdaterBotNew thread by Miran: New article: Parsing inputs in Nim, see https://forum.nim-lang.org/t/7376
14:28:13FromDiscord<lqdev> `(readFile filename).split("\n\n")` narimiran please
14:28:22narimiranteach me
14:30:52FromDiscord<lqdev> i mean, come onโ€ฆ did you really have to showcase command call syntax used in expressions here? :)
14:32:36narimiranso, i should move `(` one word right? :P
14:34:22FromDiscord<lqdev> yeah
14:35:11FromDiscord<lqdev> i know disruptek is poisoning people with his disrupstyle but i didn't expect people to start doing shenanigans like this
14:35:27narimiranhaha, pushed the "correction" :D
14:35:49narimiran(it will be probably couple of minutes until the new version is built)
14:41:33FromGitter<gogolxdong> well, it's not about threading, it's about access global GC'ed memory, crash remains.
14:43:46FromDiscord<flywind> annoying dot is not fixed completely ...
14:44:16FromDiscord<flywind> sent a code paste, see https://play.nim-lang.org/#ix=2LMF
14:45:29FromDiscord<shadow.> narimiran: lol it's funny bc i also learned scanf and npeg through aoc
14:45:42FromDiscord<shadow.> prolly woulda still been split() and regexing everything
14:45:44FromDiscord<shadow.> if i didnt do aoc
14:46:09narimiranAoC is great for learning new stuff (including completely new languages)
14:47:13FromDiscord<shadow.> lol yeah
14:47:16FromDiscord<shadow.> that's how i learned nim
14:49:02*D_ joined #nim
14:52:06narimiransame here
14:53:03*D_ quit (Client Quit)
14:54:15*D_ joined #nim
14:57:18*u0_a2161 quit (Ping timeout: 260 seconds)
14:59:02FromDiscord<shadow.> lmao haven't you been doing nim for ages
14:59:04FromDiscord<shadow.> or am i being dumb
14:59:17narimiranwell, AoC has been runing for ages too
14:59:21FromDiscord<shadow.> ahhhh
14:59:22FromDiscord<shadow.> i see
14:59:23FromDiscord<shadow.> haha
14:59:26FromDiscord<shadow.> i learned on this year's aoc
15:06:33FromGitter<gogolxdong> what's the difference between waitFor all([a,b]) and waitFor a or b
15:11:20*EastByte joined #nim
15:12:23*EastByte quit (Client Quit)
15:13:24*jkiesian quit (Ping timeout: 265 seconds)
15:13:38*EastByte joined #nim
15:20:46FromDiscord<Rika> nothing in particular i believe?
15:26:27disruptekgogolxdong: cps is a team effort, but you can promote prioritizing it by helping to sponsor my work.
15:27:08*fputs quit (Quit: WeeChat 3.0)
15:28:23*fputs joined #nim
15:36:51FromGitter<gogolxdong> Yes, I will back Nim this year.
15:41:12FromDiscord<mratsim> There are people who have been in the Nim community for more than 10 years now :p
15:41:13*Tanger quit (Remote host closed the connection)
15:42:03FromGitter<gogolxdong> make gcsafe gone.
15:44:06FromGitter<gogolxdong> There would be a Nim foundation, and Nim committee, you would be chosen as an expert :)
15:44:50*hmmm joined #nim
15:46:51*def- quit (Quit: -)
15:47:03*def- joined #nim
15:47:16FromGitter<gogolxdong> especially you four in CPS team.
15:47:25*EastByte quit (Ping timeout: 272 seconds)
15:49:50disruptekthe only thing i seem to be expert at is not getting paid.
15:50:37FromDiscord<mratsim> Four?
15:50:49FromDiscord<mratsim> Where is the other Mr Fantastic?
15:54:06FromGitter<gogolxdong> (https://files.gitter.im/5602f03e0fc9f982beb19f61/sawk/image.png)
15:54:33FromDiscord<shadow.> lol yep
15:55:33FromDiscord<mratsim> Ah, Clyybber is just forced to fixed the types in a macro bug that we highlight :p
15:56:22FromGitter<gogolxdong> @disruptek, like your homorous
15:57:03*jkiesian joined #nim
15:57:41FromGitter<gogolxdong> Is that sense of humour? which I lack.
15:59:27FromDiscord<Rika> yes hes trying to be funny (in part)
16:02:45*EastByte joined #nim
16:03:41*waleee-cl joined #nim
16:05:35*himu quit (Quit: Konversation terminated!)
16:16:43FromGitter<gogolxdong> time to go to sleep.gn
16:19:06FromDiscord<VVX7> hey @0xc45 I'm also here for offensive security tooling with Nim. I'm working on a RAT for a Operator (like CALDERA). Would be interested to see what you're building. https://github.com/VVX7/nicodemus
16:19:22FromDiscord<VVX7> (edit) "<@!672742601362898985>" => "@0xc45" | "a" => "Prelude"
16:21:16planetis[m]mrastim: how are you today?
16:23:35FromDiscord<0xc45> Cool, that looks very interesting! I'll DM you about my project! ๐Ÿ™‚
16:24:09disruptekthere's nothing funny about being destitute.
16:26:01planetis[m]disruptek: if you have something to say, say it
16:27:47planetis[m]"disrptek throbs"
16:28:08*vicfred joined #nim
16:31:46FromDiscord<VVX7> Cool stuff! I'll try to make time this weekend to dig in ๐Ÿ™‚
16:32:40FromDiscord<mratsim> @planetis, I'm good
16:32:45disruptekif i have something to say about what?
16:33:20disruptekhearts and minds, people; HEARTS AND MINDS!
16:33:23disruptekthat better?
16:33:57disruptektoday we repoint gitnim to the nightlies.
16:34:18planetis[m]mratsim: great, me too, just a little bored, bc of the lockdown, but I will start practising guitar or exercise
16:34:42planetis[m]depends what's my mood
16:35:01FromDiscord<mratsim> My usual wind up is either playing go or dancing but I can't dance due to covid
16:35:10FromDiscord<mratsim> I sually do that 5-8 hours per week
16:35:17*mipri left #nim (#nim)
16:37:01*jkiesian quit (Ping timeout: 265 seconds)
16:37:16planetis[m]dancing, as modern dance, are you a breakdancer?
16:39:42FromDiscord<mratsim> linking to offtopic
16:42:08planetis[m]ok great got to go now
16:42:21disruptekaight peace.
16:46:36planetis[m]would you be willing to study how the jsonserialization library works, before claiming that it handles random order correctly? K bye
16:47:42FromDiscord<mratsim> I produced code that worked fine on your example, what more do you want?
16:51:47disruptekah serialization drama. ๐Ÿฟ
16:51:55disrupteki can't think of a more boring topic.
16:52:44disruptekplanetis[m]: you are allowed to use whatever serializer you want for whatever you want.
16:53:34saemUgh, serialization, really wish it didn't exist, I like it was something that just worked so I never have to think about
16:53:54saemAlso that it basically took no work
16:55:09disrupteksome of our serializers fit that definition -- they took basically no work to build, and it shows.
16:56:25saemIt's just a painful lesson that exposing your core data model as a format is almost always a bad thing
16:57:11saemWell once programs become bigger or you get requirements like compatibility across versions etc
16:58:19disrupteki dunno, i find that most software is ephemeral enough that it doesn't matter.
16:58:49disruptekif i can't read some data i just die.
16:59:06disruptekor, sure, recreate it.
16:59:18disruptekyou have to engineer for failure, always.
16:59:28*hnOsmium0001 joined #nim
17:01:45disruptekpro tip time.
17:02:01disruptekso you know ic is this flat ast concept.
17:02:08disruptekjust a sequence of nodes, no pointer soup.
17:02:23disruptekone of the genius ideas it raises is to embed errors in the ast.
17:02:43disruptekproc errorAst*(s: string): NimNode =
17:02:43disruptek ## produce {.error: s.} in order to embed errors in the ast
17:02:43disruptek nnkPragma.newTree:
17:02:44disruptek ident"error".newColonExpr: newLit s
17:02:56disruptekuse it today. it works well.
17:04:35disruptekproc errorAst*(n: NimNode; s = "creepy ast"): NimNode = ## embed an error with a message errorAst s & ":\n" & treeRepr(n) & "\n"
17:05:00disruptekjust sprinkle some newlines in there.
17:05:41*jkiesian joined #nim
17:05:44leorizewe can do it better :P (in the compiler I mean)
17:06:50disruptekwe will, eventually. but the concept is worth backporting to use today.
17:08:19disruptekafter looking at the available string-templating engines for nim, i decided i don't need string-templating. ๐Ÿ™„
17:10:46*mbomba quit (Quit: WeeChat 3.0)
17:11:08*shirty joined #nim
17:16:10leorizeI'm adding support for Windows to nim-sys and now I'm questioning whether I should just tell people to use a threadpool to do tasks instead
17:17:24disrupteki think function color is such a terrible concept that i'm willing to do practically whatever it takes to avoid it. but this is just my subjective opinion, and we know what my opinion is worth around here.
17:19:32leorizeI want to get rid of the notion as much as you do, but we don't have anything better yet (well there's cps in the work but I need a working impl before I try new things)
17:20:18disrupteklet that motherfucker block.
17:21:24leorizeeither I need CPS or weave need an IO threadpool
17:21:29leorizesince I do need async
17:22:16disruptekwell, bug your compiler developers to fix crash bugs.
17:24:13leorizeonly Araq is the one working on the compiler full time as far as I know
17:24:47leorizewe need more full-time devs I guess
17:28:24FromDiscord<mratsim> Types are function color
17:29:15FromDiscord<mratsim> Function colors is not a problem, just like being statically typed is not a problem
17:30:09FromDiscord<mratsim> interesting article: https://lukasa.co.uk/2016/07/The_Function_Colour_Myth/
17:31:38FromDiscord<mratsim> Kotlin for example doesn't use the "await" keywords so you don't distinguish suspendable from classic function. According to them it makes refactoring to async/coroutines easier.
17:32:02FromDiscord<mratsim> And there is a small bullet in your IDE that outline suspending functions.
17:32:53FromDiscord<mratsim> I think having await and waitFor instead is perfectly fine, readable and I'll take an extra word to add if it helps maintenance, debuggability and easing people into the codebase.
17:33:02*shirty quit (Quit: Connection closed)
17:33:21disrupteki don't know how you think that article doesn't support my point.
17:33:48reversem3what is your guys opinion who best tutorials and documentation for web frameworks
17:34:38FromDiscord<mratsim> @disruptek, I'm not always disagreeing with you.
17:34:59disruptekwell, function color is a problem in nim, anyway.
17:36:05disruptekreversem3: visit indeed.com, plot salary against availability of work, find something like react or whatever and then go to react.com and click the biggest button on the page.
17:36:30*lritter joined #nim
17:36:53FromDiscord<mratsim> @leorize I wanted to start looking on IO multithreading 4 weeks ago and then got bitten by the CPS bug.
17:37:02reversem3Oh sorry I should of been more specific ,I meant for nim
17:37:11disruptekand we are glad you did, mratsim. ๐Ÿ˜‰
17:37:12FromDiscord<mratsim> he was being facetious
17:37:13*superbia joined #nim
17:37:24disruptek!repo prologue
17:37:25disbot12https://github.com/planety/prologue -- 9prologue: 11Prologue is an elegant web framework written in Nim. 15 645โญ 21๐Ÿด 7& 6 more...
17:37:46disruptekthere's really no reason to choose anything else, as support and momentum are what matter in this space.
17:38:05FromDiscord<mratsim> wow 645 stars ๐Ÿ˜ฎ
17:38:17reversem3ok cool , hopefully I can use elm with it
17:38:37*disruptek ๐Ÿคฆ
17:39:18reversem3what its a great front end
17:39:57superbiais anyone str3aming ?
17:41:05leorizegah, microsoft got rid of RtlGenRandom() docs
17:41:26leorizenow you need two syscalls to get random numbers
17:42:12*rramos_eth joined #nim
17:52:09FromDiscord<shadow.> blech
17:53:22saemSeems like the only thing to do with function colour is to play at the edges of it. Like colouring the return type or parameters, which just mildly shifts things, but it works for other function color problems. Like auto-dereferencing, var vs let.
17:54:24disruptekthat's basically mamy's point, i think.
17:54:34FromDiscord<shadow.> disruptek: i'm just uneducated, what are the obvious advantages over jester?
17:54:59disruptekshadow.: it's supported and widely used.
17:56:31disrupteksaem: the metric that i've taken to using is really simple:
17:56:51disruptekif you can see the problem in your editor and fix it there, why can't the computer do it for you?
17:57:54*Arrrrrrrr joined #nim
17:58:39saemI like that metric
18:00:04disrupteki think araq invented it, but i don't remember.
18:01:14FromDiscord<mratsim> I've read it a couple of times not sure if it was here Hacker new or reddit
18:01:47saemProbably read it, and not sold their conclusion will satisfy everyone, but I think colour is a necessary complexity and it could be automatically figured out in some special cases. Where those special cases are really you have enough info and flexibility to pay their price. I think those cases cover a very wide gamut, so what about green thread approach like go as a "mode"?
18:02:09FromDiscord<mratsim> maybe talks as well "I know exactly what you want but I won't give in until you please me"
18:02:37ForumUpdaterBotNew thread by Snej: Semantics of {.shallow.}?, see https://forum.nim-lang.org/t/7377
18:02:57*himu joined #nim
18:03:04FromDiscord<mratsim> green thread don't work in javascript, they also don't work in embedded
18:03:46FromDiscord<mratsim> have to check in microLua but I think their stackful coroutines (= fibers = green threads) are not usable there
18:04:02saemI know, please see my special case remark and I'm saying this is to be layered not baked in
18:04:18disrupteksaem: would you have a "fetches from memory are blocking" layer?
18:04:48saemI should also not use the authors language, because I think the spaghetti stack is the more important aspect.
18:05:30saemdisruptek: depends which memory, but yeah, gotta barrier the stuff that's out side the execution context
18:05:30FromDiscord<mratsim> cool people call it the saguaro stack
18:06:17saemColour is a decidability issue in the type system (fuck Jeremy, I bet you feel snug right now) and it can't figure out what to do so you gotta add more information. So that's either ambient or explicit
18:06:18FromDiscord<mratsim> Here is a writeup on the cactus stack/spaghetti stack/split stack: https://github.com/mratsim/weave/blob/master/weave/memory/multithreaded_memory_management.md
18:07:52FromDiscord<mratsim> I've mentioned in the section "The particular case of multithreading" but continuations happen to solve the cactus stack problem https://github.com/disruptek/cps/discussions/40#discussioncomment-241263
18:07:58saemmratsim: partially an aside, to be clear I'm not doubting your thoroughness and conscientious research habits. It's thoroughly refreshing.
18:08:14disruptekthere are cases where we are pretty well fucked, like mratsim's fd example, but i would rather solve that separately instead of conceding it in the design.
18:08:18saemI'm case that was coming across at some point
18:08:44FromDiscord<mratsim> fd? File descriptor?
18:09:20FromDiscord<mratsim> you will have to remind me, because I don't remember having a problem with file descriptors
18:09:37*himu quit (Quit: Konversation terminated!)
18:09:53disruptekthe fd is just an integer but once it goes to ffi who the fuck knows what happens.
18:09:56*natrys joined #nim
18:10:09disrupteki don't think we should engineer for ffi, is my point.
18:10:12FromDiscord<mratsim> ah for the multishot continuations
18:10:24disruptekit's a problem everywhere.
18:10:40saemYeah, that's what I mean, so either you bake assumptions into the environment (language, design, define, types, whatever) or the information needs to be at the call/declaration sites.
18:10:45FromDiscord<mratsim> here it's not FFI, close(socket) is in Nim code
18:10:53FromDiscord<mratsim> anyway we solved that
18:11:11*NimBot joined #nim
18:11:21saemFFI is a fence, isn't it (more colour)?
18:11:28disruptekbut to saem's point, it should be baked into the type.
18:11:36FromDiscord<mratsim> and as an additional security, continuations will have a {.warning: "copy of a contination happens here".}
18:11:48FromDiscord<mratsim> to ease debugging
18:25:50saem(opening a can of worms) mratsim: in your research have you stumbled across the dispatchers using something like algebraic effects to compose? I'm wondering if all the immutability related issues "go away", when you can stack/compose dispatchers (handling logic) or allow replay but use memoized data or whatever compensating strategy?
18:30:16*jkiesian quit (Ping timeout: 240 seconds)
18:31:31FromDiscord<mratsim> also you might want to look at the C++ coroutines in-depth analysis of fibers http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1364r0.pdf
18:31:34saemNevermind, looks like the reason I was connecting the two things was because CPS is general enough to cover algebraic effects.
18:31:48FromDiscord<mratsim> btw to tag me you need to put @mratsim
18:32:10FromDiscord<mratsim> continuations are powerful enough to implement any Monad
18:32:13saemUgh, annoying on a phone. y u no irc
18:32:25FromDiscord<mratsim> http://citeseerx.ist.psu.edu/viewdoc/download?doi=
18:32:34Zevvsaem: wrong phone!
18:33:05FromDiscord<mratsim> fibers = green threads = stackful coroutines btw
18:33:07saemZevv: hush! But also don't. What's the right phone in you opinion?
18:33:19Oddmongeri'm reading this: https://nim-lang.org/0.19.2/backends.html , but the URI puzzles me (0.19.2) : is there a more recent version ?
18:33:27FromDiscord<mratsim> = something that allocates a page, switch the stack pointer to it
18:33:35saemmratsim need a graph of this. :D
18:33:41Zevvsaem: https://planetcom.squarespace.com/device
18:33:58FromDiscord<mratsim> A graph of my research?
18:34:04FromDiscord<mratsim> I only speak markdown
18:34:06FromDiscord<mratsim> ๐Ÿ˜›
18:34:12Zevvand french
18:34:12saemZevv: I like your style. I gots a pixel 5
18:34:22Zevvsaem: not enough keys on that :)
18:34:28saemYes, but only in markdown
18:35:01saemI meant a big dotviz showing the taxonomy of concepts
18:35:02Zevvmarque vers le bas
18:35:17FromDiscord<mratsim> at one point I need to write code as well
18:35:26FromDiscord<mratsim> but that reminder is in all my documents
18:35:52FromDiscord<mratsim> functions vs resumable functions and continuations (stackless) coroutines and fibers
18:35:57saemHah, I teased my italian speaking boss with cappana da pizza
18:36:28FromDiscord<mratsim> non รจ troppo difficile di parlare italiano quando posso parlare francese
18:36:55Zevvyou'll manage
18:37:08Oddmongermais qu'est-ce qu'ils disent
18:37:17FromDiscord<mratsim> ่ฏดๆฑ‰่ฏญ้ฉฌ๏ผŸ
18:37:46disruptekdisbot: what do you think?
18:37:47disbotcannot predict now.
18:38:16saemWelp that pushed well past all my limited french understanding
18:38:31FromDiscord<mratsim> == what are you saying
18:38:49saemI could remember disent
18:39:14FromDiscord<mratsim> dire/dise/disent is "say"
18:39:33saemSigh, I knew that at some point
18:39:36Oddmongera man who speaks two language is bilingual, but a man who speaks only one language is english
18:39:52FromDiscord<mratsim> Or a PHP dev
18:40:09FromDiscord<mratsim> Or perl?
18:40:17saemI'm on the west coast, no one will care about my crappy french skills
18:40:19FromDiscord<mratsim> something with a P
18:40:40FromDiscord<mratsim> Pascal
18:40:53*mipri joined #nim
18:41:06OddmongerTurbo Pascal
18:42:07OddmongerPizza time
18:42:14Oddmongerbon appรฉtit :)โ€™
18:42:27saemOddmonger: wins
18:42:34saemI love pizza
18:44:01*xace quit (Ping timeout: 246 seconds)
18:45:53*xace joined #nim
18:56:58*natrys quit (Ping timeout: 246 seconds)
18:57:32FromDiscord<jseb> sent a code paste, see https://play.nim-lang.org/#ix=2LOf
18:57:42*Torro quit (Quit: bye)
18:59:30FromDiscord<InventorMatt> Readfile returns a tainted string but you are trying to turn a world object into a tainted string
18:59:48FromDiscord<jseb> ahhh stupid me
19:00:00FromDiscord<jseb> i have forgotten to unserialize
19:00:05FromDiscord<jseb> thank you
19:00:34FromDiscord<InventorMatt> No problem
19:07:23*leorize quit (Ping timeout: 240 seconds)
19:10:06*natrys joined #nim
19:11:11*adnan338 joined #nim
19:12:00*leorize joined #nim
19:13:33FromDiscord<JSONBash> anyone sure how to make the nim.nvim plugin not collapse all functions calls be default?
19:13:34*adnan338 quit (Read error: Connection reset by peer)
19:14:18FromDiscord<lqdev> set nofoldenable
19:15:04FromDiscord<JSONBash> hero
19:20:27*l1x joined #nim
19:28:36*rramos_eth quit (Quit: Leaving.)
19:34:28leorizeyou can also customize `foldlevel` to only disable the first few levels of fold
19:34:54leorizebut yea `set nofoldenable` work just fine
19:35:09leorizeif you wanna selectively fold just type `zc` on a foldable region
19:36:08*Jesin quit (Quit: Leaving)
19:40:12*Jesin joined #nim
19:50:18*shirty joined #nim
19:50:56*habamax quit (Ping timeout: 240 seconds)
19:53:23shirtyHey people, just started with Nim, so far it's been my favorite language i've been trying out lately (vs Go, Odin). I'm looking for a replacement for C++ and python. Interestingly Nim seems like it would be able to replace both to some degree.
19:53:49Zevvbut still, it's neither C++, nor python
19:54:04shirtyI'm not looking for C++
19:54:07shirtyor Python
19:54:10FromDiscord<dom96> Hello shirty! Welcome! ๐Ÿ™‚
19:54:16Zevvshirty: right, that's the spirit
19:54:45shirtyZev: right, we understand each other :D
19:55:07Zevvalways, buddy, always
19:55:39Zevvbut the good thing is, if you know both C++ and python, you'll understand why Nim is what it is and does what it does
19:55:49shirtyI still have a few things on my list: Julia, Jai and Zig.
19:55:56Zevvif you have a background on only one of the two, some things might feel kind of funny in the beginning
19:56:05ZevvAll three very cool
19:56:42shirtyZevv: yea, that literarily been my experience with it, it feels litterarly like it directly solves my issues with both languages.
19:56:57shirtyI'm surprised also at how much I really like indentation in Nim
19:57:03Zevvalways nice to hear.
19:57:13Zevvany opinons on the style-insensitive part yet?
19:57:20Zevvbecause you have to hate it or love it, as a newby
19:57:24Zevvonly later you can stop caring
19:57:56ZevvI loathed the indenting in the beginning, but I also stopped caring about that :)
19:58:29mipriI don't like it, but it doesn't bother me like { at the beginning of a line does.
19:59:01FromDiscord<mratsim> We can try Jai?
19:59:12disrupteksince when?
19:59:49shirtyZevv: i like the style insensitive part specifically because I can literally stick to my C style. I have no issues with it, i'm not worried about it, i'm just curious what happens in larger codebases.
20:00:06FromDiscord<dom96> just wait, Jai will /blow/ your mind
20:00:07disrupteknothing unsurprising, is the answer.
20:00:08shirtyI have a slight feeling of, hmm, how will it end
20:00:24FromDiscord<mratsim> @dom96 Zevv will say "nice try but i prefer italian humor"
20:00:44shirtydisruptek mratsim: I don't think you can try it yet
20:00:55shirtyit's available in closed beta form or something\
20:01:25Zevvis it really mindblowingly?
20:01:32FromDiscord<dom96> What's italian humour? Is it things like forcing them to cook and eat Hawaiian pizzas?
20:01:40FromDiscord<mratsim> More like it's written by Jonathan Blow
20:01:53ZevvI only read the primer and it looks solid and well thought out, but I didn't see anything really absolutely surpsising yet
20:01:57shirtyMy initial feeling about the indentation was I won't like it. But I really like it now, blows c style stuff out the water, it's just cleaner
20:02:38FromDiscord<mratsim> My take with any language is that it will not cater to my use cases and i will have to write the code from scratch anyway
20:02:59FromDiscord<mratsim> so i hope it doesn't block me with silly rules
20:03:04Zevvwhich made me wonder. Why is there no mratsim-lang yet?
20:03:05FromDiscord<mratsim> like no operator overloading
20:03:37leorizemratsim: you sit in the triangle of NIH: cryptography, embedded and sciencific computing :P
20:03:42FromDiscord<mratsim> https://github.com/numforge/laser/tree/master/laser/lux_compiler
20:03:55FromDiscord<mratsim> you forgot multithreading
20:04:20Zevvyeah leorize, you forgot multithreading
20:04:23FromDiscord<dom96> embedded too? What kind of embedded stuff are you working on?
20:04:26giacoI've spent time to convert all casts to gentle type conversion and I was happy as it was compiling successfully, but at the end I got "Error: unhandled exception: invalid object conversion" at runtime. That's sad
20:04:28FromDiscord<mratsim> scientific computing does have a lot of code though I wonder how they shipped things before Docker
20:04:37FromDiscord<mratsim> I'm not doing embedded.
20:04:58FromDiscord<dom96> leorize: tut tut
20:04:59FromDiscord<mratsim> but cryptography happen to be one major use case for embedded
20:05:10FromDiscord<mratsim> so i write all crypto code with embedded in mind
20:05:22leorizeembedded is just what I derive from mratsim constant reference of "no GC so it works on embedded" :P
20:05:28leorizeno heap*
20:07:23FromDiscord<dom96> I'd love to know what devices he'd like his code to run on, everything I've seen so far that I'd ever want to use can deal with heap allocs
20:08:24FromDiscord<mratsim> That is the most popular crypto device out there: https://www.javacardos.com/store/javacard-a40cr.php
20:08:33FromDiscord<Avatarfighter> Javacards are so coo
20:08:36FromDiscord<Avatarfighter> cool
20:08:43FromDiscord<mratsim> mmm it does say support GC
20:08:50FromDiscord<Avatarfighter> cant believe a jvm runs in our sims and ccs
20:08:50FromDiscord<mratsim> sent a long message, see http://ix.io/2LOM
20:09:31FromDiscord<mratsim> but anyway, for crypto, you want to precisely control allocation because you might want to use an encrypted allocator anyway
20:10:36FromDiscord<mratsim> and for the current crypto I'm working on, it's GPU operation that are more interesting
20:10:46leorizeso the only reason that io2 uses Result[T] is that the security auditors don't want unhandled exceptions?
20:11:10FromDiscord<mratsim> attack vector for on memory allocators: https://arxiv.org/pdf/1903.00503.pdf
20:11:52FromDiscord<mratsim> memory retention attacks: https://spacetime.dev/memory-retention-attacks
20:12:04FromDiscord<mratsim> encrypting secrets in memory: https://spacetime.dev/encrypting-secrets-in-memory
20:12:05*Arrrrrrrr quit (Quit: Arrrrrrrr)
20:13:12FromDiscord<mratsim> @leorize, no, we force raises: [Defect] for part of the code that uses exceptions
20:13:20FromDiscord<dom96> Wouldn't some more formally verifiable be a huge advantage for these security conscious applications?
20:13:26FromDiscord<mratsim> yes
20:13:37FromDiscord<dom96> or would that swing the balance towards "too slow to develop" too much?
20:13:59leorizewait so what is the exact reason behind io2 using Result[T] then?
20:14:29leorizethat threw me into a loop when I have to decide whether to use Result or exceptions for nim-sys
20:15:00FromDiscord<mratsim> our main dependency is being formally verified https://github.com/GaloisInc/BLST-Verification
20:15:39FromDiscord<mratsim> and ther eis a growing movement toward formally verified crypto: https://github.com/mit-plv/fiat-crypto#reading-about-the-code
20:16:19FromDiscord<mratsim> @leorize Exceptions should be exceptional
20:16:42FromDiscord<mratsim> network lost or file missing is something that we can't decide whether it's exceptional or not in a library
20:16:57FromDiscord<mratsim> the user should handle all cases and not only optimize for the happy path
20:17:27FromDiscord<mratsim> And there are even tools to formally verify crypto assembly code: https://project-everest.github.io/assets/vale2017.pdf
20:19:16leorizeso it boils down to the policy behind exceptions that Status uses
20:20:00FromDiscord<dom96> Just make a wrapper that catches any exceptions you consider non-exceptional and return a Result[T], done ๐Ÿ˜›
20:20:09leorizeI was worried that I miss some niche use cases :P
20:21:08FromDiscord<mratsim> @dom96 We do that for in some cases
20:21:12leorize@dom96: their result library do have that, but I guess they want to stick to the policy for something made in-house.
20:21:25FromDiscord<mratsim> but we don't have a set policy because it's controversial within the team
20:21:44FromDiscord<mratsim> appart from specify out loud the exceptions that you throw if you throw some
20:22:14disruptek<mratsim> @leorize Exceptions should be exceptional
20:22:16disruptekthank you.
20:22:51FromDiscord<mratsim> you're welcome
20:24:25FromDiscord<dom96> Really depends on your definition of "exceptional"
20:24:54*Jehan_ joined #nim
20:25:16leorizeat this point I just do whatever that's mainly done in the language
20:25:36leorizeI'm out of arguments against exceptions with --exceptions:goto
20:26:55ForumUpdaterBotNew thread by Adnan: How to serialize/deserialize my data type with options and DateTime, see https://forum.nim-lang.org/t/7378
20:33:13FromDiscord<exelotl> @dom96 I avoid any heap allocation in GBA dev, it's entirely possible (arc works!) but I don't want the performance hit
20:33:57Zevvleorize: what *were* your arguments then?
20:38:23FromDiscord<exelotl> the sources of overhead are numerous - you have the cost of invoking malloc, the cost of reference counting, and additionally the heap lives in external work RAM which is slower to access.
20:40:43leorizeZevv: The high cost when exceptions occurs in zero-cost exceptions models and the non-deterministic properties of setjmp/longjmp used by "normal" exceptions implementations
20:41:44leorizeI read about them wayy back when I was first into programming, so some of them might just be myths :P
20:44:00*Jehan_ quit (Quit: Leaving)
20:44:33Zevvthere's too many opinions involved when talking exceptions
20:47:18*narimiran quit (Ping timeout: 256 seconds)
20:48:17*natrys quit (Quit: natrys)
20:53:50FromDiscord<mratsim> there is the cost but there is also coding only for the happy path and forgetting to handle a file missing for example
20:56:06*jkiesian joined #nim
21:00:54leorizeto be fair, if anyone forgot to handle that I won't hold my hopes that they don't `discard` the Result[T].
21:01:35FromDiscord<shadow.> lol yeah
21:02:52leorizespeaking about those, I should add a classifier `proc` for error codes so people can match "File not found" cross-platform.
21:21:14disruptekwhy can't you use the existing platform errors?
21:23:12*shirty quit (Quit: Connection closed)
21:23:26leorizeyou expect developers to figure out all the myriad of ENOENT and whatever that is that Microsoft use?
21:23:46disruptekno, either give me a converter or give me a fatter type.
21:24:12leorizeI'm adding a proc to help classify them, it's not like I'm not giving you the raw errors :P
21:24:30*disruptek shrugs.
21:24:51disruptekyou may be forget what i wanted to rant about.
21:24:56disrupteks/may be/made me/
21:25:14leorizeOverlapped I/O is async, right? https://devblogs.microsoft.com/oldnewthing/20180725-00/?p=99335 :)
21:25:29disruptekanyway, exceptions are for situations you cannot handle. not code paths that may be anticipated.
21:26:24leorizeI don't know whether I should just make a thread pool and get rid of this overlapped i/o code that I spent a day writing...
21:27:03*superbia quit (Quit: WeeChat 3.0)
21:27:04leorizedisruptek: it's still too subjective
21:27:30disruptekwhich part?
21:27:56leorizeRust is one of the place where they tried out the concept, and last time I checked, running out of disk space gets you a panic
21:28:20disruptekwell, that's silly.
21:28:29leorizewe're also doing something similar in Nim with Defect vs CatchableError tbh
21:28:36disruptekwell, that's silly.
21:30:02leorizeno, I meant the separation between "errors that can be handled" vs "fatal errors"
21:30:18leorizethough we are classifying them as "bugs" vs "errors"
21:30:23leorizeafaict, that is
21:30:53disruptekIndexDefect is a bug; that's obvious, right?
21:31:07disruptekbut asking for a resource from the os and being denied... that's not a bug, is it?
21:31:16disruptekno amount of additional code is going to solve it.
21:32:21leorizeI don't know, if you stick your pole into the wrong hole (Windows and their stupid path namespaces), it's a bug, and yes, more code will solve it
21:32:41disrupteki've gotten more than a few bugs from sticking my pole in the wrong hole.
21:33:23disruptekif more code will solve it, then i guess it's not a defect.
21:33:31leorizeWhat you get will be an error code like "file not found" or "this device is not available" if you forgot that Windows have path namespaces. Are they fatal then?
21:34:01disruptekENOTFOUND is not a defect, though.
21:34:18disruptekKeyError is an Error and not a defect.
21:34:47leorize"CON", "COM", etc. are only special under the win32 path namespace, and not under the nt path namespace
21:35:03leorizeand they are definitely not special on linux
21:35:24leorizeyour code use that and you run it on windows, it errors with "file not found"
21:35:28leorizethat's a bug in your code
21:35:58disruptekand more code would solve it, right?
21:36:15leorizeyes, you need some sauce to convert it to NT paths but that's about it
21:37:27disrupteklet's say that a defect is when the programmer and the code don't agree on the semantics.
21:37:49disruptekIndexDefect -- you think you should be able to access an index that doesn't exist.
21:38:06disruptek"CON" you think you should be able to treat a special file as unspecial.
21:38:36disruptekis running out of space the same as trying to access an index that is not available?
21:38:43*Clonkk[m] left #nim ("User left")
21:38:48leorizenah, out of space is a property of writes
21:39:32disrupteki guess it's subjective after all.
21:39:47*l1x quit (Quit: Connection closed for inactivity)
21:51:23FromDiscord<Avatarfighter> Yo yo yo whatโ€™s popping
21:51:44disruptekno, we're not doing that.
21:52:29disruptekclyybber: how did we decide how to do dist? a cfg file?
21:53:43FromDiscord<Avatarfighter> disruptek: whats popping
21:53:48FromDiscord<Avatarfighter> ๐Ÿ™‚
21:53:53disruptekdamnit i will choke you out.
21:54:22FromDiscord<Avatarfighter> Hm
21:54:29FromDiscord<Avatarfighter> I will consider your offer
21:55:00FromDiscord<Avatarfighter> how is cps doing
21:55:17FromDiscord<Avatarfighter> Your testes library is working yet?
21:55:23FromDiscord<Avatarfighter> (edit) 04removed "is"
21:55:43disruptekas the kids say,
21:56:16FromDiscord<Avatarfighter> rip indeed
21:57:57FromDiscord<dom96> > Overlapped I/O is async, right? https://devblogs.microsoft.com/oldnewthing/20180725-00/?p=99335 ๐Ÿ™‚โ†ตlol, I hope our customers don't look too closely at asyncfile
22:00:31leorizebtw, the asyncfile code is incorrect regarding synchronous reads :)
22:00:50FromDiscord<dom96> asyncfile is synchronous
22:01:20FromDiscord<mratsim> that's not what the name suggest
22:01:29leorizenever call `GetOverlappedResult()` if you don't set an event handle in the `OVERLAPPED` structure
22:02:47leorizeif you don't set an event handle it will query the file handle instead, which might end up querying an another operation that is currently pending on the same file
22:04:28leorizeI am amazed that Win32 applications even worked at all
22:04:47disruptekwho says they worked?
22:33:29reversem3how does css work with karax?
22:34:00reversem3is after you compile to js and create the html?
22:34:52*krux02 quit (Remote host closed the connection)
22:47:29FromDiscord<juan_carlos> Just add your `class` to the html.
22:50:27*jkiesian quit (Remote host closed the connection)
22:56:27FromGitter<gogolxdong> i
22:56:29reversem3So not a nim file but only in the html file?
22:58:06FromDiscord<dom96> karax generates html for you
22:58:12FromDiscord<dom96> just do what you'd do in html
22:58:51leorizeyou can also build internal styles with VStyle in case you think CSS sucks
22:59:31*tane quit (Quit: Leaving)
23:02:44*piron_ quit (Read error: Connection reset by peer)
23:03:01*piron_ joined #nim
23:05:17*Vladar quit (Quit: Leaving)
23:09:19*PMunch quit (Quit: leaving)
23:47:23*synshroud joined #nim
23:58:54Zoom[m]Guys, do we have a star from Yann Colett and if no, how can we get it? https://i.imgur.com/t9YVy8v.png