<< 22-12-2020 >>

00:02:21*Tanger joined #nim
00:10:19*Gustavo6046 quit (Quit: WeeChat 2.9)
00:10:40*Gustavo6046 joined #nim
00:15:53FromDiscord<19> is it possible to bind to a C header that has macros directly from nim or do i have to c2nim it first?
00:20:51miprisure. no.
00:22:25FromDiscord<19> im getting an error "expected ; before void" and im just using importc and header pragmas
00:22:44FromDiscord<19> usually in c2nim you just add #def
00:27:08*disruptek throbs.
00:28:04FromDiscord<19> oh no
00:29:54FromDiscord<19> another question: i am using a dll from a c lib and an so from the same c lib. on linux it acts weird, on windows it's fine. why is there a difference if they are both generated from the same library? im so confused
00:31:32mipriI really have no idea what you're asking when you're distinguishing between "a dll" and "a c lib".
00:31:51FromDiscord<19> sorry, dll and so
00:32:04mipri"a dll" from "a so" is still meaningless.
00:33:00FromDiscord<19> i have a c library, from it i made a dll which i linked to nim and an so which i also linked to nim.
00:34:37mipriOK, so you're speaking of the C source as a separate thing from the two shared objects that you built from it. And you're linking both of them at the same time, while calling one of them a dll and one a so?
00:35:16FromDiscord<19> i ran them one on windows and one on linux
00:36:00mipriOK so you have some C source, from which you've built a library, and you're using that library on Windows and on Linux. And your question is "on linux it acts weird"
00:36:47FromDiscord<19> yes
00:36:55mipriwelp you've got some kind of bug. Maybe your code is completely wrong but it's not punished on Windows for some reason. Maybe your code is fine but on Linux you're loading the wrong .so and not noticing this.
00:37:11FromDiscord<19> its supposed to act the same using the same nim code right?
00:38:34FromDiscord<19> that C source is supposed to generate only one so per platform. so there is only one .so
00:41:12FromDiscord<19> sighs
00:48:38*j-james joined #nim
01:05:30FromDiscord<sealmove> @giaco hey! the plugin system is ready 🙂 you can check the documentation.
01:06:30giacosealmove, hello!
01:08:48giaconice! I've upgraded your object variant based example to host data only cases! It works nice (I can show you if you want), but I have a question that might improve my code and potentially binarylang too
01:09:18FromDiscord<Quibono> @treeform Do you think Fidget could be used as the UI for a web browser?
01:09:22FromDiscord<sealmove> Unfortunately they can't be used for converting a field to `Option` or for TLV, as I hoped, but I think they are still very cool since you can chain arbitrary operations on a field. For conditionals and TLV I am considering implementing a feature internally.
01:09:48FromDiscord<sealmove> @giaco great! go ahead and ask
01:11:59giacosealmove, have a look at line 9 here https://termbin.com/8m1b
01:12:25giacoquestion is: it is possible to declare a field that should read everything up to the end of the stream?
01:13:27FromDiscord<sealmove> before I answer, for parser option use `endian = l`, not `endian = "l"`
01:13:38giacoalso lines 47..49, I'm using get/setPosition to "peek" first bytes to return appropriate object variant. I see there's no peek in bitstreams
01:14:05giacok
01:14:17FromDiscord<sealmove> this is extremely easy: `8: x{s.atEnd}`
01:15:10FromDiscord<sealmove> yeah, I didn't make peek procs
01:16:20FromDiscord<sealmove> they are a little hard to implement for bits, so I haven't done it yet, but I plan to. It will even cancel some current limitations
01:16:49FromDiscord<VVX7> hi, noob question about Marshal lib and ARC/ORC. I see an issue open for deepcopy. Should the Marshal lib be avoided for now?
01:18:17*j-james quit (Quit: time to learn how tls works)
01:18:42FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2J4Q
01:20:41giacos.atEnd works nicely! I forgot that I have s available ^^
01:22:02giacoplay.nim-lang.org Error 502 Bad Gateway?
01:22:54FromDiscord<sealmove> "Due to current limitations of the underlying bitstream implementation, to perform magic, your stream must be aligned and all the reads involved must also be aligned. This will be fixed in the future."↵This is solved if peeks are implemented
01:23:30FromDiscord<sealmove> yes, playground doesn't work for me neither
01:33:13FromDiscord<geekrelief> Yeah avoid marshal for now. I think the recommend packages for serialization are either json, https://github.com/disruptek/frosty, https://github.com/PMunch/protobuf-nim, or https://nimble.directory/pkg/msgpack4nim
01:33:51FromDiscord<geekrelief> I personally use msgpack4nim
01:35:21FromDiscord<geekrelief> Any users of tcc? I'm on windows getting an issue with a missing "handleapi.h" when importing asynchdispatch. Any advice on how to fix this?
01:36:54FromDiscord<geekrelief> I really don't want to use gcc unless I have to.
01:46:39FromDiscord<treeform> @Quibono that's what I am doing now. I generate HTML with fidget.
01:47:12FromDiscord<Quibono> 😮 I'll alpha test it if you make a legit one
01:47:15giacogeekreliev, out of curiosity, why not gcc?
01:59:13Fish-FaceI'm missing some linear algebra
02:17:53*abm quit (Quit: Leaving)
02:20:37*klaufir_ quit (Ping timeout: 264 seconds)
02:40:17FromDiscord<ElegantBeef> Oh shit varriount is typing 😄
02:41:09FromDiscord<ElegantBeef> That's me saying hello
02:41:44FromDiscord<Varriount> @mratsim What do you call switching from a datastructure where columns are stored as arrays, to one where rows are stored as arrays? For example, `[(a: 1, b: 22), (a: 2, b: 33)]` to `(a: [1, 2], b: [22, 33])`?
02:42:10FromDiscord<Varriount> (edit) "datastructure" => "data structure" | "data structurewhere columns are stored as arrays, to one where rows are stored as arrays? For example, ... `[(a:33)]`?" added " `(a: [1, 2], b: [22, 33])` to" | "33)]` to `(a: [1, 2], b: [22, 33])`?" => "33)]`?"
02:42:50FromDiscord<shadow.> the 'ole fliperroo
02:43:05FromDiscord<shadow.> i believe that's the scientific term, at least
02:43:06FromDiscord<ElegantBeef> Depth to breadth
02:43:20FromDiscord<shadow.> precisely what i was going to say pfft
02:43:33FromDiscord<ElegantBeef> I'll give you the ol' fliperroo
02:44:09FromDiscord<shadow.> thank you
02:44:20FromDiscord<shadow.> i made the most useful pr in my life
02:44:24FromDiscord<shadow.> added all of 8 characters
02:44:26FromDiscord<shadow.> i feel so accomplished
02:44:26FromDiscord<ElegantBeef> Nice
02:44:41FromDiscord<ElegantBeef> I still need to colourize more error
02:44:43FromDiscord<ElegantBeef> Join me brethern
02:44:44FromDiscord<shadow.> lol
02:44:51FromDiscord<shadow.> i just added the sequtils import to prelude
02:44:58FromDiscord<shadow.> xflywind gave the ok, just waiting for timothee
02:48:46FromDiscord<Cohjellah> Is Nimx still being developed?
02:48:51FromDiscord<Cohjellah> worked on
02:49:44FromDiscord<ElegantBeef> Considering it had a commit 12 days ago, probably
02:55:10FromGitter<iffy> I have a process running `p = startProcess(...)`. I'm reading lines from stdout in a separate thread. What's the correct order to kill things to shut it down without race conditions? I've tried `p.terminate(); p.close(); joinThread()` and various other orderings. They all seem to hang sometimes (not always). Rather than guessing, can someone point me in the correct way to think about how to stop things?
02:56:01FromGitter<iffy> Or maybe I should switch to a peekableOutputStream and skip the thread?
03:01:05giaconim manual says to use spaces instread of tabs, but generated c code uses tabs instead of spaces
03:02:33FromGitter<iffy> Or is there a way to timeout a `stream.readLine()`?
03:12:13FromDiscord<Rika> giaco: yeah, whats the issue with that?
03:12:32giacoabsolutely nothing :D just curious
03:13:38*ex_nihilo joined #nim
03:14:25FromDiscord<ElegantBeef> The reason nim doesnt support both is to ensure there is only one type in all files, the reason it's spaces is due to the fact that tabs are annoying in some editors
03:16:50disrupteki really believe it's just because guido said he wishes he'd made it spaces-only.
03:16:51mipriiffy: strace your process to see what it's hanging on. The easiest way to time out I/O is to use an ioselector with a non-infinite timeout. How you should clean up depends on precisely what you're doing.
03:18:06disruptekwhy would you not want to use tabs instead? it's ridiculous.
03:18:35FromGitter<iffy> mipri: hmm... My trouble is -- it has never hung locally. It only sometimes hangs when running in CI. It's probably too much to look at, but here's what I'm doing exactly: https://github.com/iffy/wiish/blob/master/tests/test_build.nim#L405-L453
03:20:01FromGitter<iffy> I guess I could add more debug statements to see if it's hanging on the readLine or not
03:20:40disruptekiffy: golden's invoke.nim (or similar) does async process handling without hangs. maybe i'm doing something there that you aren't.
03:21:18FromGitter<iffy> I'll look
03:21:53FromDiscord<ElegantBeef> Well i'd prefer tabs as it gives the user the ability to customise the rendering without changing the file
03:22:16FromDiscord<ElegantBeef> Ah you said "not want to"
03:22:36FromDiscord<ElegantBeef> I'm terrific at reading as long as it's meant to be read wrong
03:26:35FromGitter<iffy> disruptek: do you run golden on Windows, too?
03:28:08giacoI hate tabs, I'm happy about nim space-only policy. I just opened a generated .c and I went ewww
03:28:57FromDiscord<ElegantBeef> why do you hate tabs?
03:30:51disruptekiffy: it supposedly builds there, but i don't run windows.
03:38:04leorize[m]imho "customizing" rendering is tab's worst function
03:39:11leorize[m]disruptek: is setup-nim working well?
03:39:22disruptekworks great for me, thank you.
03:39:48disruptekskiplists + arc + windows = crash though. 1.2, 1.4, 1.5.
03:40:07leorize[m]then that's compiler issues :P
03:40:15disruptekyeah, it sucks.
03:40:30disruptekand i guess nimble won't be fixed any time soon.
03:41:03leorize[m]you should open an issue there
03:41:09disrupteki did.
03:41:47FromDiscord<ElegantBeef> Why is that tabs worst function?
03:42:04disruptekthe usual complaint is that they confuse whitespace.
03:42:04leorize[m]and you may want to consider making prebuilts for nimph so that they can be used from CI :p
03:42:33disrupteki know, i need to work on dist.
03:43:09disruptekmaybe i will do that now.
03:45:13leorize[m]ElegantBeef: say, you want to establish a 80-line hard wrapping rule, with tabs where this "80th" line is become a matter of opinion
03:45:19leorize[m]s/line/column/
03:45:58disruptekwell, that's silly.
03:49:02*lum quit (Quit: Lum: Bye!)
03:52:01*Gustavo6046 quit (Quit: WeeChat 2.9)
03:54:05*Gustavo6046 joined #nim
03:55:02*lum joined #nim
03:56:13*lum quit (Client Quit)
03:59:21*muffindrake quit (Ping timeout: 258 seconds)
04:01:24*muffindrake joined #nim
04:11:49giacotab is bad because it is a fat space
04:12:32FromDiscord<ElegantBeef> lol good reasoning
04:33:48FromDiscord<shadow.> anyone know of any prevalent imap libs?
04:44:54FromDiscord<j-james> re: tabs, i too wish nim supported them
04:45:38FromDiscord<j-james> but it does prevent errors similar to how caps ambiguity does
04:48:44*lum joined #nim
04:50:58*spiderstew_ joined #nim
04:51:53FromDiscord<ElegantBeef> It technically does if you want to use source code filters, but dont use source code filters 😄
04:54:48*spiderstew quit (Ping timeout: 272 seconds)
04:57:15*narimiran joined #nim
05:01:00FromDiscord<ElegantBeef> Anyone got a easy way to get something like the "annotate with gcsafe" message?
05:02:30FromDiscord<ElegantBeef> Wondering how the effect problem messages should be coloured
05:15:16FromDiscord<$not> sent a code paste, see https://play.nim-lang.org/#ix=2J5L
05:19:41FromDiscord<shadow.> maybe waitFor main instead of discarding
05:19:52FromDiscord<shadow.> (not how to fix just a suggestion)
05:20:00FromDiscord<ElegantBeef> I dont even see `list` in the imap module
05:21:17FromDiscord<shadow.> you can auto generate docs for modules right?
05:21:43FromDiscord<shadow.> you could do that and look at the docs, or just read through the module source for a proc that does what you want
05:22:13FromDiscord<ElegantBeef> The module source is only a few hundred lines of code
05:22:15FromDiscord<$not> I havent been able to find anything on it but ill keep looking
05:22:25FromDiscord<$not> can you link @ElegantBeef
05:22:38FromDiscord<ElegantBeef> If you installed the module you already have it
05:23:45FromDiscord<shadow.> should be in your nimble folder or just use github
05:23:53FromDiscord<ElegantBeef> It's not on github 😛
05:23:58FromDiscord<ElegantBeef> https://git.sr.ht/~ehmry/nim_imap/tree/master/item/src/imap.nim
05:25:38disruptek!last shashlick
05:25:38disbotshashlick spoke in 12#nim-offtopic 4 weeks ago
05:26:00disrupteki really hope he's okay.
05:26:14disruptek!last alehander92
05:26:14disbotalehander92 spoke in 12#nim-offtopic 2 weeks ago
05:26:27FromDiscord<ElegantBeef> @$not you'll probably have to replicate https://github.com/python/cpython/blob/3.9/Lib/imaplib.py#L591
05:29:09FromDiscord<shadow.> @ElegantBeef i believe hes using a dif module
05:29:13FromDiscord<shadow.> !repo imap
05:29:14disbothttps://github.com/forlan-ua/nim-imap -- 9nim-imap: 11 15 2⭐ 1🍴 & 1 more...
05:29:24FromDiscord<shadow.> not that one nvm
05:29:31FromDiscord<shadow.> it's the "1 more" lol
05:30:39FromDiscord<ElegantBeef> Well it again doesnt have `list`
05:34:58FromDiscord<ElegantBeef> nimap actually seems like it'd work for them
05:35:02FromDiscord<ElegantBeef> It has a list proc
05:35:55FromDiscord<$not> looking into it
05:38:31FromDiscord<$not> This might be it actually, testing rn
05:43:35FromDiscord<$not> Youp seems to have everything, read, delete, all that ty ty
06:19:10FromDiscord<geekrelief> gcc can take 3-7x as long as tcc to compile.
06:45:06FromDiscord<AwakenAgain?> hi guys, im new here and would like to somewhat understand, what kind of language is NIM?
06:45:34FromDiscord<ElegantBeef> A statically typed systems programming language
06:45:39FromDiscord<ElegantBeef> Or a very good one 😛
06:47:06FromDiscord<ElegantBeef> What do you mean "what kind"? 😄
06:47:23FromDiscord<AwakenAgain?> so like C++?
06:47:57FromDiscord<ElegantBeef> It's equally capable, but it's different
06:49:19FromDiscord<ElegantBeef> Nim has a JS backend so can be used for webdev, also has a VM so can be used for scripting, so it's a pretty broad language 😄
06:49:27FromDiscord<AwakenAgain?> hmm
06:49:48*habamax joined #nim
06:50:39FromDiscord<AwakenAgain?> so NIM in itself is only the frontned
06:50:45FromDiscord<AwakenAgain?> and has many backends?
06:50:51FromDiscord<mratsim> SoA and AoS, Array Of Struct and Struct of Array
06:51:12FromDiscord<ElegantBeef> It uses C/C++ as an IR, so yes that's a fair asssumption imo
06:51:29FromDiscord<mratsim> we don't use this distinction in science though, it likely comes from game programming
06:51:31FromDiscord<Varriount> Thanks.
06:51:49FromDiscord<AwakenAgain?> @ElegantBeef may i ask u smth in private?
06:51:57FromDiscord<AwakenAgain?> its getting confusing here^^
06:52:04FromDiscord<ElegantBeef> I suppose you could
06:52:07FromDiscord<AwakenAgain?> kk
06:52:28FromDiscord<Varriount> mratsim: Basically, I was dealing with a form data structure containing a table, where the table was being returned as a struct of array, but it needed to be transformed into an array of struct
06:53:03FromDiscord<Varriount> mratsim: Thanks. Basically, I was dealing with a form data structure containing a table, where the table was being returned as a struct of array, but it needed to be transformed into an array of struct
06:53:43FromDiscord<Varriount> And I'm doing this while working with someone that hasn't done this kind of data structure manipulation before.
06:53:55*waleee-cl quit (Quit: Connection closed for inactivity)
06:54:19FromDiscord<mratsim> the basic way to handle that is to have an "init, update, finish" setup with a context.
06:54:38FromDiscord<mratsim> The context hold internally either a SOA or a AOS depending on your preferred representation
06:55:22FromDiscord<mratsim> you have update[T](ctx: var Context, input: (openarray[T], openarray[T])
06:55:42FromDiscord<mratsim> and update[T](ctx: var Context, input: openarray[(T, T)])
06:56:10FromDiscord<mratsim> build on top of individual update[T](ctx: var Context, a, b: T)
06:56:25FromDiscord<mratsim> the individual update can consume both version
06:57:28FromDiscord<mratsim> here is an example, the individual update can accept 1 public key, 1 signature, 1 message: https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/blst_min_pubkey_sig_core.nim#L302-L313
06:58:20FromDiscord<mratsim> and on top I build 2 overloads that can handle both SoA and AoS: https://github.com/status-im/nim-blscurve/blob/master/blscurve/bls_sig_min_pubkey.nim#L154-L199
07:00:28*vicfred quit (Quit: Leaving)
07:16:05FromDiscord<mratsim> @Araq, nnkGotoState is not documented :/
07:29:07*Tanger quit (Remote host closed the connection)
07:45:35*PMunch joined #nim
07:56:25PMunchJust a heads up, FOSDEM (which this year is online), is now accepting talks, and the deadlines for some rooms are coming up soon
07:57:14PMunchWe had a lot of great talks during NimConf this year, and I hope some of our great speakers have the possibility to submit talks to FOSDEM as well.
08:02:48FromDiscord<ElegantBeef> ~~Dont look now but pmunch was one of those that was in nimconf this year, he's complimenting himself~~ 😄
08:03:13PMunchHaha, I was talking about all the other great speakers :P
08:03:21FromDiscord<ElegantBeef> "other"
08:05:37PMunch...
08:05:39FromDiscord<ElegantBeef> Dont worry pmunch i'll let you do `embedding nimscript pt2: nimscripter` for nim conf 2021 😛
08:05:55PMunchYou don't wanna do it?
08:06:35FromDiscord<ElegantBeef> I've got the voice for a 1920s movie
08:07:04FromDiscord<ElegantBeef> Guess the joke is "Got the voice for writing"
08:07:26PMunchHaha :P
08:07:37PMunchI mean everyone thinks their voice sounds weird on recordings
08:08:59PMunchHmm, I'm considering to submit a talk for the "Declarative and Minimalistic Computing" devroom
08:09:15PMunchWorking title "Optimising for humans - Nim DSL/meta-programming for 0-cost abstraction on microcontrollers"
08:09:21PMunchIt's a bit long though..
08:09:29FromDiscord<ElegantBeef> Just a bit
08:09:59FromDiscord<haxscramper> "Taming C++ - adventures in wrapping fourty years of feature creep"
08:10:11FromDiscord<ElegantBeef> Be cautious with "0 cost abstractions" that term might turn you into a crab
08:10:20PMunchA crab?
08:10:25FromDiscord<haxscramper> кгые
08:10:37FromDiscord<haxscramper> (edit) "кгые" => "rust"
08:11:01FromDiscord<ElegantBeef> Most of the time i hear 0 cost abstraction it's closely related to crustaceans
08:11:40PMunchWhat? :P
08:11:55FromDiscord<ElegantBeef> Rust users usually scream it from their rooftops
08:12:28PMunchRust is a crab?
08:13:08PMunchAah, I see
08:13:15FromDiscord<ElegantBeef> Ferris
08:13:25PMunchWell in Rust 0-cost abstraction is a feat. In Nim it's just the default :P
08:14:46PMunchWhat I've been doing is using meta-programming, small DSLs, and the type system to carry around data on compile-time to make microcontroller code a lot less verbose, but compiling down to exactly the same thing as C
08:47:11FromDiscord<Rika> ~~rust is barely 0 cost~~
08:47:20FromDiscord<Rika> ~~id consider a loss of sanity a cost~~
08:57:53disruptekwhat sanity?
09:01:36FromDiscord<ElegantBeef> Cannot lose what you never had is your point?
09:03:58ehmryElegantBeef, does that imap library still compile?
09:04:25FromDiscord<ElegantBeef> I never tried it
09:04:44ehmryyea, its pretty basic
09:04:46FromDiscord<ElegantBeef> I didnt see anything too standoutish as "no longer supported"
09:16:53FromGitter<yglukhov> Hey guys. Anyone around who knows how asyncnet+ssl works? I'm having weird rare issues in asynchttpclient which lead me to asyncnet+ssl. This line https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncnet.nim#L266 looks suspicious to me. cc @dom96 @Araq @FedericoCeratto @alaviss
09:17:38*Tanger joined #nim
09:27:57*klaufir_ joined #nim
09:32:36*FromGitter quit (Ping timeout: 240 seconds)
09:32:57*FromGitter joined #nim
09:39:06FromDiscord<mratsim> @zevv, @disruptek I think I got an awesome idea to do multithreaded synchronization with either continuations or coroutines with no locks and no atomics, just isolated/move semantics.
09:40:09PMunchThat sounds amazing TBH
09:54:23*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:02:42PMunchHmm, anyone good with c2nim or the other C wrapping tools?
10:03:21PMunchI'm struggling with wrapping Unbound again..
10:05:17FromDiscord<lqdev> elaborate
10:07:01PMunchWell part of the problem is that Unbound declares types like this for some reason: https://github.com/NLnetLabs/unbound/blob/master/util/storage/lruhash.h#L110
10:07:11PMunchAnd then later in the same file comes the actual definition: https://github.com/NLnetLabs/unbound/blob/master/util/storage/lruhash.h#L186
10:07:35PMunchThis leads to Nim creating a double declaration
10:07:54FromDiscord<ElegantBeef> Forward type declaration...?
10:07:57FromDiscord<ElegantBeef> The fuckover
10:08:20PMunchYeah..
10:09:32FromDiscord<ElegantBeef> Time to regex all of those forward decls and replace them with the normal ones and make a PR 😛
10:10:00PMunchWell I'm guessing there's a weird reason for it..
10:12:34FromDiscord<haxscramper> c2nim code does not compile because of mutually recrusive wrapper types?
10:12:35FromDiscord<ElegantBeef> From stacke overflow "struct forward declarations can be useful when you need to have looping struct declarations."
10:13:03FromDiscord<haxscramper> You just need to put all c2nim-generated wrappers in single `type` section
10:15:29FromDiscord<ElegantBeef> Anyone know the config file testament uses for testing, andor why it's turning off `colors`
10:17:10FromDiscord<ElegantBeef> I'm attempting to see all the error tests from `errormsgs` but it seems like testament is shutting off colors as it's not error when it really should
10:17:31FromDiscord<ElegantBeef> (edit) "error" => "erroring"
10:18:27PMunchhaxscramper, yeah I know, but I want to do this automatically..
10:19:15PMunch@ElegantBeef, most applications that uses colours will disable them when it detects it is piping output to something that is not a human-facing terminal
10:19:33PMunchBut you can force them on --colors:on
10:19:38FromDiscord<ElegantBeef> I mean i have
10:19:45FromDiscord<ElegantBeef> I know my code doesnt check if it's a terminal
10:19:54FromDiscord<ElegantBeef> So something is escaping my colours, and not causing errors
10:20:01FromDiscord<ElegantBeef> These tests should fail!
10:20:06FromDiscord<haxscramper> PMunch: I'm pretty sure you can write some `PNode` mover and fix it automatically
10:20:18FromDiscord<haxscramper> That will just collect types in single section
10:20:39FromDiscord<haxscramper> Or find part on `c2nim` that writes code to file and hack around it
10:20:43PMunchHmm, I guess that would be possible..
10:21:10FromDiscord<haxscramper> Do you need example for using `PNode` and `compiler/parser`?
10:21:27PMunchAn example would be great
10:21:32FromDiscord<ElegantBeef> I just want to see atleast one of every error and something isnt playing nice 😄
10:22:06FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2J6Y - this is for parsing string to `PNode`
10:22:57PMunchAnd then change the PNode and write back to a file..
10:23:02PMunchQuite a bit of work
10:23:02FromDiscord<haxscramper> Yes
10:23:12FromDiscord<haxscramper> Well, this is a macro basically
10:23:22*tane joined #nim
10:23:25PMunchYeah I know
10:23:46*lritter joined #nim
10:24:10*lritter quit (Client Quit)
10:24:55*l1x joined #nim
10:25:39*zielmicha__ joined #nim
10:26:48*Evolver joined #nim
10:29:04*nikki93 joined #nim
10:30:32*rayman22201 joined #nim
10:37:02*kinkinkijkin joined #nim
10:42:30ForumUpdaterBotNew thread by Dadadani: Alternative to powmod in Nim, see https://forum.nim-lang.org/t/7276
10:51:41PMunchZevv, any idea why this just spins forever? http://ix.io/2J76
10:54:40*Sembei quit (Ping timeout: 246 seconds)
10:56:17FromDiscord<haxscramper> ~npeg
10:56:17disbotno footnotes for `npeg`. 🙁
10:59:15FromDiscord<lqdev> pmunch i feel like you're overengineering this a bit
10:59:23FromDiscord<lqdev> why not just modify the header file
10:59:39FromDiscord<lqdev> or c2nim output
11:00:42PMunchHmm, this works: http://ix.io/2J7c
11:00:51PMunch@lqdev, because I want it to be automatic
11:01:22PMunchI want to have it in my makefile, so when a new version of Unbound drops it will automatically build a new wrapper
11:01:41PMunchBut it's mostly the types I care about
11:04:21PMunchI only used like three procedures, but I need to look through the types
11:05:16*spiderstew_ quit (Quit: ZNC 1.7.2+deb3 - https://znc.in)
11:05:33*spiderstew joined #nim
11:05:34*abm joined #nim
11:07:36FromDiscord<dom96> @yglukhov what's the issue that you're seeing? SSL has always been a PITA, I can try and help but it's been a while since I wrote this stuff.
11:09:46ZevvPMunch: ! does not consume
11:09:56Zevv(note that I didn't make up that shit myself)
11:10:10Zevvso you're saying "zero or more times something that does not consume"
11:10:19Zevvso npeg goes "sure, you probably know what you're doing, right"
11:10:44Zevvhttps://github.com/zevv/npeg#anchoring-and-searching
11:10:55ZevvYou probably just want * @struct
11:11:05Zevvwhich means "find struct zero or more times, and ignore the rest"
11:11:15PMunchAha
11:11:26PMunchYeah I converted to that and it works
11:11:27Zevvhttp://ix.io/2J7o
11:11:31Zevvright
11:11:41Zevvthere is /some/ level of protection against spinning grammars
11:11:50PMunchOoh, that is much prettier than what I was doing :P
11:12:11PMunchhttp://ix.io/2J7q
11:12:16PMunchThat's what I did ^ :P
11:15:36FromDiscord<dom96> Making progress 😄 https://github.com/nim-lang/Nim/compare/devel...dom96:virtual-async-events-resurrected-fixes
11:16:57PMunchWhy does c2nim fail on this? http://ix.io/2J7t
11:17:17PMunchRight after the #endif it says: Error: identifier expected, but got: * list of access control entries, linked list
11:20:55FromDiscord<haxscramper> Handwritten C parsers be like ... Most likely it just fails to handle this kind of input
11:21:21FromDiscord<haxscramper> Try removing comments too
11:23:22PMunchUgh..
11:24:02PMunchYou'd think someone had written a tool to extract this information from C before..
11:34:12PMunchHmm, now I need to remove all these #ifdef parts because c2nim refuses to parse them
11:34:51PMunchAnd extract inline `enum` types out of the structs as c2nim doesn't support those either
11:35:25PMunchI'm wondering if just writing a mini-c2nim that does this for me would be easier..
11:36:28FromDiscord<haxscramper> hcparse can handle everything above, though at this stage it is major PITA to work with
11:36:46PMunchA bigger PITA than this?
11:36:50FromDiscord<haxscramper> Well
11:36:53FromDiscord<haxscramper> Not really
11:37:03FromDiscord<haxscramper> Let me try now
11:38:02PMunchIf you want to torture test it try it on some of the .h files in the unbound repository on GitHub
11:39:25FromDiscord<haxscramper> I wanted to torture test it on boost libraries
11:39:58PMunchI still haven't found a single tool that can parse these headers..
11:40:22PMunchIt's like they read the C spec and decided to use the most obscure ways of doing things..
11:40:30FromDiscord<haxscramper> though it uses clang so syntax is not a problem, but you need to have complete translation unit
11:41:06FromDiscord<haxscramper> Which means you need to figure out at least include paths
11:51:36FromDiscord<haxscramper> Does this library have some non-default header structure? E.g. can `lruhash.h` produce correct translation unit, or it is one of those multi-file-header-files
11:51:45FromDiscord<haxscramper> That should not be included directly
11:52:19FromDiscord<haxscramper> And insetad used in "public API" header that I need to use when working with the library?
11:54:06PMunchNot quite sure if I get what you're asking
11:56:18*Sembei joined #nim
12:04:34*NimBot joined #nim
12:05:27*haxscramper joined #nim
12:06:44haxscramperAre you supposed to just `#include "lruhash.h"` in your regular C code? E.g. I cannot just `#include "util/storage/lruhash.h"` - it does not compile by itself, because it uses some macros defined elsewhere
12:07:01haxscramperwhich *are not include'd* in the file itself
12:07:31haxscramperSo it seems like there some other file that has like
12:07:32haxscramper#include "macro-defintions.h"
12:07:32haxscramper#include "lruhash.h"
12:08:50haxscramperThere is no `include/*` in the project, so I need to search for all of these "top-level" files and wrap *them*
12:09:44haxscramperE.g. if I figure this out I can just tell hcparse which declaration corresponds to which include etc. For example `<string>` is made up of four headers, none of which canbe parsed on their own
12:10:18haxscramper `"string" : @["basic_string.tcc", "basic_string.h", "stringfwd.h"]` to be precise
12:11:02haxscramperAnd it seems like this library uses the same approach for headers
12:13:08FromDiscord<sealmove> @PMunch hey! I am uploading plugins here: https://github.com/sealmove/binarylang/blob/main/binarylang/plugins.nim and applying them here: https://github.com/sealmove/n4n6/blob/main/parsers/windows/shelllink.nim
12:16:41FromDiscord<squid> sent a code paste, see https://play.nim-lang.org/#ix=2J7L
12:16:47FromDiscord<squid> (edit)
12:17:30FromDiscord<haxscramper> use semicolon for type declaration - `var buffer: ...`
12:17:41FromDiscord<haxscramper> Right now you are assigning type to variable
12:18:09FromDiscord<squid> oh
12:18:23FromDiscord<squid> Thank you
12:23:35haxscramperYes, it seems it uses some kind of trash-tier header file management scheme, at least looking at various `.in` files, `config.h` and others
12:24:55haxscramperSo to use hcparse I first need to figure out how this thing is built and what are the files that actually need to be wrapped, and what should not be touched, include paths etc.
12:29:12haxscrampercan't as int[a] `int[a]` *int[b]*
12:46:58PMunch@sealmove, ooh interesting
12:48:02FromGitter<yglukhov> @dom69 I guess I found the culprit. In `httpclient.nim` result of `parseBody` is never read, so all the errors are ignored. And these errors leave the async system in invalid state.
12:49:27FromGitter<yglukhov> `asyncnet.nim` is ok in this particular case, but I would add a read anyway
13:04:53narimiran!last leorize
13:04:53disbotleorize joined 12#nim-news 20 hours ago and last spoke 733 hours ago
13:14:50narimiranleorize[m], leorize: is it known that (sometimes) while loops break syntax highlighting in nim.nvim?
13:21:38ZevvPMunch: "remove all these #ifdef parts". You'd think someone had written a tool to do that
13:21:45Zevvlike, a C preprocessor or something
13:22:27PMunchHaha, well for that part a tool exists
13:32:46FromDiscord<dom96> yglukhov: hrm, that does sound like a bug. Although in most cases the user should read the body.
13:32:56FromDiscord<dom96> Curious why you're not doing this?
13:41:30FromDiscord<mratsim> @dom96, I think I found some neat idea to do cross thread synchronization of async, generators, streams without locks, atomics or event FD. Have to put my thoughts on paper this evening but we can have zero cost threaded async.
13:43:04*Q-Master quit (Quit: Ушел)
13:45:22FromDiscord<mratsim> This basically uses =sink or isolated to ensure at compile-time only ever one owner of the "something" (coroutines, closure iterators, CPS) that provides data.
13:45:53FromDiscord<mratsim> Also the producer would only create a handle lazily, never touch the "backend" and then it hands it over to the consumer.
13:46:10FromDiscord<mratsim> No need for channel, mutex, condition variable or all that Jazz.
13:46:20ForumUpdaterBotNew post on r/nim by wsdjeg: Use Vim as a Nim IDE, see https://spacevim.org/use-vim-as-a-nim-ide/#.X-H3nNVGhw8.reddit
13:46:25FromDiscord<mratsim> I wonder if it's similar to the rendez-vous points in CSP
13:46:44*Q-Master joined #nim
13:47:28FromDiscord<dom96> Sounds cool 🙂
13:48:42FromDiscord<mratsim> also no need for a buffer
13:49:20FromDiscord<mratsim> only context of the closure iterators/coroutines/continuations is enough.
13:57:35FromDiscord<dom96> I'm hopeful I can get awaitable FlowVars working, maybe even today. Maybe we can iterate on those with your ideas.
13:58:13*Kaivo joined #nim
14:09:41FromDiscord<dom96> Anyone know if testament supports timeouts?
14:11:52FromDiscord<mratsim> we won't need awaitable Flowvar 😉
14:12:00FromDiscord<mratsim> well at least with that design
14:12:29FromDiscord<squid> Is there anything like the "Char" from C in Nim?
14:12:35FromDiscord<mratsim> Though I'll likely put one design as improving closure iterators to be coroutines like
14:12:43PMunch@squid, char?
14:12:49FromDiscord<mratsim> and I have to write a competing design with continuations
14:13:08FromDiscord<mratsim> or implement coroutines as continuations
14:13:35FromDiscord<mratsim> @squid char, cuchar or byte
14:13:49FromDiscord<squid> uint8 might work. Byte also.
14:14:01FromDiscord<squid> Oh
14:14:02FromDiscord<squid> Same thing
14:14:03FromDiscord<mratsim> use char for ASCII char
14:14:10FromDiscord<mratsim> use byte for binary blob
14:14:35FromDiscord<squid> It is to represent rgb values
14:14:36FromDiscord<mratsim> use cuchar, well don't use it apart from autogenerated wrapper where it's to painful to use the proper type.
14:14:40FromDiscord<squid> So 1 byte for r
14:14:49FromDiscord<mratsim> for RGB use uint8
14:14:56PMunch+1
14:15:37Zevvno, use three
14:15:43FromDiscord<mratsim> you might even want to make a RGB-like concept that can handle RGB, BGR and what not: https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/color_conversions.nim#L77-L82
14:15:57Zevvor use treeforms chroma
14:16:02Zevv!repo chroma
14:16:02disbothttps://github.com/treeform/chroma -- 9chroma: 11Everything you want to do with colors, in nim. 15 50⭐ 6🍴
14:16:09FromDiscord<squid> Not really. I am just trying to make a buffer for opengl
14:16:27Zevvbut we're all very helpful anyway, right :)
14:16:36FromDiscord<squid> Yup. 😄
14:17:35FromDiscord<mratsim> uint3?
14:17:47*FromDiscord quit (Remote host closed the connection)
14:18:02*FromDiscord joined #nim
14:19:06leorize[m]yes it supports timeout
14:19:54leorize[m]narimiran: nope, but generally nimsuggest crashes on very random things
14:20:23FromDiscord<sealmove> how do I specify a range with step?
14:20:23FromDiscord<squid> I love that when I run my opengl program it just freezes 😄
14:20:31FromDiscord<sealmove> in set construction
14:20:54narimiranleorize[m]: it is strange because stuff in a proc which has that `while` is not highlighted, and then stuff after it (kinda) is
14:20:59FromDiscord<lqdev> @sealmove you can't
14:21:32PMunch@sealmove in a for loop you can do `countup(0, 10, 2)` instead of `0..10`
14:21:35FromDiscord<squid> I am thinking of just making this opengl stuff in C++ or C as nim just makes it crash 😦
14:21:39PMunchBut in general for ranges you can't do it
14:21:40FromDiscord<squid> Might just be me tho. tbh
14:22:09FromDiscord<sealmove> so i should write a proc that constructs and return a set?
14:22:14leorize[m]narimiran: i guess you found a nimsuggest bug :p
14:22:16PMunchIf it crashes you're probably doing something silly with your data-types :)
14:23:01PMunch@sealmove: toSeq(countup(0, 10, 2)).mapIt(it.uint16).toSet
14:23:14FromDiscord<sealmove> oh great thanks!
14:23:18FromDiscord<lqdev> @squid hey
14:23:18FromDiscord<lqdev> github.com/liquid600pgm/aglet
14:23:21FromDiscord<lqdev> (edit) "github.com/liquid600pgm/aglet" => "https://github.com/liquid600pgm/aglet"
14:23:22PMunchWait toSet might not be defined for the built in sets..
14:23:38narimiranPMunch: is `while p1.len > 0 and p2.len > 0:` really that silly? :P
14:24:05PMunchnarimiran, haha I was replying to @squid
14:24:07narimiranPMunch: i think we got `toSet` recently in devel, but it might be in setutils, or something like that
14:24:33narimiranPMunch: lol, i've seen leorize[m]'s highlight, and automatically read your message too :D
14:24:35FromDiscord<sealmove> @PMunch it works :) but importing `sets` is needed
14:24:59FromDiscord<squid> PMunch, It might be true. The window just freezes. It takes a while to crash. Where can I upload source code to show what I do?
14:25:34FromDiscord<squid> What i do isn't really preferred way to do it in OpenGL
14:25:44FromDiscord<squid> I am just drawing pixels straight to the screen
14:25:51FromDiscord<squid> (edit) "screen" => "window"
14:26:04PMunch@sealmove, then you're using HashSets, just FYI
14:26:07FromDiscord<lqdev> well if you want a simple framebuffer is messing with low level OpenGL really that necessary
14:26:25FromDiscord<sealmove> I see. That's fine/
14:26:34PMunch@squid, ix.io?
14:27:40FromDiscord<squid> Any other site?
14:27:43FromDiscord<dom96> yay heisenbug, threading is fun
14:27:53FromDiscord<dom96> (this is why I avoid threading like the plague :P)
14:28:12FromDiscord<squid> lqdev, https://hastebin.com/asetanaruc.apache
14:28:19*letto quit (Quit: Konversation terminated!)
14:28:25PMunch@squid, pastebin, hastebin
14:28:27*waleee-cl joined #nim
14:28:29FromDiscord<sealmove> oh `toSet` is deprecated, it's now `toHashSet`
14:28:46FromDiscord<shadow.> yep
14:29:15FromDiscord<squid> (edit) "lqdev," => "@lqdev,"
14:29:25FromDiscord<squid> PMunch, https://hastebin.com/asetanaruc.apache
14:30:15*letto joined #nim
14:30:45FromDiscord<squid> I have tried to do this twice and both times it didn't work
14:30:59FromDiscord<lqdev> well… glDrawPixels is deprecated
14:31:09FromDiscord<squid> Ehm.
14:31:21FromDiscord<squid> Might be that 😄
14:31:25FromDiscord<squid> Any other way to do it?
14:31:46FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2J8L
14:32:02FromDiscord<lqdev> give me a few minutes
14:33:01*Tanger quit (Remote host closed the connection)
14:34:39FromDiscord<VVX7> Would someone mind pointing me at a library that shows how to unmarshal JSON to structs when some of the keys might be missing. I've read the example here: https://nim-lang.org/docs/json.html#overview-unmarshalling but I'd like to read through something that applies it
14:36:08FromDiscord<dom96> @VVX7 that example is fairly complete, what are you missing from it?
14:37:30FromDiscord<VVX7> The example makes sense, but my code is littered with Options procs as I build structs and marshal/unmarshal them. So I think I'm not understanding something in how to use Options correctly in this case
14:39:06FromDiscord<VVX7> alternatively, I could just make a proc that checks for fields in the JsonNode and then builds the struct but that feels off. So I'm just looking for something well written I can borrow from to understand the Nim way of doing this.
14:39:49FromDiscord<dom96> I'm curious what your expectation is from other languages, if any
14:40:18FromDiscord<dom96> Optional values have to be handled, there isn't really a way around it that I can see
14:42:43*Vladar joined #nim
14:44:22FromDiscord<VVX7> Sure, makes sense. I'll keep digging.
14:53:25FromDiscord<lqdev> @squid took me a while but that's how you'd do it with modern OpenGL http://ix.io/2J8R/nim
14:53:47FromDiscord<lqdev> feel free to copy paste that and build off of it if you don't wanna care about dirty details
14:54:20FromDiscord<squid> Wait. Is that shaders?
14:54:41FromDiscord<lqdev> yeah.
14:54:52FromDiscord<lqdev> you can't really get far without shaders in modern graphics :p
14:55:08FromDiscord<squid> Then OpenGL might be a bit overkill for me
14:55:31FromDiscord<squid> I want to learn OpenGL but maybe not right now if shaders are needed
14:55:33FromDiscord<Rika> why are they still called shaders i do wonder
14:55:36FromDiscord<lqdev> you can just use SDL2, there's SDL_GetWindowSurface
14:55:44FromDiscord<lqdev> you can do software rendering with that
14:58:43FromDiscord<dom96> if you're doing certain types of games you can get pretty far without shaders
15:00:53FromDiscord<squid> @lqdev, Do you think it will be easier to learn OpenGL without nim?
15:04:18Fish-Facehow do I return an arbitrary element of a set without popping it? do i have to do `toSeq(theset)[0]`?
15:06:05*PMunch quit (Quit: leaving)
15:06:20narimiranFish-Face: `for e in mySet: return e` :D
15:06:30Fish-FaceBLEURGH
15:06:51Fish-FaceI am a firm believer that the axiom of choice should be a first-class concept in every programming language >:(
15:07:50FromDiscord<Rika> lol
15:08:39Fish-FaceZevv: I parsed yesterday's AoC with npeg from the get go, I hope that pleases you. It still got me though that match blocks are executed from the leaves of the tree back, so it didn't work first time.
15:08:54Fish-Face(I would say "from the leaves down" but people often draw trees upside down...)
15:09:57Zevvyeah, it's just how it works for now. Basically, it's modeled after Lua's LPEG, which has had the same behaviour for a long time, so I deemed it safe to do something similar
15:10:07ZevvOpen to suggestions, of course
15:10:23Zevvmore important though, does it please *you*? :)
15:12:27Fish-Facewell, I think that doesn't matter so much, though for me it would be more intuitive the other way around, because often you want to create some structure to capture the child matches into. But I can imagine the higher priority is to do the only executing capture blocks after they are for sure matched
15:14:22*habamax quit (Ping timeout: 246 seconds)
15:22:25FromDiscord<lqdev> definitely not
15:24:32Oddmongerseen in « backend » : « Since JavaScript does not have a portable means to include another module, Nim just generates a long .js file. »
15:25:04Oddmongerand « import / export » ?
15:25:40Oddmongerimport 'foo' from 'foo.js'
15:27:54FromDiscord<Rika> ?
15:29:37Oddmongerthe docs says you cannot include another module, but isn't « import » in js the way to do it ?
15:32:30haxscramperWhen I try to compile this https://wandbox.org/permlink/egxV9gVxznEpXHLi wrapper for C++ constructor I get codegen compilation issue, saying that `procDecl` was not defined in this scope.
15:33:03haxscramperIs it somehow related to `{.compile.}` pragma on toplevel or this is a bug
15:33:56FromDiscord<lqdev> Oddmonger: it's not portable
15:42:27FromDiscord<dom96> hm, there is no way to GC_ref a closure
15:42:41FromDiscord<dom96> Shouldn't that be possible or am I misunderstanding?
15:45:24FromDiscord<Shucks> do we have ftgl bindings somewhere?
15:53:36haxscramperOh, I figured this out - I had `{.push header: "header.hpp".}` which caused `mainFunc()` to not be generated at all, subsequently failing compilation
15:57:21Zevvmy momma always told me, Zevv, she told me, she said, Zevv, she said, Zevv don't do a `{.push header: "header.hpp".}` boy. That'll lead to no good
15:58:56FromDiscord<mratsim> @Zevv, look at those negative overhead C++ coroutines: https://godbolt.org/g/26viuZ
15:59:43ZevvWell isn't that nice :)
16:03:27FromDiscord<dom96> ahh, `system.protect` is the answer to my question above
16:04:58Fish-Facegoshdarnit
16:05:20Fish-Facethe thing I was talking about yesterday - var being both by-ref and mutability - has bitten me again
16:05:24Fish-Facenow I have to declare more variables
16:13:50FromDiscord<For Your Health> Does anyone know of any good reading material to learn about async programming in Nim?
16:22:51FromDiscord<haxscramper> Nim in action book has at least one chapter if not more IIRC
16:25:39FromDiscord<For Your Health> Unfortunately I don't own that book 😢 I am currently wanting to connect to the Coinbase Pro API with websocket.
16:26:10FromDiscord<For Your Health> Should I use asyncnet for that?
16:29:35FromDiscord<dom96> There are websocket libraries you can use. If you're not familiar with async/await at all I would recommend having a look at some guides for other languages (or alternatively you can buy Nim in Action :))
16:30:07FromDiscord<mratsim> ^ this is not a sponsored ad
16:35:56*PMunch joined #nim
16:36:42FromDiscord<For Your Health> At some point I'll probably buy the book. I guess I'll see if I can figure out a library for now.
16:41:05Fish-Facewhy is my forward declaration resulting in an "implementation of <...> expected"? is this a common typo I'm not spotting
16:41:35PMunchTime for AoC day22: https://www.youtube.com/watch?v=TNZyTCGE9CY
16:41:40FromDiscord<lqdev> Fish-Face: what are you forward declaring?
16:41:50Fish-Facederp, it was a typo
16:41:56Fish-FaceI changed the signature in one but not the other
16:42:01PMunchAnd twitch of course: https://www.twitch.tv/pmunche
16:42:16PMunchnarimiran, @shadow. ^
16:42:24narimiranthanks
16:43:27*Kaivo quit (Ping timeout: 256 seconds)
16:43:30Fish-Facewhat speeds are people getting for today's AoC?
16:43:44Fish-Facemy solution is taking 6s for part2, negligible for part 1
16:44:47narimiranPMunch: 20ms before the optimization, 1.5ms after (for both parts)
16:48:08FromDiscord<Quibono> Pssh rookie numbers gotta get those down.
16:48:40FromDiscord<Quibono> Real programmers measure in picoseconds. :p
16:51:09FromDiscord<mratsim> You can measure in picoseconds but don't display it on my screen
16:51:46*Fish-Face quit (Ping timeout: 258 seconds)
16:52:13*Fish-Face joined #nim
16:52:50FromDiscord<Quibono> You more a femtosecond kinda guy?
16:54:03*leorize quit (Ping timeout: 240 seconds)
16:55:07FromDiscord<mratsim> I measure in CPU cycles
16:56:58*leorize joined #nim
16:59:28Fish-FaceI think I missed some lines before reconnecting
17:00:04*xigoi[m] joined #nim
17:12:09ForumUpdaterBotNew thread by Ggibson: Closure vs object benefit?, see https://forum.nim-lang.org/t/7277
17:13:09Zoom[m]I went with deques today, even though I think I could have done it with just a seq and a moving the "top of the deck" index. Interesting, how much faster would it be.
17:14:02PMunchI thought about that as well, but I had implementing it with deques
17:14:35Zoom[m]I suspected you're supposed to use score calculation for hashing, but imlp'd hash for Deque first. Not going to lie, it was slow :P
17:16:58Zoom[m]The only optimization I included, besides the score-for-hash is <spoiler>not recursing if P1 has the Max card</spoiler>. Cut the running time by about 25%
17:17:14PMunchNice spoiler alert
17:17:18PMunchI'm currently streaming part2
17:18:42narimiranZoom[m]: just 25%??
17:19:12narimiraneither your previous code was blazing fast or you're doing that in the wrong place :P
17:20:26Zoom[m]Hm, so what do you think it's gotta be?
17:21:23narimiranZoom[m]: for me it cut down the time from 25ms to 1.5ms. from ~250k times they play some card, to ~10k times
17:22:19Zoom[m]By the way, again, deques were annoying. No slicing (easy to impl, though), no openArray...
17:23:57narimiranZoom[m]: yeah, that bothered me too: i convert to seq and back :'( https://github.com/narimiran/AdventOfCode2020/blob/master/nim/day22.nim
17:24:06Zoom[m]PMunch, make it generic!
17:25:07*letto quit (Quit: Konversation terminated!)
17:26:56Zoom[m]narimiran: Oh, I didn't think to keep the joker in the state so I recalc it for the slices which are bound to next game each time.
17:27:21narimiran:)
17:27:52Zoom[m]But the biggest card changes, since the slices hold just a part of the deck?
17:28:08narimiranyeah, but i guess i can live with that :)
17:28:20narimiranespecially if you tell me your way is slower :D
17:29:02Zoom[m]I do it all on an old N3710 laptop, for what it's worth
17:29:50Zoom[m]Gonna glance at my code later today and compare the speed with yours
17:30:19Zoom[m]I still need to catch up with the weekend tasks
17:34:19ZevvYou know these video's where's this person - typically it's new age style girls - whispering in the mic and making soothing small sounds, as a kind of relaxation ecercise?
17:34:26ZevvI tune into PMunch's streams for just that
17:34:30ZevvI don't listen to a word he says
17:35:00ZevvThat's it, ASMR. Great stuff
17:36:46narimiransame here
17:36:49Zoom[m]You see, Peter, a bit of working on sound and people start calling your streams ASMR :D
17:44:12ForumUpdaterBotNew thread by HJarausch: C++ backend broken ?, see https://forum.nim-lang.org/t/7278
17:45:54Zevvyou should go binaural next
17:48:09Zevvthe absolute intimacy, yeah
17:48:11Zevvman
17:55:18narimiranZevv: imagine the number of lonely software developers who would pay for listening to some programming-related ASMR
17:55:22narimiran$$$, i tell you!
17:56:10narimiranand they don't even have to be lonely! :P
17:57:47disruptekmratsim: if you really want to make a low-level contribution to CPS performance, impl opportunistic tail-call optimization for us. then we'll actually have novel semantics to talk about. 😉
17:58:39*habamax joined #nim
18:00:28FromDiscord<mratsim> sent a long message, see http://ix.io/2Jad
18:00:38FromDiscord<mratsim> so that would be design 2.
18:01:24FromDiscord<mratsim> but in any case, whether we use 1 or 2 I think we can get no synchronization multithreaded async streams or parsers or actors or IO or what not
18:01:34FromDiscord<mratsim> and with no alloc as well 😉
18:02:08FromDiscord<mratsim> I also have some great use cases for stack continuations
18:02:23disruptekyeah, it's just that no-alloc requires another level of indirection, which is a PITA for the developer.
18:02:40disruptekpointers, cast, etc.
18:03:08disruptekit makes our nim less reliably high-level.
18:03:10FromDiscord<mratsim> no you don't need that
18:03:28disruptekhow do you figure?
18:03:54FromDiscord<mratsim> it means that the producer only need to take a handle of the resource but not do anything with it, and then move it to the consumer.
18:04:09FromDiscord<mratsim> and only when needed is the alloc done
18:04:22FromDiscord<mratsim> and if it's a parser for example, there is no alloc because it's one char at a time.
18:04:38FromDiscord<mratsim> so the coroutine is just a stream handle
18:04:48FromDiscord<mratsim> and I think we can do the same with continuation
18:04:58FromDiscord<mratsim> it would be a "continuation handle"
18:05:16disruptekof course, but i'm not talking about singleton rewrites of a proc.
18:05:22FromDiscord<mratsim> the only thing needed is a borrow checker / isolated
18:05:35FromDiscord<mratsim> and you can pass that across threads
18:06:00disruptekyes, that's why we switched to objects.
18:06:52FromDiscord<mratsim> anyway, I have to write those, seems like I lost some stuff I found at lunch :/
18:08:16FromDiscord<mratsim> sent a long message, see http://ix.io/2Jae
18:09:49disrupteki can tell i'm just going to have to resign myself to adding another indirection.
18:10:17FromDiscord<mratsim> no indirection
18:10:35disrupteknot for these cases, no.
18:10:36FromDiscord<mratsim> anyway I didn't look at your stack continuation yet
18:11:26disruptekit's nothing special.
18:11:37FromDiscord<mratsim> for stack allocation, just assume that Araq will give us a way to know at compile-time if a continuation is only used in the current scope or if it escapes
18:11:49FromDiscord<mratsim> if it escapes -> heap
18:11:53FromDiscord<mratsim> if not -> alloca
18:11:56FromDiscord<mratsim> that's all.
18:12:30disruptekyou want to make that decision and take it out of the hands of the programmer?
18:12:54disruptekanything on the heap is a new level. i'd say that's clear enough.
18:13:20FromDiscord<mratsim> but you use ref no?
18:13:23FromDiscord<mratsim> that's heap
18:13:27disruptekand araq doesn't give us that info, anyway -- /we/ tell /him/. 🤣
18:13:37FromDiscord<mratsim> the compiler knows
18:13:52disruptekit's our code that determines the continuation type.
18:14:01FromDiscord<mratsim> it's just that the need didn't manifest yet though it was raised for both Chronos and Weave
18:15:53*a_chou joined #nim
18:16:41disruptekmaybe stack-based continuations should just use a state machine; this would make it a truly zero-cost abstraction.
18:18:15*letto joined #nim
18:20:02disruptekzevv: wdyt
18:20:57*a_chou quit (Quit: a_chou)
18:28:06narimiranPMunch: regarding hashing: scores are also kind of hash ;)
18:36:49*muffindrake quit (Quit: muffindrake)
18:40:03*Arrrrrrrr joined #nim
18:41:11FromDiscord<shashlick> disruptek: I'm good buddy, just pseudo retired
18:41:30disruptekwhew. what are you up to?
18:43:18FromDiscord<shashlick> Effectively catching up on all the real world paperwork I had deferred indefinitely
18:44:02disruptekoh, you're being audited, huh?
18:45:05FromDiscord<shashlick> Well, less boring paperwork than that
18:46:16FromDiscord<shashlick> How's Nim land
18:47:25disruptekit's lonely without you.
18:47:31disrupteki'm surrounded by knuckleheads.
18:47:42FromDiscord<shadow.> for anyone doing aoc, what's the issue with my logic for p2 here? https://play.nim-lang.org/#ix=2Jaz im getting answer too low
18:47:45PMunchEy! :P
18:47:52FromDiscord<shadow.> hey pmunch
18:47:52disrupteksee what i mean?
18:48:14FromDiscord<shadow.> appreciated
18:50:06FromDiscord<shashlick> :)
18:50:37PMunch@shadow. you play your recursion games with all your cards
18:50:50PMunchIt should only play with N cards where N is the value of the card you picked
18:51:14FromDiscord<shadow.> ohh
18:51:18FromDiscord<shadow.> starting from front or back
18:51:23PMunchFront
18:51:26FromDiscord<shadow.> thanks
18:51:35FromDiscord<shashlick> Just lost the motivation, too many dead ends
18:51:47disruptekaww, c'mon buddy.
18:51:49FromDiscord<shadow.> can you slice deques?
18:51:54PMunchSo "4 3 2 5 3 5 2" should recurse with "3 2 5 3"
18:51:58PMunchNope..
18:52:00disruptekshashlick: are you still coding?
18:52:00FromDiscord<shadow.> without doing `deq.toSeq[slice].toDeque`
18:52:02FromDiscord<shadow.> rip.
18:52:08FromDiscord<shadow.> might have to pr that one
18:52:10FromDiscord<shashlick> Nope
18:52:19disruptekwut
18:52:27disruptekare you still working?
18:52:54FromDiscord<shashlick> Yep, day job is good
18:53:27FromDiscord<shadow.> welp that just made me get an even lower answer, pmunch
18:54:09disruptekshashlick: i'm finding this hard to accept.
18:54:21disruptekwhat are you doing with your free time? swinging?
18:54:38PMunchdisruptek, during a pandemic?
18:54:46disruptekpeople /do/ it.
18:54:57disruptekpeople fucking do it, i should say.
18:55:01disruptekor, fucking people do it.
18:55:30FromDiscord<shashlick> Too much effort, questionable returns, no fun
18:56:12FromDiscord<shashlick> But I think the truth is I'm enjoying doing nothing
18:56:38disrupteki get that.
18:56:46disrupteki soon as i find a job, i'm fucking /out of here/.
18:56:48FromDiscord<shashlick> Last thing I want to do is wrestle with some useless CI
18:56:52disruptekikr
18:56:53PMunch@shadow. assuming you sliced it correctly it might be hash collisions
18:56:58PMunchI saw that with my data
18:57:13FromDiscord<mratsim> > maybe stack-based continuations should just use a state machine; this would make it a truly zero-cost abstraction.↵Function calls are fine and can be compiled to no-op probably more easily.
18:57:38FromDiscord<mratsim> if everything is on stack and visible by the compiler.
18:57:43FromDiscord<shadow.> `deckOne.toSeq[0..<cardOne].toDeque`
18:57:47FromDiscord<shadow.> that's my currrent god awful method
18:58:19FromDiscord<shadow.> lemme do some debug echos
18:58:26narimiran@shadow. that's everybody's method. even python isn't much better when it comes to deques
18:58:45disruptekmratsim: i doubt they could be better optimized, and the sm solves the problem of scopes, allocs, etc.
18:59:07FromDiscord<shadow.> hmm i see
19:00:00FromDiscord<mratsim> They can 😉 https://godbolt.org/g/26viuZ
19:00:14FromDiscord<shadow.> welp now im hitting recursion depth lol
19:00:15FromDiscord<shadow.> time to fix
19:00:27disruptekmaybe in a toy, but not necessarily after we rewrite them to procs.
19:00:34FromDiscord<mratsim> C++ coroutines use functions
19:00:43disruptekthis is nim.
19:01:03FromDiscord<mratsim> there is a talk with the internal, we can do this in pure C
19:01:18FromDiscord<mratsim> also LLVM will provides builtin for C++ and Swift
19:01:19FromDiscord<haxscramper> My PR for nim 1.4.2 on goldbolt was merged, so soon they should have latest nim
19:01:28disruptekgood, because we'll have to. also, we'll have to make it work in js.
19:01:29narimirannice!!
19:02:56FromDiscord<mratsim> Also, the more I look into it, the more I think Nim CPS, C++ coroutines and Rust async/await are different views of the same thing.
19:03:40disruptekgood; lemme add that to my resume real quick.
19:04:26FromDiscord<Quibono> What would be the fastest way to see if a snippet of binary was a subset of another snippet of binary?
19:04:38FromDiscord<mratsim> i.e:↵- Start lazily, this makes it easy to share because there is no state/read at start: no need for atomics or locks↵- Dropping the coroutines, not awaiting, not calling the continuation == continuation
19:04:52FromDiscord<mratsim> @Quibono I use vim binary diff
19:05:03FromDiscord<mratsim> but you can to binary grep
19:05:16FromDiscord<Quibono> I mean like programmatically in Nim
19:05:18FromDiscord<mratsim> == cancellation sorry
19:05:50FromDiscord<Quibono> Trying to see if I can speed up some text comparison operations by working on the binary
19:05:59Zevvdisruptek: i dont know whay pros or cons of a fsm would be
19:06:29FromDiscord<mratsim> FSM can be visually checked if it's implemented in Synthesis 😛
19:06:36FromDiscord<mratsim> also formally verifiable
19:07:08disruptekthey are equal, but we don't have the concept of the env in the fsm.
19:07:09FromDiscord<mratsim> and your overhead is guaranteed, just a goto, while function call need push/pop the stack and register.
19:07:12disruptekno passing, no calls, etc.
19:08:33FromDiscord<mratsim> btw the closure iter implementation in Nim is building a state machine
19:09:18FromDiscord<mratsim> it uses something called "nnkGotoState"
19:09:29FromDiscord<mratsim> but no documentation :/
19:09:29FromDiscord<shadow.> pmunch: did yours win by the recursion stopper as well?
19:09:38FromDiscord<shadow.> or rather is that the only way it can stop it
19:10:29PMunchHuh?
19:10:40FromDiscord<haxscramper> I'm not sure, but if you store binaries just as array of bytes/`string`/ you can just `find` substring in main string?
19:13:35FromDiscord<shadow.> oh shit wait a minute
19:13:39FromDiscord<shadow.> i think i know the issue
19:15:13*Cthalupa quit (Ping timeout: 264 seconds)
19:15:42*Cthalupa joined #nim
19:16:25FromDiscord<Quibono> Hrm, okay I'll try that.
19:16:41*PMunch quit (Quit: leaving)
19:17:01FromDiscord<Quibono> Also @disruptek Criterion errors out for M1 macs, do you want me to create an issue?
19:17:11disrupteki'd rather have a PR.
19:17:52disruptekit's likely due to the memory barrier code, which necessarily varies on arm.
19:18:13disruptekhow do you feel about fixing it?
19:18:33FromDiscord<Quibono> I'd be happy to fix it if I knew how
19:18:43disruptektime to learn some arm asm.
19:18:51FromDiscord<Quibono> The error is "cycle counting not implemented on this platform"
19:19:22Zevvdisruptek: no env, where do my locals live
19:19:27disrupteklocally.
19:19:34disruptekwe just lift them.
19:19:41Zevvwhere to
19:19:47disruptektop of the proc.
19:19:57disruptekor, at least, prior to the fsm.
19:20:07Zevvright.
19:20:10disruptekright.
19:20:34ZevvI feel how this should be equivalent
19:20:39Zevvbut i dont see it yet
19:20:49disrupteksame same but different.
19:21:06disruptekdifferent enough that it may practically require a separate impl.
19:22:51disruptekzevv: what it buys us is no need for a trampoline.
19:23:01disruptekno heap allocs.
19:23:22FromDiscord<haxscramper> Nim `1.4.2` is now available on godbolt
19:23:41narimiranbravo! will you make a forum post about it maybe?
19:24:06FromDiscord<haxscramper> well, this just a small fix, I don't think there is much to talk about
19:24:24ForumUpdaterBotNew thread by Geda: Finally found a language which is as fast as C and as Pythonic as possible..., see https://forum.nim-lang.org/t/7279
19:24:27narimirani'll tweet about it at least :)
19:25:00FromDiscord<haxscramper> oh
19:25:11FromDiscord<haxscramper> I think if you could come up with some example
19:25:34FromDiscord<haxscramper> For difference between let's say 1.20 and 1.4.2 for ARC, it would be even better
19:25:35FromDiscord<haxscramper> I'
19:37:17Zevvdisruptek: I'm not in anway against it or skeptical, it's just that I don't know yet what it would look like
19:37:29disrupteki feel you.
19:37:33ZevvI know other implementations use this approach
19:37:40Zevvand I have this gut feeling of equivalence
19:38:10*Arrrrrrrr quit (Quit: Arrrrrrrr)
19:38:10ZevvI'm aquinted with the C duffs device trick
19:38:13disruptekremember that the original paper starts off with a goto-based rewrite before lifting into procs.
19:38:22Zevvbut I don't see the memory part of it.
19:38:54disruptekthe memory part is improved because we have no env and no need for tco.
19:39:21*Arrrrrrrr joined #nim
19:39:23disruptekinstead of an env per type, we have symbol-based granularity.
19:39:24Zevvdo you lose your fork?
19:39:31disruptekyes.
19:39:48Zevvhow do you make x instances of something
19:40:00Zevvyou need /some/ allocation for each instance
19:40:05disruptekyes, on your stack.
19:40:21Zevvyes but no but yes but
19:40:30Zevvthat doesn't make sense
19:40:43disruptekyou can alloc on the stack.
19:40:49ZevvI do accept on a socket and 'instantiate' a client in a local var
19:40:51Fish-FaceAh, I guess my slowness is because I didn't use deques
19:41:12Zevvin CPS these client locals naturally group into the env
19:41:33disruptekyes, we create a new symbol for you.
19:41:42disruptekit's fine. not any more work than we do now.
19:41:54Zevvhmm. I need to play with it and see what it looks like
19:42:17disrupteki'm pretty sure we can just let mratsim impl it in synthesis trivially.
19:42:36ZevvI believe so. But will it be simple & light and grokkable by non-mratsims?
19:42:49Zevvor is it super effectively streamlined and out of this universe
19:42:53FromDiscord<mratsim> @disruptek sorry it's a video but quote from the C++ coroutiens designer, apparently letting coroutines be functions as long as possible is the best way to optimize them for Clang, MSVC and GCC: https://youtu.be/j9tlJAqMV7U?t=2431
19:43:10disrupteki think it will be simpler to read than our current approach.
19:43:26Zevvit might; I'll see if I cna do some reading up on ths
19:43:36disruptekmratsim: pffbt. 😁
19:44:30FromDiscord<mratsim> synthesis is just 500 LOC 😉
19:45:02disruptekand a toy cps fsm will be like 30-50 lines. there's no trampoline, etc.
19:45:40FromDiscord<mratsim> it's easier than the state machine in closure iterators https://github.com/nim-lang/Nim/blob/v1.4.2/compiler/closureiters.nim#L241
19:46:15disruptekmratsim: here's the thing, we can do high-level optimization of the fsm. these aren't hand-written.
19:46:38FromDiscord<mratsim> but if we figure out the nnkGotoState in Nim maybe we don't need synthesis
19:47:42disruptekwell, i'll let araq speak to that.
19:47:56Zevvcan you whip up some kind of example? take one of my stash toys and show what it looks like, transformed?
19:47:59FromDiscord<mratsim> I assume goto state goto a state :p
19:48:04disruptekit's not strictly necessary afaik.
19:48:08FromDiscord<mratsim> but how do I set a state
19:48:24disruptekyou mean for reentrant use?
19:48:38Zevvwill it rely on C goto?
19:48:45FromDiscord<mratsim> yes
19:48:50Zevvso js is out
19:48:56FromDiscord<mratsim> js has goto
19:49:00Zevvwhat
19:49:06disruptekit will rely upon nim.
19:49:14FromDiscord<mratsim> but i don't know if that compiles on JS, Araq didn't reply
19:49:19Zevvand nim only - that is Good
19:49:50FromDiscord<myphs> Are there actually so many possibilities to create random numbers but not for a range of int64 or is it just me? 😐
19:49:58Zevvid love to see a transformation, just at the same level as how we started with cps. do it by hand once to see what it will look like
19:50:06FromDiscord<mratsim> or maybe it doesn't have goto? https://alexsexton.com/blog/2009/07/goto-dot-js/
19:50:20FromDiscord<shadow.> pmunch if you're still here
19:50:20FromDiscord<shadow.> https://play.nim-lang.org/#ix=2Jb8
19:50:24FromDiscord<shadow.> fixed the indexing thing
19:50:28FromDiscord<shadow.> still seems to be falling short
19:50:41FromDiscord<mratsim> @myphs you can short circuit your CPU and read the memory after, guaranteed randomness 😉
19:51:02FromDiscord<mratsim> "Summer of Goto" :p
19:51:30FromDiscord<mratsim> I'll check if synthesis compiles in JS
19:51:41FromDiscord<myphs> That's actually my current approach, but I got into a CPU shortage recently 🙄
19:52:11FromDiscord<mratsim> @zevv, @disruptek, why is Araq worried about other lang copying CPS?
19:52:31disruptekhe says he's not.
19:52:52FromDiscord<mratsim> Is it because V is looking into Weave? https://github.com/vlang/v/issues/1868
19:52:54disbotProper support for distributed computing, parallelism and concurrency
19:53:17disrupteki mean, i kinda lost my shit when he dropped the paper in the spring or whatever. and iirc he was like, "hey, don't make so much noise about this."
19:53:53disrupteki still think v can teach us something about packed ast, but it's just my opinion.
19:54:11disrupteki mean, iiuc their approach is more what i had in mind for the technology.
19:54:31FromDiscord<mratsim> we need packed json before packed AST imo
19:54:34disruptekaraq told me he is rewriting all my ic shit, so what the hell do i know.
19:54:54disruptekwe already have packedjson and packedast.
19:54:58*superbia joined #nim
19:55:23FromDiscord<mratsim> JsonNode are very ergonomic but oh so wasteful
19:55:40disruptekjason doesn't even compile anymore.
19:56:15disruptekhard to give a shit when getTypeInst is broken.
19:57:04Zoom[m]narimiran: measured your d22p2 and average execution time (with fish time) for 5 runs of yours is 204ms, and 171ms for mine.
19:57:20narimiran-d:danger?
19:57:38narimiranhow can it be 100x slower on your machine than mine?
19:58:17FromDiscord<mratsim> @zevv, total noob with Nim js, I get "fopen is not defined"
19:58:43FromDiscord<mratsim> ah it's because I also dump the graph
19:58:45narimiranZoom[m]: can you share your code?
19:59:39Zoom[m]No danger, just `-gc:orc if defined(release): --opt:speed --passC:"-flto" --passL:"-flto"`
19:59:58Zoom[m]Will push asap
20:00:01narimirancan you try with arc?
20:01:27FromDiscord<mratsim> @zevv Nim compiles goto to a do while(false) with a case switch inside.
20:02:04FromDiscord<mratsim> though I think there is a codegen error somewhere with the state
20:04:58FromDiscord<Quibono> sent a code paste, see https://play.nim-lang.org/#ix=2Jbi
20:06:01Zoom[m]narimiran: https://github.com/ZoomRmc/aoc2020_nim/blob/main/src/aoc22.nim
20:06:12FromDiscord<shadow.> well
20:06:17FromDiscord<shadow.> are you trying to make those bytes?
20:06:20FromDiscord<shadow.> are you forgetting 0b?
20:06:22FromDiscord<shadow.> @Quibono
20:07:06FromDiscord<Quibono> When I have 0b it also gets annoyed at me
20:07:33FromDiscord<shadow.> 0b is byte prefix
20:07:38FromDiscord<shadow.> you can do like
20:07:53FromDiscord<shadow.> `var x: array[3, uint8] = [0b01100100,0b01101111,0b01100111]`
20:08:10narimiranZoom[m]: yours is slightly faster and with less instructions overall
20:09:41narimiranZoom[m]: let me see if it helps to introduce the procs you have for deque slicing, etc.
20:10:02Zoom[m]Good to hear. There's some room for improvement still
20:10:34Zoom[m]I didn't code it for speed at all, except the check before recursion.
20:10:48FromDiscord<Quibono> sent a code paste, see https://play.nim-lang.org/#ix=2Jbl
20:11:00FromDiscord<Quibono> This still gives an error that it was expecting uint8 and got int
20:11:03Zevvmratsim: yeah I see that part, but I don't understand what we do with the stack
20:11:13FromDiscord<Daniel> Intel 765p 1TB seems like cost efficient buy now.
20:11:21FromDiscord<mratsim> @Quibono [byte 01100100,01101111,01100111]
20:11:26*Arrrrrrrr quit (Quit: Arrrrrrrr)
20:11:35FromDiscord<mratsim> (edit) "01100100,01101111,01100111]" => "0b01100100, 0b01101111, 0b01100111]"
20:11:43FromDiscord<mratsim> everything is int by default
20:12:26FromDiscord<Quibono> Okay, thank you. Lol, I'm trying to see if I can make a faster contains for binary data.
20:12:27FromDiscord<mratsim> @Zevv, stack? are you talking about the state machine or the continuation?
20:12:50FromDiscord<mratsim> @Quibono order your data and do a binary search
20:12:53ZevvI think I'm confused
20:13:25FromDiscord<mratsim> the stack is just about where do you put the context of your continuation
20:13:51narimiranZoom[m]: calculating max every time does the trick!
20:13:53FromDiscord<mratsim> if it doesn't escape the caller it can be on its stake and avoid allocation and allow nifty optimization by compilers.
20:14:10FromDiscord<mratsim> @narimiran, did you reply to my blog post proposal?
20:14:39narimiran@mratsim i'm not sure i know what you're talking about
20:14:58Zevvyes but if you yield, it escapes the called
20:15:05Zevvcaller
20:15:12FromDiscord<mratsim> @narimiran: https://gist.github.com/mratsim/61b2e25d098df0634143d501a77d8599
20:15:28FromDiscord<mratsim> no if you yield it returns control to the caller
20:16:01narimiran@mratsim can i read it tomorrow morning? now i'm too tired for serious stuff
20:16:07ZevvI need to actually see this I think. I'm not having a clear head, that also doesn't help
20:16:08FromDiscord<mratsim> of course
20:16:27FromDiscord<mratsim> take a function that returns a value
20:17:00FromDiscord<mratsim> You're at level 0, root, you call the function, in the function you're at level 1, you exit, your back at level 0
20:17:13Zevvsure. but take this for example: https://github.com/disruptek/cps/blob/master/stash/iterator.nim#L39
20:17:16FromDiscord<mratsim> continuation are the same
20:17:24ZevvI instantate 2 of those. Where do the 'i's live?
20:17:29FromDiscord<mratsim> the only issue is if you return from the caller.
20:17:31Zevvnot on the stack
20:17:46disruptekyes.
20:18:18disruptekvar i_23423423, i_90329223: int
20:18:21FromDiscord<mratsim> it lives on the stack of their caller
20:18:30ZevvWhat if I *dynamically* instantiate them?
20:18:38disruptekdynamically how?
20:18:40FromDiscord<mratsim> a stack is dynamically resizable
20:18:51FromDiscord<mratsim> i.e. use alloca
20:19:07FromDiscord<mratsim> well not the stack but the space you can reserve
20:19:45disruptekremember that we see your code. we see it fully sem'd.
20:19:52disruptekwe rewrite it. that is all.
20:20:16Zevvdisruptek: https://play.nim-lang.org/#ix=2Jbn where do the i's live
20:20:33FromDiscord<mratsim> they don't live, they don't yield, they jive and thei jield
20:20:42disruptekheh
20:21:08FromDiscord<mratsim> on the stack/global in the for loop
20:21:12disruptekyes.
20:21:40ZevvWhat if I create 1 million, and 999.999 terminate
20:21:48disrupteki'm okay with that.
20:22:08ZevvI don't think I am
20:22:21Zevvif I have incoming connections of unknown duration. 1000 coming in every second
20:22:24FromDiscord<mratsim> the stack is automatically collected when you exit the function
20:22:44Zevvthis can't work, either that or I'm too dumb
20:22:56disruptekyou're over-thinking it.
20:23:24disruptekthe syntax doesn't work, but the memory does.
20:23:33FromDiscord<mratsim> This is similar to rust zero alloc futures (actually lower level) and C++ zero alloc coroutines.
20:23:55ZevvI trust you on this, sure
20:23:57FromDiscord<mratsim> Also even in Weave, I have a demo with stack allocation with TRILLIONS of fibonacci compute
20:24:20FromDiscord<mratsim> and continuation have an advantage over wWeave: tail calls
20:24:27Zevvbut with an unbound real world load.
20:24:42Zevvlike I said, I have 1000 connections coming in every second, most of those go away fast but some linger
20:24:46Zevvnew stuff is alloca()ed
20:24:48FromDiscord<mratsim> in the real world you have a timeout 😉
20:24:50disruptekzevv: it gets rewritten to be /simpler/, either the compiler is doing it or we are.
20:24:51Zevvbut old stuff can't be freeed
20:25:10FromDiscord<mratsim> well if you do'nt limit connection you get buffer overflow anyway
20:25:16disruptekthey can be /replaced/.
20:25:27FromDiscord<mratsim> ^ this
20:25:41disruptekwe don't /want/ to alloc or free.
20:25:47disruptekthat's the whole point.
20:25:50Zevvno I get that, sure
20:25:54disruptekyeah.
20:25:58FromDiscord<Daniel> I am noob in programing....but why havent there been any replacement for C...why everything somehow goes down to C, even nim compiles to C, even most python librabriers go to C.↵Is it not weird that some other new(in last 30years) language isnt invented that is more human friendly but knows how to talk to chips like assembly does.?
20:26:02disruptekso you have an array of 1MM continuations.
20:26:09Zevvbut I just don't see the practical consequences adn implications yet
20:26:19disruptekdaniel: because gcc.
20:26:44FromDiscord<mratsim> also @zevv, if you need autofree of alloca-ed coroutines just wrap them in an inline function.
20:26:47FromDiscord<Daniel> (edit) "chips" => "chips(transistors)"
20:26:54disruptekif gcc would just fucking stop porting itself to every damned platform...
20:27:14FromDiscord<Daniel> What do you mean gcc?..because gcc is available everyhwere?
20:27:21FromDiscord<mratsim> pretty much
20:27:23disruptekzevv: "free tco".
20:27:55Zevvok, I'll bite
20:27:59Zevvit'll come to me later
20:28:26FromDiscord<mratsim> @Daniel C stays maybe for the same reason Esperanto has not displaced English
20:28:35FromDiscord<mratsim> despite being new and having plenty of advantages
20:29:37FromDiscord<dom96> It’s because all operating systems expose their API via something that’s compatible with C. Many are even written in C or C++
20:29:37FromDiscord<haxscramper> Because it is "too big to fail" or something like that. So much software is written in C you'd need an entire generation of programmers to rewrite things to something else
20:29:59FromDiscord<mratsim> that's inertia or critical mass
20:30:08Zevvdom96: until you hit android. If you're in C-land, you're not a first class citizen there
20:30:19FromDiscord<mratsim> too big to fail would be people going in drove to save C if it was going to disappear
20:30:28FromDiscord<haxscramper> oh well
20:30:34FromDiscord<haxscramper> wrong wording again
20:30:46FromDiscord<Daniel> Well, android is apparently linux, but its actually huge JVM
20:31:36FromDiscord<Daniel> I am just puzzled how even nobody did Assembly high level version, like ++, #, script...etc
20:32:05FromDiscord<Daniel> i guess as mentioned before, because of compilers
20:34:06Zevvdisruptek: I think what bothers me is that continuations have this nice "free floating" feel to them. They are not bound to *anything*
20:34:31Zevvthey live in a different plane, and have nothing to do with their birthplace
20:34:49Zevvthey pop into existence and just /are/
20:34:53FromDiscord<mratsim> @Daniel the high level assembly is called C
20:34:55disruptekright, but imagine that you picked one up from the heap and put it on the stack.
20:35:07Zevvthen you glue it in place
20:35:12FromDiscord<mratsim> @Zevv, like a variable.
20:35:12Zevvit can't go, it can't move
20:35:15narimiranZoom[m]: i've updated my solution based on your ideas: https://github.com/narimiran/AdventOfCode2020/commit/b87291ebadd1516b7014852fe97c0d105a124e2a
20:35:17haxscramperdisruptek: what do you think about adding `suite "Suite name"` block to testes to make it drop-down replacement for `std/unittest`. And porting other features that are not already present?
20:35:35disruptekif you know that you will never leave the stack, then you know how you can rewrite it even more aggressively.
20:35:40disruptekhaxscramper: i'm fine with it.
20:35:54Zevvdisruptek: I see that
20:36:16FromDiscord<mratsim> it's just a struct that contains a continuation, parameters and that are passed to a rewritten function that accepts aprameters and a continuation
20:36:31Zevvdisruptek: I'm just very limited by any lack of experience or formal background in this stuff
20:36:32FromDiscord<mratsim> so on the stack is the struct
20:36:38Zevvyou can't do this kind of things on the feels
20:36:43disrupteksure i can.
20:36:51Zevvyeah you see where the brought you
20:36:57FromDiscord<mratsim> I have no formal background eeither
20:36:59Zevvhere we are, the deaf and the blind
20:37:04FromDiscord<mratsim> I never took CS courses
20:37:04Zevvand then mratsim comes along
20:37:20disruptekunimpeded by the scientific process, you mean.
20:37:25Zevvhehe
20:37:44disruptekunfettered by expertise or even passing familiarity.
20:38:06Zevvok, let's just go there. I know I'll catch up, these things always take some time for me to grow
20:38:15disruptekbut to most of mratsim's research, i say "i don't care."
20:38:15FromDiscord<mratsim> fettered by time and rabbit holes
20:38:21disrupteki don't really care about how other people do it.
20:38:25ZevvCPS was just so very intuitive once I *got therE*
20:38:56FromDiscord<mratsim> I care why they do it like this and also how
20:39:08FromDiscord<mratsim> because the devil is in the details
20:39:12Zevveven educated fleas do it
20:39:31disrupteksure, but if it doesn't compose with the rest of nim, then it hardly matters.
20:39:53Zoom[m]narimiran: Cool! Now yours beats mine by 10-20%
20:39:53ZevvIf it composes with C++, we should be good, right
20:40:04disrupteki don't want to write c++ in nim.
20:40:07FromDiscord<mratsim> no one composes with C++
20:40:20FromDiscord<mratsim> did you see the poor people trying to access the C++ vtable?
20:40:32FromDiscord<mratsim> no? Well they ran away
20:40:42Zevvtoday I needed to extend a parser written in PEGTL. it was hilarious.
20:41:18Zoom[m]narimiran: I'd feel much more comfortable procrastinating over optimizing day22 the whole night, rather than completing d20p2... :P
20:41:30disruptek!repo disruptek/dist
20:41:31disbothttps://github.com/disruptek/dist -- 9dist: 11a nim distribution 15 1⭐ 0🍴
20:41:43disruptekmratsim: why won't weave submodule here?
20:41:49disruptekin the 1.2.9 branch.
20:42:06disruptekhttps://github.com/disruptek/dist/runs/1596779313#step:8:20
20:42:12FromDiscord<mratsim> sent a long message, see http://ix.io/2Jbr
20:42:19FromDiscord<Quibono> How do I make a proc that can work on arrays of variable size?
20:42:32FromDiscord<haxscramper> Make array size a generic argument
20:42:39ZevvopenArray
20:42:42narimiranZoom[m]: same here :) i'm leaving d20p2 for after christmas IFF i manage to solve all others
20:42:43PrestigeCan macros access information about procs in other files, or just the local file?
20:42:48disruptekyes, that stuff needs rework for arc-sympathy.
20:42:51ZevvPrestige: not even local file
20:42:52FromDiscord<haxscramper> Or use `openarray` if particular size is not important, as zevv zaid
20:43:03Zevvonly what's enclosed in the scope of your macro
20:43:15disrupteknot true.
20:43:19PrestigeZevv: ah. I think this MI implementation would require a compiler change, then
20:43:23Zevvalso not false
20:43:36FromDiscord<mratsim> disruptek: probably because I git cloned instead of gitsubmodule :p
20:43:41disruptekyou can get info about a proc that you're calling from within scope even if it's not impl'd there.
20:43:52Zevvinfo, but not the implementation
20:43:52disruptekmratsim: hmm. it works on 1.4.3 branch.
20:44:00FromDiscord<mratsim> oh?
20:44:09FromDiscord<Quibono> Thank you
20:44:15disruptekseemingly. though arraymancer doesn't pass windows tests.
20:44:18Zevvdisruptek, mratsim: what do I read or watch to get the hang of this new idea?
20:44:28Zevvthe FSM part I trust you on, but more about the mm
20:44:40disruptekwhich part? i think you know more about this than i do.
20:45:58disrupteki guess you could look at the c++ coro impl. it's probably the most accessible to you.
20:46:16PrestigeMaybe I should just dig into the compiler code and see if I can figure something out. Would be similar to `ref object of RootObj` I believe
20:46:39disruptekwhat does MI mean?
20:46:47disruptekmultiple-inheritance?
20:46:51PrestigeRight
20:46:56Zevvok, will do. Now I need to do some social stuff involving a playstation, a beer and loud cursing
20:46:58disruptekshow us some code.
20:47:15disruptekzevv: maybe i'll make a demo late tonight. 👋
20:47:29PrestigeI have the RFC as an example https://github.com/nim-lang/RFCs/issues/262 but I'm not sure how I'd go about writing it
20:47:31disbotSupport for Multiple Inheritence ; snippet at 12https://play.nim-lang.org/#ix=2Jbu
20:47:43Zevvdisruptek: you do that, lovely :)
20:48:10disruptekpestige: you can ignore that rfc; that avahe guy's a bozo.
20:48:16PrestigeI'd love to be able to just write it so I could showcase the implementatin
20:48:20Prestigedisruptek: hah
20:48:52PrestigeI think this would be rather nice to have. Miss MI a lot with Nim and TS
20:49:17FromDiscord<bark> generally what does "cannot instantiate T" point to in generics?
20:49:27disruptekthe lack of a concrete type.
20:49:55disruptekgenerics are like an equation that the compiler needs to solve given limited variables.
20:50:14disruptekgive it some more compile-time constant types to fill those missing holes.
20:50:33Prestigethe main thing I need to find out, is how to get all "methods" of a type (including the code, not just the signature)
20:50:50disruptekprestige: that won't work. it makes more sense for your demo to generate variant objects instead and then rebind the procs to the new type.
20:51:20disruptekwrap the whole thing in a macro so you can rewrite anything you want.
20:51:59PrestigeThat solves like, 40% of it I suppose
20:52:05FromDiscord<mratsim> @Zevv https://github.com/weavers-guild/weave-io/tree/master/research#c-coroutines↵↵the talk in 2017 and 2017 go into the nitty gritty, you have the video and the slides and the code
20:52:10disruptekor don't use variants. just have a pragma in the typedef that generates the chain of inherited types.
20:52:13*habamax quit (Ping timeout: 256 seconds)
20:52:15PrestigeI'd still need the implementations of the methods
20:52:22FromDiscord<mratsim> sorry 2015 and 2017
20:52:27disruptekyou'll have them if you wrap everything in one macro.
20:52:36disruptekthis is just a PoC.
20:52:38*narimiran quit (Ping timeout: 256 seconds)
20:52:41Prestigetrue
20:52:45PrestigeGood point
20:52:52disruptekyou could use term rewriting but i'd recommend against it.
20:52:59FromDiscord<mratsim> Rust async/await also is done on the stack and can disappear but it's a high level construct than continuation and coroutines
20:53:13FromDiscord<mratsim> I don't agree with Araq that async/await should do the whole transformation
20:53:26FromDiscord<mratsim> continuation or suspendable functions should be a primitive
20:53:30FromDiscord<bark> I'm literally calling the procedure with procname[type1, type2]()
20:53:44disruptekbark: got code?
20:54:00FromDiscord<bark> yeah i'm trying to isolate the problem
20:54:40Prestigedisruptek: I'd be creating a new method for the child type, which combines the two implementations from parent classses that clash (the diamond problem), when both of those methods have a similar procCall to the grand-parent class. If that makes sense. It's illustrated in the RFC
20:54:47disruptekyour result type is T1 or T2 and requires-init?
20:54:56PrestigeBut yeah, I could do that in a macro if it's wrapped
20:55:04disruptekprestige: sure.
20:55:39FromDiscord<sealmove> how to convert 2 bytes to a unicode Rune?
20:55:41FromDiscord<mratsim> @zevv actually 2015 "negative overhead" and 2017 "under the cover"
20:55:41disruptekif you want to really do it right, but outside the compiler, you can make a compiler pass. but it's pretty shitty.
20:56:27PrestigeI should probably get familiar with the compiler at some point, anyhow
20:56:57FromDiscord<Quibono> Anyone up to look at my first stab at recursion? It's giving the wrong result and IDK why.
20:57:28Prestige@sealmove have you seen https://nim-lang.org/docs/unicode.html
20:58:00FromDiscord<sealmove> yes, looking at it
20:58:23FromDiscord<sealmove> i have a seq[byte], still no idea how to make a unicode string (i believe unicode is the default of nim):P
20:59:21FromDiscord<bark> nevermind @ disruptek. Thanks for the hint. Apparently I can't read stack traces and had to change to procname[typename, typename]() on multiple places
21:08:53*vsantana quit (Ping timeout: 260 seconds)
21:09:23FromDiscord<Quibono> https://play.nim-lang.org/#ix=2JbC Can anyone see where I'm messing up?
21:09:31*vsantana joined #nim
21:11:37Prestigewell your wIdx is always 0, yes?
21:11:58Prestigeso it's never equal to len(word) - 1
21:11:59FromDiscord<Quibono> Well I want to increment it by 1 every time I get a match
21:12:14FromDiscord<Quibono> So that I search through each letter in the word
21:12:44Prestigereturn on line 11 then
21:13:27Prestigeinstead of just creating a new variable
21:14:11FromDiscord<Quibono> return false?
21:16:06Prestigehttps://play.nim-lang.org/#ix=2JbO
21:16:52FromDiscord<Quibono> Oh weird, okay. That hurts my brain, thank you
21:17:05PrestigeNo prob
21:28:29*ex_nihilo quit (Quit: Leaving)
21:36:18FromDiscord<Quibono> Now the real question is, how long does it take to convert a string into an array of bytes
21:41:15*hnOsmium0001 joined #nim
21:42:54FromDiscord<mratsim> why would you do that?
21:44:36FromDiscord<Quibono> I was just wondering if my search method would be faster once you take the time to convert it, is all.
21:48:44Fish-Facewelp I tried switching to deques and it's either slower or broken or both
21:48:48Fish-FaceI think both
21:55:29*haxscramper quit (Remote host closed the connection)
21:56:58FromDiscord<mratsim> @Quibono use proc search[T: byte|char](input: openarray[T], ...) =
21:57:03FromDiscord<mratsim> thos works on byte and char
21:57:23FromDiscord<mratsim> byte and char are semantically different but at implementation level exactly the same
22:10:12FromDiscord<mratsim> sent a long message, see http://ix.io/2Jcb
22:25:18*Vladar quit (Quit: Leaving)
22:32:53FromDiscord<mratsim> I can't compile tests in CPS anymore :/
22:33:19FromDiscord<mratsim> ah, it's because I have cps installed on my machine
22:33:26FromDiscord<mratsim> nimble grmblbl
22:35:30disruptekno comment.
22:36:51FromDiscord<mratsim> still can't compile
22:37:05FromDiscord<mratsim> SIGSEGV in the latest compiler
22:37:06disruptekyou realize that i merged typed into master, right?
22:37:24FromDiscord<mratsim> yes, but at least one test should pass no?
22:37:27disruptekwelcome to modern cps.
22:37:39disruptekno, nothing works.
22:38:05FromDiscord<mratsim> ah shoot
22:38:19disruptekjust go back a commit or two.
22:38:32disrupteki mean, what are you trying to test?
22:38:36FromDiscord<mratsim> well i wanted to check the codegen of typed
22:38:45disruptekyeah, me too. 😁
22:39:20FromDiscord<mratsim> does that include your stack update?
22:39:51disruptek2cde45410f93690c269f4c95d0eb4bed2c7002ba
22:40:16disruptekit's experiments/main.nim
22:41:22FromDiscord<mratsim> oooh it compiles
22:43:43disruptekit's our testing dispatcher that just does timers or whatever.
22:44:00FromDiscord<mratsim> "Cont(i: 0)" you can create field that don't exist with ref object of rootobj?
22:44:12FromDiscord<mratsim> man I've been missing even more hacky stuff
22:44:15disruptekit's not a ref object.
22:44:22disruptekalso, the field exists.
22:45:10FromDiscord<mratsim> when I look in the event queue file line 49 I see ref object?
22:45:17disruptekwe could benefit from that self-referencial typedef for this, btw.
22:45:44disruptekthe type is defined on line 54.
22:46:13FromDiscord<mratsim> I did try having `type Task = object of Task`
22:46:20disruptekhaha
22:46:22FromDiscord<mratsim> it worked sometimes
22:46:37disruptekit's probably a trap for our own code.
22:51:02FromDiscord<ElegantBeef> Is there a way to force testament to set `--colors:on` for each test?
22:51:24FromDiscord<ElegantBeef> Seems like testament is disabling that option, and causing tests to pass that i dont want to
22:51:36disruptekno one uses testament.
22:51:43disruptekit's all about my testes, now.
22:51:47FromDiscord<ElegantBeef> I mean the nim repo does
22:52:10FromDiscord<ElegantBeef> I'm testing colourized output on the nim compiler and the `errmsgs` category is the best repository of most errors
22:52:53FromDiscord<ElegantBeef> But it seems that it's disabling colors for each test so it passes
22:53:02disruptekgood?
22:53:06FromDiscord<ElegantBeef> No
22:53:12FromDiscord<ElegantBeef> I want them to fail so i can actually see the colouring
22:53:28FromDiscord<ElegantBeef> To see which errors need highlighted still and also what information i should highlight
22:54:25FromDiscord<ElegantBeef> I dont know a better source of all the errors
23:03:39PrestigeThe nim survey was interesting, got me wondering about how we'll attract more developers, where we're lacking. Curious if we need more tutorials
23:03:47Prestigefor the stdlib, popular frameworks, etc
23:04:53ForumUpdaterBotNew thread by B3liever: ECS introduction by example, see https://forum.nim-lang.org/t/7280
23:05:33*muffindrake joined #nim
23:07:43FromDiscord<shadow.> i find when asking my friends that they haven't even heard of nim. once they were pointed to a good learning resource they all loved it, but i think the issue is lack of advertisement and/or marketing
23:07:58FromDiscord<shadow.> and yeah, more third party libraries would probably also help
23:08:34PrestigeIt would be nice to have some sort of "dream list" to know what people that don't use Nim, are missing
23:09:46PrestigeI think most people I talk to have already decided on another language, like go, c, or c++
23:09:59*disruptek_2 joined #nim
23:10:04disruptek_2this is disruptek's alt account
23:10:18Prestigedisruptek_2: imposter
23:11:44PrestigeIt's also difficult to integrate Nim at work because everyone knows and uses X language
23:12:55disruptek_2i am the second disruptek
23:13:01*disruptek_2 quit (Remote host closed the connection)
23:14:57FromDiscord<mratsim> a good DLL story would help
23:15:08FromDiscord<mratsim> for integration
23:15:44disruptekthe dll story is much better with arc.
23:16:05FromDiscord<ElegantBeef> No more `setupGC`
23:16:47FromDiscord<ElegantBeef> Well prestige i'm trying to make the errors more readable, so i hope that helps getting people in here
23:17:07PrestigeThat would be great. I also think editor support could be betterr
23:17:19PrestigeAlthough I haven't tried vscode, maybe it's good there
23:17:29FromDiscord<ElegantBeef> It's eh everywhere
23:17:37FromDiscord<ElegantBeef> Saem i believe is working on improving nimsuggest
23:17:40disrupteki maintain that nim is not /better enough/ to justify working in an undersupported language.
23:18:21PrestigeI'd be willing to write some tutorials/make videos, not sure what's worth covering. I saw there's a small video series already
23:18:54FromDiscord<ElegantBeef> I really shouldnt be the one figuring out colouring for errors 😄 https://media.discordapp.net/attachments/371759389889003532/791082366939824139/unknown.png
23:25:17FromDiscord<shadow.> disruptek can you confirm your alt
23:25:39FromDiscord<shadow.> @ElegantBeef what are you using for colors
23:25:42FromDiscord<shadow.> ansi codes?
23:25:45FromDiscord<ElegantBeef> I'm using terminal colours
23:25:48FromDiscord<ElegantBeef> so yes
23:26:05FromDiscord<ElegantBeef> I more mean i shouldnt be the one in charge of selecting what part of errors are "important"
23:26:12FromDiscord<shadow.> quick heads up cmd and powershell don't natively support those
23:26:12disruptekno doubt.
23:26:20disruptekshit, you can't even /spell/ `color`.
23:26:25FromDiscord<shadow.> you have to exec an empty terminal command to enable them
23:26:38FromDiscord<shadow.> it's odd
23:26:42FromDiscord<ElegantBeef> Sorry disruptek, as i'm Canadian i spell it properly
23:26:45FromDiscord<shadow.> lmfao
23:26:47disrupteklies.
23:27:03FromDiscord<shadow.> judging by how he started the sentence with "sorry", i believe it
23:28:15Fish-FaceI have today down to 90ms
23:28:18Fish-Faceit's been a bit arduous
23:28:28Fish-Facemy hash routine for deques was wrong
23:29:26*tane quit (Quit: Leaving)
23:29:41FromDiscord<shadow.> i didnt even try on speed my solution just hashes `(deq1.toSeq, deq2.toSeq)` lmfao
23:29:49Fish-FaceLOL
23:29:50FromDiscord<shadow.> cba to write my own hash function
23:29:52Fish-Facehow long was that :P
23:29:56FromDiscord<shadow.> no idea
23:30:00FromDiscord<shadow.> with danger prolly around 500ms
23:30:00FromDiscord<shadow.> lmfao
23:30:07FromDiscord<shadow.> without -d:danger over 5 seconds...
23:30:25Fish-Facedoes -d:danger include all of -d:release?
23:30:33FromDiscord<shadow.> probably -d:release on steroids
23:30:47Fish-FaceI got 6 seconds in debug mode before any optimisations (with seqs)
23:30:55FromDiscord<shadow.> loll
23:30:59Fish-FaceI should retry that with -d:danger...
23:32:11FromDiscord<shadow.> im guessing like↵debug - fda allowing a normal medical drug↵release - fda allowing the covid vaccine↵danger - crack from the dealer down the block
23:32:13FromDiscord<shadow.> lol
23:33:56FromDiscord<shadow.> but yeah try with -d:danger and maybe --gc:arc idk
23:34:06FromDiscord<shadow.> --passc:-flto is also a hit or miss lol
23:38:03FromDiscord<xCFF> when defining a struct, is it possible to specify the key to use should you marshall it to a json object? similar to how golang does it
23:39:18FromDiscord<xCFF> other than overloading `%`
23:39:57FromDiscord<ajusa> I assume you mean an object in Nim. The fieldname is used by default for marshalling and marshaling from JSON. Do you need a different key than the actual fieldname?
23:40:30FromDiscord<ajusa> (edit) "marshaling" => "unmarshaling"
23:41:50FromDiscord<xCFF> If possible yeah!
23:42:49FromDiscord<xCFF> sent a code paste, see https://play.nim-lang.org/#ix=2Jcx
23:42:58FromDiscord<xCFF> seralizes to {"test":"whatevber"}
23:43:18FromDiscord<xCFF> in go you can add `json:"key_name"` to the declariation and when marshal is called, it will use that key instead
23:44:06FromDiscord<xCFF> mostly just to keep the naming conventions w/ nim. The key i need uses underscores and nim prefers camel case
23:44:46FromDiscord<ajusa> What you could do is have the object definition be in snake_case and then simply refer to it using camelCase, I think that should work
23:46:17FromDiscord<ajusa> https://play.nim-lang.org/#ix=2JcB is a quick example of what I am talking about
23:46:17FromDiscord<xCFF> sent a code paste, see https://play.nim-lang.org/#ix=2JcC
23:46:25FromDiscord<ajusa> Yup, exactly!
23:46:53FromDiscord<xCFF> ha! no kidding. Thanks!
23:47:14FromDiscord<Quibono> Is there a way to make an array whose length is defined at runtime?
23:48:01FromDiscord<ElegantBeef> Nope arrays length has to be defined at compiletime
23:50:08FromDiscord<Quibono> Hrm tricksy
23:51:19FromDiscord<Quibono> Is there any way to be silly and bypass that by auto generating arrays of length 2..x at compile time?
23:51:46FromDiscord<ElegantBeef> Why not just use seqs?
23:52:14FromDiscord<Quibono> Seqs use the heap right?
23:52:23FromDiscord<ElegantBeef> Yes
23:52:45FromDiscord<Quibono> I'm trying to brain myself with a hard-ish real time system.
23:52:55FromDiscord<Quibono> Because I love myself lol.
23:53:02FromDiscord<ElegantBeef> Then use an array larger than you'll ever need
23:53:38FromDiscord<Quibono> And just check if I hit a zero as a way to stop looking at it?
23:57:04FromDiscord<Quibono> For some stuff I know exactly how big it is, but yeah that's a good point.
23:58:05FromDiscord<ElegantBeef> Well you can just store the index of the last added object