00:02:21 | * | Tanger joined #nim |
00:10:19 | * | Gustavo6046 quit (Quit: WeeChat 2.9) |
00:10:40 | * | Gustavo6046 joined #nim |
00:15:53 | FromDiscord | <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:51 | mipri | sure. no. |
00:22:25 | FromDiscord | <19> im getting an error "expected ; before void" and im just using importc and header pragmas |
00:22:44 | FromDiscord | <19> usually in c2nim you just add #def |
00:27:08 | * | disruptek throbs. |
00:28:04 | FromDiscord | <19> oh no |
00:29:54 | FromDiscord | <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:32 | mipri | I really have no idea what you're asking when you're distinguishing between "a dll" and "a c lib". |
00:31:51 | FromDiscord | <19> sorry, dll and so |
00:32:04 | mipri | "a dll" from "a so" is still meaningless. |
00:33:00 | FromDiscord | <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:37 | mipri | OK, 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:16 | FromDiscord | <19> i ran them one on windows and one on linux |
00:36:00 | mipri | OK 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:47 | FromDiscord | <19> yes |
00:36:55 | mipri | welp 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:11 | FromDiscord | <19> its supposed to act the same using the same nim code right? |
00:38:34 | FromDiscord | <19> that C source is supposed to generate only one so per platform. so there is only one .so |
00:41:12 | FromDiscord | <19> sighs |
00:48:38 | * | j-james joined #nim |
01:05:30 | FromDiscord | <sealmove> @giaco hey! the plugin system is ready 🙂 you can check the documentation. |
01:06:30 | giaco | sealmove, hello! |
01:08:48 | giaco | nice! 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:18 | FromDiscord | <Quibono> @treeform Do you think Fidget could be used as the UI for a web browser? |
01:09:22 | FromDiscord | <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:48 | FromDiscord | <sealmove> @giaco great! go ahead and ask |
01:11:59 | giaco | sealmove, have a look at line 9 here https://termbin.com/8m1b |
01:12:25 | giaco | question is: it is possible to declare a field that should read everything up to the end of the stream? |
01:13:27 | FromDiscord | <sealmove> before I answer, for parser option use `endian = l`, not `endian = "l"` |
01:13:38 | giaco | also 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:05 | giaco | k |
01:14:17 | FromDiscord | <sealmove> this is extremely easy: `8: x{s.atEnd}` |
01:15:10 | FromDiscord | <sealmove> yeah, I didn't make peek procs |
01:16:20 | FromDiscord | <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:49 | FromDiscord | <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:42 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2J4Q |
01:20:41 | giaco | s.atEnd works nicely! I forgot that I have s available ^^ |
01:22:02 | giaco | play.nim-lang.org Error 502 Bad Gateway? |
01:22:54 | FromDiscord | <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:30 | FromDiscord | <sealmove> yes, playground doesn't work for me neither |
01:33:13 | FromDiscord | <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:51 | FromDiscord | <geekrelief> I personally use msgpack4nim |
01:35:21 | FromDiscord | <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:54 | FromDiscord | <geekrelief> I really don't want to use gcc unless I have to. |
01:46:39 | FromDiscord | <treeform> @Quibono that's what I am doing now. I generate HTML with fidget. |
01:47:12 | FromDiscord | <Quibono> 😮 I'll alpha test it if you make a legit one |
01:47:15 | giaco | geekreliev, out of curiosity, why not gcc? |
01:59:13 | Fish-Face | I'm missing some linear algebra |
02:17:53 | * | abm quit (Quit: Leaving) |
02:20:37 | * | klaufir_ quit (Ping timeout: 264 seconds) |
02:40:17 | FromDiscord | <ElegantBeef> Oh shit varriount is typing 😄 |
02:41:09 | FromDiscord | <ElegantBeef> That's me saying hello |
02:41:44 | FromDiscord | <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:10 | FromDiscord | <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:50 | FromDiscord | <shadow.> the 'ole fliperroo |
02:43:05 | FromDiscord | <shadow.> i believe that's the scientific term, at least |
02:43:06 | FromDiscord | <ElegantBeef> Depth to breadth |
02:43:20 | FromDiscord | <shadow.> precisely what i was going to say pfft |
02:43:33 | FromDiscord | <ElegantBeef> I'll give you the ol' fliperroo |
02:44:09 | FromDiscord | <shadow.> thank you |
02:44:20 | FromDiscord | <shadow.> i made the most useful pr in my life |
02:44:24 | FromDiscord | <shadow.> added all of 8 characters |
02:44:26 | FromDiscord | <shadow.> i feel so accomplished |
02:44:26 | FromDiscord | <ElegantBeef> Nice |
02:44:41 | FromDiscord | <ElegantBeef> I still need to colourize more error |
02:44:43 | FromDiscord | <ElegantBeef> Join me brethern |
02:44:44 | FromDiscord | <shadow.> lol |
02:44:51 | FromDiscord | <shadow.> i just added the sequtils import to prelude |
02:44:58 | FromDiscord | <shadow.> xflywind gave the ok, just waiting for timothee |
02:48:46 | FromDiscord | <Cohjellah> Is Nimx still being developed? |
02:48:51 | FromDiscord | <Cohjellah> worked on |
02:49:44 | FromDiscord | <ElegantBeef> Considering it had a commit 12 days ago, probably |
02:55:10 | FromGitter | <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:01 | FromGitter | <iffy> Or maybe I should switch to a peekableOutputStream and skip the thread? |
03:01:05 | giaco | nim manual says to use spaces instread of tabs, but generated c code uses tabs instead of spaces |
03:02:33 | FromGitter | <iffy> Or is there a way to timeout a `stream.readLine()`? |
03:12:13 | FromDiscord | <Rika> giaco: yeah, whats the issue with that? |
03:12:32 | giaco | absolutely nothing :D just curious |
03:13:38 | * | ex_nihilo joined #nim |
03:14:25 | FromDiscord | <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:50 | disruptek | i really believe it's just because guido said he wishes he'd made it spaces-only. |
03:16:51 | mipri | iffy: 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:06 | disruptek | why would you not want to use tabs instead? it's ridiculous. |
03:18:35 | FromGitter | <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:01 | FromGitter | <iffy> I guess I could add more debug statements to see if it's hanging on the readLine or not |
03:20:40 | disruptek | iffy: golden's invoke.nim (or similar) does async process handling without hangs. maybe i'm doing something there that you aren't. |
03:21:18 | FromGitter | <iffy> I'll look |
03:21:53 | FromDiscord | <ElegantBeef> Well i'd prefer tabs as it gives the user the ability to customise the rendering without changing the file |
03:22:16 | FromDiscord | <ElegantBeef> Ah you said "not want to" |
03:22:36 | FromDiscord | <ElegantBeef> I'm terrific at reading as long as it's meant to be read wrong |
03:26:35 | FromGitter | <iffy> disruptek: do you run golden on Windows, too? |
03:28:08 | giaco | I hate tabs, I'm happy about nim space-only policy. I just opened a generated .c and I went ewww |
03:28:57 | FromDiscord | <ElegantBeef> why do you hate tabs? |
03:30:51 | disruptek | iffy: it supposedly builds there, but i don't run windows. |
03:38:04 | leorize[m] | imho "customizing" rendering is tab's worst function |
03:39:11 | leorize[m] | disruptek: is setup-nim working well? |
03:39:22 | disruptek | works great for me, thank you. |
03:39:48 | disruptek | skiplists + arc + windows = crash though. 1.2, 1.4, 1.5. |
03:40:07 | leorize[m] | then that's compiler issues :P |
03:40:15 | disruptek | yeah, it sucks. |
03:40:30 | disruptek | and i guess nimble won't be fixed any time soon. |
03:41:03 | leorize[m] | you should open an issue there |
03:41:09 | disruptek | i did. |
03:41:47 | FromDiscord | <ElegantBeef> Why is that tabs worst function? |
03:42:04 | disruptek | the usual complaint is that they confuse whitespace. |
03:42:04 | leorize[m] | and you may want to consider making prebuilts for nimph so that they can be used from CI :p |
03:42:33 | disruptek | i know, i need to work on dist. |
03:43:09 | disruptek | maybe i will do that now. |
03:45:13 | leorize[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:19 | leorize[m] | s/line/column/ |
03:45:58 | disruptek | well, 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:49 | giaco | tab is bad because it is a fat space |
04:12:32 | FromDiscord | <ElegantBeef> lol good reasoning |
04:33:48 | FromDiscord | <shadow.> anyone know of any prevalent imap libs? |
04:44:54 | FromDiscord | <j-james> re: tabs, i too wish nim supported them |
04:45:38 | FromDiscord | <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:53 | FromDiscord | <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:00 | FromDiscord | <ElegantBeef> Anyone got a easy way to get something like the "annotate with gcsafe" message? |
05:02:30 | FromDiscord | <ElegantBeef> Wondering how the effect problem messages should be coloured |
05:15:16 | FromDiscord | <$not> sent a code paste, see https://play.nim-lang.org/#ix=2J5L |
05:19:41 | FromDiscord | <shadow.> maybe waitFor main instead of discarding |
05:19:52 | FromDiscord | <shadow.> (not how to fix just a suggestion) |
05:20:00 | FromDiscord | <ElegantBeef> I dont even see `list` in the imap module |
05:21:17 | FromDiscord | <shadow.> you can auto generate docs for modules right? |
05:21:43 | FromDiscord | <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:13 | FromDiscord | <ElegantBeef> The module source is only a few hundred lines of code |
05:22:15 | FromDiscord | <$not> I havent been able to find anything on it but ill keep looking |
05:22:25 | FromDiscord | <$not> can you link @ElegantBeef |
05:22:38 | FromDiscord | <ElegantBeef> If you installed the module you already have it |
05:23:45 | FromDiscord | <shadow.> should be in your nimble folder or just use github |
05:23:53 | FromDiscord | <ElegantBeef> It's not on github 😛 |
05:23:58 | FromDiscord | <ElegantBeef> https://git.sr.ht/~ehmry/nim_imap/tree/master/item/src/imap.nim |
05:25:38 | disruptek | !last shashlick |
05:25:38 | disbot | shashlick spoke in 12#nim-offtopic 4 weeks ago |
05:26:00 | disruptek | i really hope he's okay. |
05:26:14 | disruptek | !last alehander92 |
05:26:14 | disbot | alehander92 spoke in 12#nim-offtopic 2 weeks ago |
05:26:27 | FromDiscord | <ElegantBeef> @$not you'll probably have to replicate https://github.com/python/cpython/blob/3.9/Lib/imaplib.py#L591 |
05:29:09 | FromDiscord | <shadow.> @ElegantBeef i believe hes using a dif module |
05:29:13 | FromDiscord | <shadow.> !repo imap |
05:29:14 | disbot | https://github.com/forlan-ua/nim-imap -- 9nim-imap: 11 15 2⭐ 1🍴 & 1 more... |
05:29:24 | FromDiscord | <shadow.> not that one nvm |
05:29:31 | FromDiscord | <shadow.> it's the "1 more" lol |
05:30:39 | FromDiscord | <ElegantBeef> Well it again doesnt have `list` |
05:34:58 | FromDiscord | <ElegantBeef> nimap actually seems like it'd work for them |
05:35:02 | FromDiscord | <ElegantBeef> It has a list proc |
05:35:55 | FromDiscord | <$not> looking into it |
05:38:31 | FromDiscord | <$not> This might be it actually, testing rn |
05:43:35 | FromDiscord | <$not> Youp seems to have everything, read, delete, all that ty ty |
06:19:10 | FromDiscord | <geekrelief> gcc can take 3-7x as long as tcc to compile. |
06:45:06 | FromDiscord | <AwakenAgain?> hi guys, im new here and would like to somewhat understand, what kind of language is NIM? |
06:45:34 | FromDiscord | <ElegantBeef> A statically typed systems programming language |
06:45:39 | FromDiscord | <ElegantBeef> Or a very good one 😛 |
06:47:06 | FromDiscord | <ElegantBeef> What do you mean "what kind"? 😄 |
06:47:23 | FromDiscord | <AwakenAgain?> so like C++? |
06:47:57 | FromDiscord | <ElegantBeef> It's equally capable, but it's different |
06:49:19 | FromDiscord | <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:27 | FromDiscord | <AwakenAgain?> hmm |
06:49:48 | * | habamax joined #nim |
06:50:39 | FromDiscord | <AwakenAgain?> so NIM in itself is only the frontned |
06:50:45 | FromDiscord | <AwakenAgain?> and has many backends? |
06:50:51 | FromDiscord | <mratsim> SoA and AoS, Array Of Struct and Struct of Array |
06:51:12 | FromDiscord | <ElegantBeef> It uses C/C++ as an IR, so yes that's a fair asssumption imo |
06:51:29 | FromDiscord | <mratsim> we don't use this distinction in science though, it likely comes from game programming |
06:51:31 | FromDiscord | <Varriount> Thanks. |
06:51:49 | FromDiscord | <AwakenAgain?> @ElegantBeef may i ask u smth in private? |
06:51:57 | FromDiscord | <AwakenAgain?> its getting confusing here^^ |
06:52:04 | FromDiscord | <ElegantBeef> I suppose you could |
06:52:07 | FromDiscord | <AwakenAgain?> kk |
06:52:28 | FromDiscord | <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:03 | FromDiscord | <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:43 | FromDiscord | <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:19 | FromDiscord | <mratsim> the basic way to handle that is to have an "init, update, finish" setup with a context. |
06:54:38 | FromDiscord | <mratsim> The context hold internally either a SOA or a AOS depending on your preferred representation |
06:55:22 | FromDiscord | <mratsim> you have update[T](ctx: var Context, input: (openarray[T], openarray[T]) |
06:55:42 | FromDiscord | <mratsim> and update[T](ctx: var Context, input: openarray[(T, T)]) |
06:56:10 | FromDiscord | <mratsim> build on top of individual update[T](ctx: var Context, a, b: T) |
06:56:25 | FromDiscord | <mratsim> the individual update can consume both version |
06:57:28 | FromDiscord | <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:20 | FromDiscord | <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:05 | FromDiscord | <mratsim> @Araq, nnkGotoState is not documented :/ |
07:29:07 | * | Tanger quit (Remote host closed the connection) |
07:45:35 | * | PMunch joined #nim |
07:56:25 | PMunch | Just 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:14 | PMunch | We 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:48 | FromDiscord | <ElegantBeef> ~~Dont look now but pmunch was one of those that was in nimconf this year, he's complimenting himself~~ 😄 |
08:03:13 | PMunch | Haha, I was talking about all the other great speakers :P |
08:03:21 | FromDiscord | <ElegantBeef> "other" |
08:05:37 | PMunch | ... |
08:05:39 | FromDiscord | <ElegantBeef> Dont worry pmunch i'll let you do `embedding nimscript pt2: nimscripter` for nim conf 2021 😛 |
08:05:55 | PMunch | You don't wanna do it? |
08:06:35 | FromDiscord | <ElegantBeef> I've got the voice for a 1920s movie |
08:07:04 | FromDiscord | <ElegantBeef> Guess the joke is "Got the voice for writing" |
08:07:26 | PMunch | Haha :P |
08:07:37 | PMunch | I mean everyone thinks their voice sounds weird on recordings |
08:08:59 | PMunch | Hmm, I'm considering to submit a talk for the "Declarative and Minimalistic Computing" devroom |
08:09:15 | PMunch | Working title "Optimising for humans - Nim DSL/meta-programming for 0-cost abstraction on microcontrollers" |
08:09:21 | PMunch | It's a bit long though.. |
08:09:29 | FromDiscord | <ElegantBeef> Just a bit |
08:09:59 | FromDiscord | <haxscramper> "Taming C++ - adventures in wrapping fourty years of feature creep" |
08:10:11 | FromDiscord | <ElegantBeef> Be cautious with "0 cost abstractions" that term might turn you into a crab |
08:10:20 | PMunch | A crab? |
08:10:25 | FromDiscord | <haxscramper> кгые |
08:10:37 | FromDiscord | <haxscramper> (edit) "кгые" => "rust" |
08:11:01 | FromDiscord | <ElegantBeef> Most of the time i hear 0 cost abstraction it's closely related to crustaceans |
08:11:40 | PMunch | What? :P |
08:11:55 | FromDiscord | <ElegantBeef> Rust users usually scream it from their rooftops |
08:12:28 | PMunch | Rust is a crab? |
08:13:08 | PMunch | Aah, I see |
08:13:15 | FromDiscord | <ElegantBeef> Ferris |
08:13:25 | PMunch | Well in Rust 0-cost abstraction is a feat. In Nim it's just the default :P |
08:14:46 | PMunch | What 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:11 | FromDiscord | <Rika> ~~rust is barely 0 cost~~ |
08:47:20 | FromDiscord | <Rika> ~~id consider a loss of sanity a cost~~ |
08:57:53 | disruptek | what sanity? |
09:01:36 | FromDiscord | <ElegantBeef> Cannot lose what you never had is your point? |
09:03:58 | ehmry | ElegantBeef, does that imap library still compile? |
09:04:25 | FromDiscord | <ElegantBeef> I never tried it |
09:04:44 | ehmry | yea, its pretty basic |
09:04:46 | FromDiscord | <ElegantBeef> I didnt see anything too standoutish as "no longer supported" |
09:16:53 | FromGitter | <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:06 | FromDiscord | <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:09 | PMunch | That sounds amazing TBH |
09:54:23 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
10:02:42 | PMunch | Hmm, anyone good with c2nim or the other C wrapping tools? |
10:03:21 | PMunch | I'm struggling with wrapping Unbound again.. |
10:05:17 | FromDiscord | <lqdev> elaborate |
10:07:01 | PMunch | Well 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:11 | PMunch | And then later in the same file comes the actual definition: https://github.com/NLnetLabs/unbound/blob/master/util/storage/lruhash.h#L186 |
10:07:35 | PMunch | This leads to Nim creating a double declaration |
10:07:54 | FromDiscord | <ElegantBeef> Forward type declaration...? |
10:07:57 | FromDiscord | <ElegantBeef> The fuckover |
10:08:20 | PMunch | Yeah.. |
10:09:32 | FromDiscord | <ElegantBeef> Time to regex all of those forward decls and replace them with the normal ones and make a PR 😛 |
10:10:00 | PMunch | Well I'm guessing there's a weird reason for it.. |
10:12:34 | FromDiscord | <haxscramper> c2nim code does not compile because of mutually recrusive wrapper types? |
10:12:35 | FromDiscord | <ElegantBeef> From stacke overflow "struct forward declarations can be useful when you need to have looping struct declarations." |
10:13:03 | FromDiscord | <haxscramper> You just need to put all c2nim-generated wrappers in single `type` section |
10:15:29 | FromDiscord | <ElegantBeef> Anyone know the config file testament uses for testing, andor why it's turning off `colors` |
10:17:10 | FromDiscord | <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:31 | FromDiscord | <ElegantBeef> (edit) "error" => "erroring" |
10:18:27 | PMunch | haxscramper, yeah I know, but I want to do this automatically.. |
10:19:15 | PMunch | @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:33 | PMunch | But you can force them on --colors:on |
10:19:38 | FromDiscord | <ElegantBeef> I mean i have |
10:19:45 | FromDiscord | <ElegantBeef> I know my code doesnt check if it's a terminal |
10:19:54 | FromDiscord | <ElegantBeef> So something is escaping my colours, and not causing errors |
10:20:01 | FromDiscord | <ElegantBeef> These tests should fail! |
10:20:06 | FromDiscord | <haxscramper> PMunch: I'm pretty sure you can write some `PNode` mover and fix it automatically |
10:20:18 | FromDiscord | <haxscramper> That will just collect types in single section |
10:20:39 | FromDiscord | <haxscramper> Or find part on `c2nim` that writes code to file and hack around it |
10:20:43 | PMunch | Hmm, I guess that would be possible.. |
10:21:10 | FromDiscord | <haxscramper> Do you need example for using `PNode` and `compiler/parser`? |
10:21:27 | PMunch | An example would be great |
10:21:32 | FromDiscord | <ElegantBeef> I just want to see atleast one of every error and something isnt playing nice 😄 |
10:22:06 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2J6Y - this is for parsing string to `PNode` |
10:22:57 | PMunch | And then change the PNode and write back to a file.. |
10:23:02 | PMunch | Quite a bit of work |
10:23:02 | FromDiscord | <haxscramper> Yes |
10:23:12 | FromDiscord | <haxscramper> Well, this is a macro basically |
10:23:22 | * | tane joined #nim |
10:23:25 | PMunch | Yeah 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:30 | ForumUpdaterBot | New thread by Dadadani: Alternative to powmod in Nim, see https://forum.nim-lang.org/t/7276 |
10:51:41 | PMunch | Zevv, any idea why this just spins forever? http://ix.io/2J76 |
10:54:40 | * | Sembei quit (Ping timeout: 246 seconds) |
10:56:17 | FromDiscord | <haxscramper> ~npeg |
10:56:17 | disbot | no footnotes for `npeg`. 🙁 |
10:59:15 | FromDiscord | <lqdev> pmunch i feel like you're overengineering this a bit |
10:59:23 | FromDiscord | <lqdev> why not just modify the header file |
10:59:39 | FromDiscord | <lqdev> or c2nim output |
11:00:42 | PMunch | Hmm, this works: http://ix.io/2J7c |
11:00:51 | PMunch | @lqdev, because I want it to be automatic |
11:01:22 | PMunch | I want to have it in my makefile, so when a new version of Unbound drops it will automatically build a new wrapper |
11:01:41 | PMunch | But it's mostly the types I care about |
11:04:21 | PMunch | I 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:36 | FromDiscord | <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:46 | Zevv | PMunch: ! does not consume |
11:09:56 | Zevv | (note that I didn't make up that shit myself) |
11:10:10 | Zevv | so you're saying "zero or more times something that does not consume" |
11:10:19 | Zevv | so npeg goes "sure, you probably know what you're doing, right" |
11:10:44 | Zevv | https://github.com/zevv/npeg#anchoring-and-searching |
11:10:55 | Zevv | You probably just want * @struct |
11:11:05 | Zevv | which means "find struct zero or more times, and ignore the rest" |
11:11:15 | PMunch | Aha |
11:11:26 | PMunch | Yeah I converted to that and it works |
11:11:27 | Zevv | http://ix.io/2J7o |
11:11:31 | Zevv | right |
11:11:41 | Zevv | there is /some/ level of protection against spinning grammars |
11:11:50 | PMunch | Ooh, that is much prettier than what I was doing :P |
11:12:11 | PMunch | http://ix.io/2J7q |
11:12:16 | PMunch | That's what I did ^ :P |
11:15:36 | FromDiscord | <dom96> Making progress 😄 https://github.com/nim-lang/Nim/compare/devel...dom96:virtual-async-events-resurrected-fixes |
11:16:57 | PMunch | Why does c2nim fail on this? http://ix.io/2J7t |
11:17:17 | PMunch | Right after the #endif it says: Error: identifier expected, but got: * list of access control entries, linked list |
11:20:55 | FromDiscord | <haxscramper> Handwritten C parsers be like ... Most likely it just fails to handle this kind of input |
11:21:21 | FromDiscord | <haxscramper> Try removing comments too |
11:23:22 | PMunch | Ugh.. |
11:24:02 | PMunch | You'd think someone had written a tool to extract this information from C before.. |
11:34:12 | PMunch | Hmm, now I need to remove all these #ifdef parts because c2nim refuses to parse them |
11:34:51 | PMunch | And extract inline `enum` types out of the structs as c2nim doesn't support those either |
11:35:25 | PMunch | I'm wondering if just writing a mini-c2nim that does this for me would be easier.. |
11:36:28 | FromDiscord | <haxscramper> hcparse can handle everything above, though at this stage it is major PITA to work with |
11:36:46 | PMunch | A bigger PITA than this? |
11:36:50 | FromDiscord | <haxscramper> Well |
11:36:53 | FromDiscord | <haxscramper> Not really |
11:37:03 | FromDiscord | <haxscramper> Let me try now |
11:38:02 | PMunch | If you want to torture test it try it on some of the .h files in the unbound repository on GitHub |
11:39:25 | FromDiscord | <haxscramper> I wanted to torture test it on boost libraries |
11:39:58 | PMunch | I still haven't found a single tool that can parse these headers.. |
11:40:22 | PMunch | It's like they read the C spec and decided to use the most obscure ways of doing things.. |
11:40:30 | FromDiscord | <haxscramper> though it uses clang so syntax is not a problem, but you need to have complete translation unit |
11:41:06 | FromDiscord | <haxscramper> Which means you need to figure out at least include paths |
11:51:36 | FromDiscord | <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:45 | FromDiscord | <haxscramper> That should not be included directly |
11:52:19 | FromDiscord | <haxscramper> And insetad used in "public API" header that I need to use when working with the library? |
11:54:06 | PMunch | Not 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:44 | haxscramper | Are 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:01 | haxscramper | which *are not include'd* in the file itself |
12:07:31 | haxscramper | So it seems like there some other file that has like |
12:07:32 | haxscramper | #include "macro-defintions.h" |
12:07:32 | haxscramper | #include "lruhash.h" |
12:08:50 | haxscramper | There is no `include/*` in the project, so I need to search for all of these "top-level" files and wrap *them* |
12:09:44 | haxscramper | E.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:18 | haxscramper | `"string" : @["basic_string.tcc", "basic_string.h", "stringfwd.h"]` to be precise |
12:11:02 | haxscramper | And it seems like this library uses the same approach for headers |
12:13:08 | FromDiscord | <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:41 | FromDiscord | <squid> sent a code paste, see https://play.nim-lang.org/#ix=2J7L |
12:16:47 | FromDiscord | <squid> (edit) |
12:17:30 | FromDiscord | <haxscramper> use semicolon for type declaration - `var buffer: ...` |
12:17:41 | FromDiscord | <haxscramper> Right now you are assigning type to variable |
12:18:09 | FromDiscord | <squid> oh |
12:18:23 | FromDiscord | <squid> Thank you |
12:23:35 | haxscramper | Yes, 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:55 | haxscramper | So 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:12 | haxscramper | can't as int[a] `int[a]` *int[b]* |
12:46:58 | PMunch | @sealmove, ooh interesting |
12:48:02 | FromGitter | <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:27 | FromGitter | <yglukhov> `asyncnet.nim` is ok in this particular case, but I would add a read anyway |
13:04:53 | narimiran | !last leorize |
13:04:53 | disbot | leorize joined 12#nim-news 20 hours ago and last spoke 733 hours ago |
13:14:50 | narimiran | leorize[m], leorize: is it known that (sometimes) while loops break syntax highlighting in nim.nvim? |
13:21:38 | Zevv | PMunch: "remove all these #ifdef parts". You'd think someone had written a tool to do that |
13:21:45 | Zevv | like, a C preprocessor or something |
13:22:27 | PMunch | Haha, well for that part a tool exists |
13:32:46 | FromDiscord | <dom96> yglukhov: hrm, that does sound like a bug. Although in most cases the user should read the body. |
13:32:56 | FromDiscord | <dom96> Curious why you're not doing this? |
13:41:30 | FromDiscord | <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:22 | FromDiscord | <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:53 | FromDiscord | <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:10 | FromDiscord | <mratsim> No need for channel, mutex, condition variable or all that Jazz. |
13:46:20 | ForumUpdaterBot | New 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:25 | FromDiscord | <mratsim> I wonder if it's similar to the rendez-vous points in CSP |
13:46:44 | * | Q-Master joined #nim |
13:47:28 | FromDiscord | <dom96> Sounds cool 🙂 |
13:48:42 | FromDiscord | <mratsim> also no need for a buffer |
13:49:20 | FromDiscord | <mratsim> only context of the closure iterators/coroutines/continuations is enough. |
13:57:35 | FromDiscord | <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:41 | FromDiscord | <dom96> Anyone know if testament supports timeouts? |
14:11:52 | FromDiscord | <mratsim> we won't need awaitable Flowvar 😉 |
14:12:00 | FromDiscord | <mratsim> well at least with that design |
14:12:29 | FromDiscord | <squid> Is there anything like the "Char" from C in Nim? |
14:12:35 | FromDiscord | <mratsim> Though I'll likely put one design as improving closure iterators to be coroutines like |
14:12:43 | PMunch | @squid, char? |
14:12:49 | FromDiscord | <mratsim> and I have to write a competing design with continuations |
14:13:08 | FromDiscord | <mratsim> or implement coroutines as continuations |
14:13:35 | FromDiscord | <mratsim> @squid char, cuchar or byte |
14:13:49 | FromDiscord | <squid> uint8 might work. Byte also. |
14:14:01 | FromDiscord | <squid> Oh |
14:14:02 | FromDiscord | <squid> Same thing |
14:14:03 | FromDiscord | <mratsim> use char for ASCII char |
14:14:10 | FromDiscord | <mratsim> use byte for binary blob |
14:14:35 | FromDiscord | <squid> It is to represent rgb values |
14:14:36 | FromDiscord | <mratsim> use cuchar, well don't use it apart from autogenerated wrapper where it's to painful to use the proper type. |
14:14:40 | FromDiscord | <squid> So 1 byte for r |
14:14:49 | FromDiscord | <mratsim> for RGB use uint8 |
14:14:56 | PMunch | +1 |
14:15:37 | Zevv | no, use three |
14:15:43 | FromDiscord | <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:57 | Zevv | or use treeforms chroma |
14:16:02 | Zevv | !repo chroma |
14:16:02 | disbot | https://github.com/treeform/chroma -- 9chroma: 11Everything you want to do with colors, in nim. 15 50⭐ 6🍴 |
14:16:09 | FromDiscord | <squid> Not really. I am just trying to make a buffer for opengl |
14:16:27 | Zevv | but we're all very helpful anyway, right :) |
14:16:36 | FromDiscord | <squid> Yup. 😄 |
14:17:35 | FromDiscord | <mratsim> uint3? |
14:17:47 | * | FromDiscord quit (Remote host closed the connection) |
14:18:02 | * | FromDiscord joined #nim |
14:19:06 | leorize[m] | yes it supports timeout |
14:19:54 | leorize[m] | narimiran: nope, but generally nimsuggest crashes on very random things |
14:20:23 | FromDiscord | <sealmove> how do I specify a range with step? |
14:20:23 | FromDiscord | <squid> I love that when I run my opengl program it just freezes 😄 |
14:20:31 | FromDiscord | <sealmove> in set construction |
14:20:54 | narimiran | leorize[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:59 | FromDiscord | <lqdev> @sealmove you can't |
14:21:32 | PMunch | @sealmove in a for loop you can do `countup(0, 10, 2)` instead of `0..10` |
14:21:35 | FromDiscord | <squid> I am thinking of just making this opengl stuff in C++ or C as nim just makes it crash 😦 |
14:21:39 | PMunch | But in general for ranges you can't do it |
14:21:40 | FromDiscord | <squid> Might just be me tho. tbh |
14:22:09 | FromDiscord | <sealmove> so i should write a proc that constructs and return a set? |
14:22:14 | leorize[m] | narimiran: i guess you found a nimsuggest bug :p |
14:22:16 | PMunch | If it crashes you're probably doing something silly with your data-types :) |
14:23:01 | PMunch | @sealmove: toSeq(countup(0, 10, 2)).mapIt(it.uint16).toSet |
14:23:14 | FromDiscord | <sealmove> oh great thanks! |
14:23:18 | FromDiscord | <lqdev> @squid hey |
14:23:18 | FromDiscord | <lqdev> github.com/liquid600pgm/aglet |
14:23:21 | FromDiscord | <lqdev> (edit) "github.com/liquid600pgm/aglet" => "https://github.com/liquid600pgm/aglet" |
14:23:22 | PMunch | Wait toSet might not be defined for the built in sets.. |
14:23:38 | narimiran | PMunch: is `while p1.len > 0 and p2.len > 0:` really that silly? :P |
14:24:05 | PMunch | narimiran, haha I was replying to @squid |
14:24:07 | narimiran | PMunch: i think we got `toSet` recently in devel, but it might be in setutils, or something like that |
14:24:33 | narimiran | PMunch: lol, i've seen leorize[m]'s highlight, and automatically read your message too :D |
14:24:35 | FromDiscord | <sealmove> @PMunch it works :) but importing `sets` is needed |
14:24:59 | FromDiscord | <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:34 | FromDiscord | <squid> What i do isn't really preferred way to do it in OpenGL |
14:25:44 | FromDiscord | <squid> I am just drawing pixels straight to the screen |
14:25:51 | FromDiscord | <squid> (edit) "screen" => "window" |
14:26:04 | PMunch | @sealmove, then you're using HashSets, just FYI |
14:26:07 | FromDiscord | <lqdev> well if you want a simple framebuffer is messing with low level OpenGL really that necessary |
14:26:25 | FromDiscord | <sealmove> I see. That's fine/ |
14:26:34 | PMunch | @squid, ix.io? |
14:27:40 | FromDiscord | <squid> Any other site? |
14:27:43 | FromDiscord | <dom96> yay heisenbug, threading is fun |
14:27:53 | FromDiscord | <dom96> (this is why I avoid threading like the plague :P) |
14:28:12 | FromDiscord | <squid> lqdev, https://hastebin.com/asetanaruc.apache |
14:28:19 | * | letto quit (Quit: Konversation terminated!) |
14:28:25 | PMunch | @squid, pastebin, hastebin |
14:28:27 | * | waleee-cl joined #nim |
14:28:29 | FromDiscord | <sealmove> oh `toSet` is deprecated, it's now `toHashSet` |
14:28:46 | FromDiscord | <shadow.> yep |
14:29:15 | FromDiscord | <squid> (edit) "lqdev," => "@lqdev," |
14:29:25 | FromDiscord | <squid> PMunch, https://hastebin.com/asetanaruc.apache |
14:30:15 | * | letto joined #nim |
14:30:45 | FromDiscord | <squid> I have tried to do this twice and both times it didn't work |
14:30:59 | FromDiscord | <lqdev> well… glDrawPixels is deprecated |
14:31:09 | FromDiscord | <squid> Ehm. |
14:31:21 | FromDiscord | <squid> Might be that 😄 |
14:31:25 | FromDiscord | <squid> Any other way to do it? |
14:31:46 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2J8L |
14:32:02 | FromDiscord | <lqdev> give me a few minutes |
14:33:01 | * | Tanger quit (Remote host closed the connection) |
14:34:39 | FromDiscord | <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:08 | FromDiscord | <dom96> @VVX7 that example is fairly complete, what are you missing from it? |
14:37:30 | FromDiscord | <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:06 | FromDiscord | <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:49 | FromDiscord | <dom96> I'm curious what your expectation is from other languages, if any |
14:40:18 | FromDiscord | <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:22 | FromDiscord | <VVX7> Sure, makes sense. I'll keep digging. |
14:53:25 | FromDiscord | <lqdev> @squid took me a while but that's how you'd do it with modern OpenGL http://ix.io/2J8R/nim |
14:53:47 | FromDiscord | <lqdev> feel free to copy paste that and build off of it if you don't wanna care about dirty details |
14:54:20 | FromDiscord | <squid> Wait. Is that shaders? |
14:54:41 | FromDiscord | <lqdev> yeah. |
14:54:52 | FromDiscord | <lqdev> you can't really get far without shaders in modern graphics :p |
14:55:08 | FromDiscord | <squid> Then OpenGL might be a bit overkill for me |
14:55:31 | FromDiscord | <squid> I want to learn OpenGL but maybe not right now if shaders are needed |
14:55:33 | FromDiscord | <Rika> why are they still called shaders i do wonder |
14:55:36 | FromDiscord | <lqdev> you can just use SDL2, there's SDL_GetWindowSurface |
14:55:44 | FromDiscord | <lqdev> you can do software rendering with that |
14:58:43 | FromDiscord | <dom96> if you're doing certain types of games you can get pretty far without shaders |
15:00:53 | FromDiscord | <squid> @lqdev, Do you think it will be easier to learn OpenGL without nim? |
15:04:18 | Fish-Face | how 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:20 | narimiran | Fish-Face: `for e in mySet: return e` :D |
15:06:30 | Fish-Face | BLEURGH |
15:06:51 | Fish-Face | I am a firm believer that the axiom of choice should be a first-class concept in every programming language >:( |
15:07:50 | FromDiscord | <Rika> lol |
15:08:39 | Fish-Face | Zevv: 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:54 | Fish-Face | (I would say "from the leaves down" but people often draw trees upside down...) |
15:09:57 | Zevv | yeah, 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:07 | Zevv | Open to suggestions, of course |
15:10:23 | Zevv | more important though, does it please *you*? :) |
15:12:27 | Fish-Face | well, 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:25 | FromDiscord | <lqdev> definitely not |
15:24:32 | Oddmonger | seen in « backend » : « Since JavaScript does not have a portable means to include another module, Nim just generates a long .js file. » |
15:25:04 | Oddmonger | and « import / export » ? |
15:25:40 | Oddmonger | import 'foo' from 'foo.js' |
15:27:54 | FromDiscord | <Rika> ? |
15:29:37 | Oddmonger | the docs says you cannot include another module, but isn't « import » in js the way to do it ? |
15:32:30 | haxscramper | When 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:03 | haxscramper | Is it somehow related to `{.compile.}` pragma on toplevel or this is a bug |
15:33:56 | FromDiscord | <lqdev> Oddmonger: it's not portable |
15:42:27 | FromDiscord | <dom96> hm, there is no way to GC_ref a closure |
15:42:41 | FromDiscord | <dom96> Shouldn't that be possible or am I misunderstanding? |
15:45:24 | FromDiscord | <Shucks> do we have ftgl bindings somewhere? |
15:53:36 | haxscramper | Oh, I figured this out - I had `{.push header: "header.hpp".}` which caused `mainFunc()` to not be generated at all, subsequently failing compilation |
15:57:21 | Zevv | my 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:56 | FromDiscord | <mratsim> @Zevv, look at those negative overhead C++ coroutines: https://godbolt.org/g/26viuZ |
15:59:43 | Zevv | Well isn't that nice :) |
16:03:27 | FromDiscord | <dom96> ahh, `system.protect` is the answer to my question above |
16:04:58 | Fish-Face | goshdarnit |
16:05:20 | Fish-Face | the thing I was talking about yesterday - var being both by-ref and mutability - has bitten me again |
16:05:24 | Fish-Face | now I have to declare more variables |
16:13:50 | FromDiscord | <For Your Health> Does anyone know of any good reading material to learn about async programming in Nim? |
16:22:51 | FromDiscord | <haxscramper> Nim in action book has at least one chapter if not more IIRC |
16:25:39 | FromDiscord | <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:10 | FromDiscord | <For Your Health> Should I use asyncnet for that? |
16:29:35 | FromDiscord | <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:07 | FromDiscord | <mratsim> ^ this is not a sponsored ad |
16:35:56 | * | PMunch joined #nim |
16:36:42 | FromDiscord | <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:05 | Fish-Face | why is my forward declaration resulting in an "implementation of <...> expected"? is this a common typo I'm not spotting |
16:41:35 | PMunch | Time for AoC day22: https://www.youtube.com/watch?v=TNZyTCGE9CY |
16:41:40 | FromDiscord | <lqdev> Fish-Face: what are you forward declaring? |
16:41:50 | Fish-Face | derp, it was a typo |
16:41:56 | Fish-Face | I changed the signature in one but not the other |
16:42:01 | PMunch | And twitch of course: https://www.twitch.tv/pmunche |
16:42:16 | PMunch | narimiran, @shadow. ^ |
16:42:24 | narimiran | thanks |
16:43:27 | * | Kaivo quit (Ping timeout: 256 seconds) |
16:43:30 | Fish-Face | what speeds are people getting for today's AoC? |
16:43:44 | Fish-Face | my solution is taking 6s for part2, negligible for part 1 |
16:44:47 | narimiran | PMunch: 20ms before the optimization, 1.5ms after (for both parts) |
16:48:08 | FromDiscord | <Quibono> Pssh rookie numbers gotta get those down. |
16:48:40 | FromDiscord | <Quibono> Real programmers measure in picoseconds. :p |
16:51:09 | FromDiscord | <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:50 | FromDiscord | <Quibono> You more a femtosecond kinda guy? |
16:54:03 | * | leorize quit (Ping timeout: 240 seconds) |
16:55:07 | FromDiscord | <mratsim> I measure in CPU cycles |
16:56:58 | * | leorize joined #nim |
16:59:28 | Fish-Face | I think I missed some lines before reconnecting |
17:00:04 | * | xigoi[m] joined #nim |
17:12:09 | ForumUpdaterBot | New thread by Ggibson: Closure vs object benefit?, see https://forum.nim-lang.org/t/7277 |
17:13:09 | Zoom[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:02 | PMunch | I thought about that as well, but I had implementing it with deques |
17:14:35 | Zoom[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:58 | Zoom[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:14 | PMunch | Nice spoiler alert |
17:17:18 | PMunch | I'm currently streaming part2 |
17:18:42 | narimiran | Zoom[m]: just 25%?? |
17:19:12 | narimiran | either your previous code was blazing fast or you're doing that in the wrong place :P |
17:20:26 | Zoom[m] | Hm, so what do you think it's gotta be? |
17:21:23 | narimiran | Zoom[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:19 | Zoom[m] | By the way, again, deques were annoying. No slicing (easy to impl, though), no openArray... |
17:23:57 | narimiran | Zoom[m]: yeah, that bothered me too: i convert to seq and back :'( https://github.com/narimiran/AdventOfCode2020/blob/master/nim/day22.nim |
17:24:06 | Zoom[m] | PMunch, make it generic! |
17:25:07 | * | letto quit (Quit: Konversation terminated!) |
17:26:56 | Zoom[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:21 | narimiran | :) |
17:27:52 | Zoom[m] | But the biggest card changes, since the slices hold just a part of the deck? |
17:28:08 | narimiran | yeah, but i guess i can live with that :) |
17:28:20 | narimiran | especially if you tell me your way is slower :D |
17:29:02 | Zoom[m] | I do it all on an old N3710 laptop, for what it's worth |
17:29:50 | Zoom[m] | Gonna glance at my code later today and compare the speed with yours |
17:30:19 | Zoom[m] | I still need to catch up with the weekend tasks |
17:34:19 | Zevv | You 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:26 | Zevv | I tune into PMunch's streams for just that |
17:34:30 | Zevv | I don't listen to a word he says |
17:35:00 | Zevv | That's it, ASMR. Great stuff |
17:36:46 | narimiran | same here |
17:36:49 | Zoom[m] | You see, Peter, a bit of working on sound and people start calling your streams ASMR :D |
17:44:12 | ForumUpdaterBot | New thread by HJarausch: C++ backend broken ?, see https://forum.nim-lang.org/t/7278 |
17:45:54 | Zevv | you should go binaural next |
17:48:09 | Zevv | the absolute intimacy, yeah |
17:48:11 | Zevv | man |
17:55:18 | narimiran | Zevv: imagine the number of lonely software developers who would pay for listening to some programming-related ASMR |
17:55:22 | narimiran | $$$, i tell you! |
17:56:10 | narimiran | and they don't even have to be lonely! :P |
17:57:47 | disruptek | mratsim: 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:28 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2Jad |
18:00:38 | FromDiscord | <mratsim> so that would be design 2. |
18:01:24 | FromDiscord | <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:34 | FromDiscord | <mratsim> and with no alloc as well 😉 |
18:02:08 | FromDiscord | <mratsim> I also have some great use cases for stack continuations |
18:02:23 | disruptek | yeah, it's just that no-alloc requires another level of indirection, which is a PITA for the developer. |
18:02:40 | disruptek | pointers, cast, etc. |
18:03:08 | disruptek | it makes our nim less reliably high-level. |
18:03:10 | FromDiscord | <mratsim> no you don't need that |
18:03:28 | disruptek | how do you figure? |
18:03:54 | FromDiscord | <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:09 | FromDiscord | <mratsim> and only when needed is the alloc done |
18:04:22 | FromDiscord | <mratsim> and if it's a parser for example, there is no alloc because it's one char at a time. |
18:04:38 | FromDiscord | <mratsim> so the coroutine is just a stream handle |
18:04:48 | FromDiscord | <mratsim> and I think we can do the same with continuation |
18:04:58 | FromDiscord | <mratsim> it would be a "continuation handle" |
18:05:16 | disruptek | of course, but i'm not talking about singleton rewrites of a proc. |
18:05:22 | FromDiscord | <mratsim> the only thing needed is a borrow checker / isolated |
18:05:35 | FromDiscord | <mratsim> and you can pass that across threads |
18:06:00 | disruptek | yes, that's why we switched to objects. |
18:06:52 | FromDiscord | <mratsim> anyway, I have to write those, seems like I lost some stuff I found at lunch :/ |
18:08:16 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2Jae |
18:09:49 | disruptek | i can tell i'm just going to have to resign myself to adding another indirection. |
18:10:17 | FromDiscord | <mratsim> no indirection |
18:10:35 | disruptek | not for these cases, no. |
18:10:36 | FromDiscord | <mratsim> anyway I didn't look at your stack continuation yet |
18:11:26 | disruptek | it's nothing special. |
18:11:37 | FromDiscord | <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:49 | FromDiscord | <mratsim> if it escapes -> heap |
18:11:53 | FromDiscord | <mratsim> if not -> alloca |
18:11:56 | FromDiscord | <mratsim> that's all. |
18:12:30 | disruptek | you want to make that decision and take it out of the hands of the programmer? |
18:12:54 | disruptek | anything on the heap is a new level. i'd say that's clear enough. |
18:13:20 | FromDiscord | <mratsim> but you use ref no? |
18:13:23 | FromDiscord | <mratsim> that's heap |
18:13:27 | disruptek | and araq doesn't give us that info, anyway -- /we/ tell /him/. 🤣 |
18:13:37 | FromDiscord | <mratsim> the compiler knows |
18:13:52 | disruptek | it's our code that determines the continuation type. |
18:14:01 | FromDiscord | <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:41 | disruptek | maybe 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:02 | disruptek | zevv: wdyt |
18:20:57 | * | a_chou quit (Quit: a_chou) |
18:28:06 | narimiran | PMunch: regarding hashing: scores are also kind of hash ;) |
18:36:49 | * | muffindrake quit (Quit: muffindrake) |
18:40:03 | * | Arrrrrrrr joined #nim |
18:41:11 | FromDiscord | <shashlick> disruptek: I'm good buddy, just pseudo retired |
18:41:30 | disruptek | whew. what are you up to? |
18:43:18 | FromDiscord | <shashlick> Effectively catching up on all the real world paperwork I had deferred indefinitely |
18:44:02 | disruptek | oh, you're being audited, huh? |
18:45:05 | FromDiscord | <shashlick> Well, less boring paperwork than that |
18:46:16 | FromDiscord | <shashlick> How's Nim land |
18:47:25 | disruptek | it's lonely without you. |
18:47:31 | disruptek | i'm surrounded by knuckleheads. |
18:47:42 | FromDiscord | <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:45 | PMunch | Ey! :P |
18:47:52 | FromDiscord | <shadow.> hey pmunch |
18:47:52 | disruptek | see what i mean? |
18:48:14 | FromDiscord | <shadow.> appreciated |
18:50:06 | FromDiscord | <shashlick> :) |
18:50:37 | PMunch | @shadow. you play your recursion games with all your cards |
18:50:50 | PMunch | It should only play with N cards where N is the value of the card you picked |
18:51:14 | FromDiscord | <shadow.> ohh |
18:51:18 | FromDiscord | <shadow.> starting from front or back |
18:51:23 | PMunch | Front |
18:51:26 | FromDiscord | <shadow.> thanks |
18:51:35 | FromDiscord | <shashlick> Just lost the motivation, too many dead ends |
18:51:47 | disruptek | aww, c'mon buddy. |
18:51:49 | FromDiscord | <shadow.> can you slice deques? |
18:51:54 | PMunch | So "4 3 2 5 3 5 2" should recurse with "3 2 5 3" |
18:51:58 | PMunch | Nope.. |
18:52:00 | disruptek | shashlick: are you still coding? |
18:52:00 | FromDiscord | <shadow.> without doing `deq.toSeq[slice].toDeque` |
18:52:02 | FromDiscord | <shadow.> rip. |
18:52:08 | FromDiscord | <shadow.> might have to pr that one |
18:52:10 | FromDiscord | <shashlick> Nope |
18:52:19 | disruptek | wut |
18:52:27 | disruptek | are you still working? |
18:52:54 | FromDiscord | <shashlick> Yep, day job is good |
18:53:27 | FromDiscord | <shadow.> welp that just made me get an even lower answer, pmunch |
18:54:09 | disruptek | shashlick: i'm finding this hard to accept. |
18:54:21 | disruptek | what are you doing with your free time? swinging? |
18:54:38 | PMunch | disruptek, during a pandemic? |
18:54:46 | disruptek | people /do/ it. |
18:54:57 | disruptek | people fucking do it, i should say. |
18:55:01 | disruptek | or, fucking people do it. |
18:55:30 | FromDiscord | <shashlick> Too much effort, questionable returns, no fun |
18:56:12 | FromDiscord | <shashlick> But I think the truth is I'm enjoying doing nothing |
18:56:38 | disruptek | i get that. |
18:56:46 | disruptek | i soon as i find a job, i'm fucking /out of here/. |
18:56:48 | FromDiscord | <shashlick> Last thing I want to do is wrestle with some useless CI |
18:56:52 | disruptek | ikr |
18:56:53 | PMunch | @shadow. assuming you sliced it correctly it might be hash collisions |
18:56:58 | PMunch | I saw that with my data |
18:57:13 | FromDiscord | <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:38 | FromDiscord | <mratsim> if everything is on stack and visible by the compiler. |
18:57:43 | FromDiscord | <shadow.> `deckOne.toSeq[0..<cardOne].toDeque` |
18:57:47 | FromDiscord | <shadow.> that's my currrent god awful method |
18:58:19 | FromDiscord | <shadow.> lemme do some debug echos |
18:58:26 | narimiran | @shadow. that's everybody's method. even python isn't much better when it comes to deques |
18:58:45 | disruptek | mratsim: i doubt they could be better optimized, and the sm solves the problem of scopes, allocs, etc. |
18:59:07 | FromDiscord | <shadow.> hmm i see |
19:00:00 | FromDiscord | <mratsim> They can 😉 https://godbolt.org/g/26viuZ |
19:00:14 | FromDiscord | <shadow.> welp now im hitting recursion depth lol |
19:00:15 | FromDiscord | <shadow.> time to fix |
19:00:27 | disruptek | maybe in a toy, but not necessarily after we rewrite them to procs. |
19:00:34 | FromDiscord | <mratsim> C++ coroutines use functions |
19:00:43 | disruptek | this is nim. |
19:01:03 | FromDiscord | <mratsim> there is a talk with the internal, we can do this in pure C |
19:01:18 | FromDiscord | <mratsim> also LLVM will provides builtin for C++ and Swift |
19:01:19 | FromDiscord | <haxscramper> My PR for nim 1.4.2 on goldbolt was merged, so soon they should have latest nim |
19:01:28 | disruptek | good, because we'll have to. also, we'll have to make it work in js. |
19:01:29 | narimiran | nice!! |
19:02:56 | FromDiscord | <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:40 | disruptek | good; lemme add that to my resume real quick. |
19:04:26 | FromDiscord | <Quibono> What would be the fastest way to see if a snippet of binary was a subset of another snippet of binary? |
19:04:38 | FromDiscord | <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:52 | FromDiscord | <mratsim> @Quibono I use vim binary diff |
19:05:03 | FromDiscord | <mratsim> but you can to binary grep |
19:05:16 | FromDiscord | <Quibono> I mean like programmatically in Nim |
19:05:18 | FromDiscord | <mratsim> == cancellation sorry |
19:05:50 | FromDiscord | <Quibono> Trying to see if I can speed up some text comparison operations by working on the binary |
19:05:59 | Zevv | disruptek: i dont know whay pros or cons of a fsm would be |
19:06:29 | FromDiscord | <mratsim> FSM can be visually checked if it's implemented in Synthesis 😛 |
19:06:36 | FromDiscord | <mratsim> also formally verifiable |
19:07:08 | disruptek | they are equal, but we don't have the concept of the env in the fsm. |
19:07:09 | FromDiscord | <mratsim> and your overhead is guaranteed, just a goto, while function call need push/pop the stack and register. |
19:07:12 | disruptek | no passing, no calls, etc. |
19:08:33 | FromDiscord | <mratsim> btw the closure iter implementation in Nim is building a state machine |
19:09:18 | FromDiscord | <mratsim> it uses something called "nnkGotoState" |
19:09:29 | FromDiscord | <mratsim> but no documentation :/ |
19:09:29 | FromDiscord | <shadow.> pmunch: did yours win by the recursion stopper as well? |
19:09:38 | FromDiscord | <shadow.> or rather is that the only way it can stop it |
19:10:29 | PMunch | Huh? |
19:10:40 | FromDiscord | <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:35 | FromDiscord | <shadow.> oh shit wait a minute |
19:13:39 | FromDiscord | <shadow.> i think i know the issue |
19:15:13 | * | Cthalupa quit (Ping timeout: 264 seconds) |
19:15:42 | * | Cthalupa joined #nim |
19:16:25 | FromDiscord | <Quibono> Hrm, okay I'll try that. |
19:16:41 | * | PMunch quit (Quit: leaving) |
19:17:01 | FromDiscord | <Quibono> Also @disruptek Criterion errors out for M1 macs, do you want me to create an issue? |
19:17:11 | disruptek | i'd rather have a PR. |
19:17:52 | disruptek | it's likely due to the memory barrier code, which necessarily varies on arm. |
19:18:13 | disruptek | how do you feel about fixing it? |
19:18:33 | FromDiscord | <Quibono> I'd be happy to fix it if I knew how |
19:18:43 | disruptek | time to learn some arm asm. |
19:18:51 | FromDiscord | <Quibono> The error is "cycle counting not implemented on this platform" |
19:19:22 | Zevv | disruptek: no env, where do my locals live |
19:19:27 | disruptek | locally. |
19:19:34 | disruptek | we just lift them. |
19:19:41 | Zevv | where to |
19:19:47 | disruptek | top of the proc. |
19:19:57 | disruptek | or, at least, prior to the fsm. |
19:20:07 | Zevv | right. |
19:20:10 | disruptek | right. |
19:20:34 | Zevv | I feel how this should be equivalent |
19:20:39 | Zevv | but i dont see it yet |
19:20:49 | disruptek | same same but different. |
19:21:06 | disruptek | different enough that it may practically require a separate impl. |
19:22:51 | disruptek | zevv: what it buys us is no need for a trampoline. |
19:23:01 | disruptek | no heap allocs. |
19:23:22 | FromDiscord | <haxscramper> Nim `1.4.2` is now available on godbolt |
19:23:41 | narimiran | bravo! will you make a forum post about it maybe? |
19:24:06 | FromDiscord | <haxscramper> well, this just a small fix, I don't think there is much to talk about |
19:24:24 | ForumUpdaterBot | New 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:27 | narimiran | i'll tweet about it at least :) |
19:25:00 | FromDiscord | <haxscramper> oh |
19:25:11 | FromDiscord | <haxscramper> I think if you could come up with some example |
19:25:34 | FromDiscord | <haxscramper> For difference between let's say 1.20 and 1.4.2 for ARC, it would be even better |
19:25:35 | FromDiscord | <haxscramper> I' |
19:37:17 | Zevv | disruptek: 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:29 | disruptek | i feel you. |
19:37:33 | Zevv | I know other implementations use this approach |
19:37:40 | Zevv | and I have this gut feeling of equivalence |
19:38:10 | * | Arrrrrrrr quit (Quit: Arrrrrrrr) |
19:38:10 | Zevv | I'm aquinted with the C duffs device trick |
19:38:13 | disruptek | remember that the original paper starts off with a goto-based rewrite before lifting into procs. |
19:38:22 | Zevv | but I don't see the memory part of it. |
19:38:54 | disruptek | the memory part is improved because we have no env and no need for tco. |
19:39:21 | * | Arrrrrrrr joined #nim |
19:39:23 | disruptek | instead of an env per type, we have symbol-based granularity. |
19:39:24 | Zevv | do you lose your fork? |
19:39:31 | disruptek | yes. |
19:39:48 | Zevv | how do you make x instances of something |
19:40:00 | Zevv | you need /some/ allocation for each instance |
19:40:05 | disruptek | yes, on your stack. |
19:40:21 | Zevv | yes but no but yes but |
19:40:30 | Zevv | that doesn't make sense |
19:40:43 | disruptek | you can alloc on the stack. |
19:40:49 | Zevv | I do accept on a socket and 'instantiate' a client in a local var |
19:40:51 | Fish-Face | Ah, I guess my slowness is because I didn't use deques |
19:41:12 | Zevv | in CPS these client locals naturally group into the env |
19:41:33 | disruptek | yes, we create a new symbol for you. |
19:41:42 | disruptek | it's fine. not any more work than we do now. |
19:41:54 | Zevv | hmm. I need to play with it and see what it looks like |
19:42:17 | disruptek | i'm pretty sure we can just let mratsim impl it in synthesis trivially. |
19:42:36 | Zevv | I believe so. But will it be simple & light and grokkable by non-mratsims? |
19:42:49 | Zevv | or is it super effectively streamlined and out of this universe |
19:42:53 | FromDiscord | <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:10 | disruptek | i think it will be simpler to read than our current approach. |
19:43:26 | Zevv | it might; I'll see if I cna do some reading up on ths |
19:43:36 | disruptek | mratsim: pffbt. 😁 |
19:44:30 | FromDiscord | <mratsim> synthesis is just 500 LOC 😉 |
19:45:02 | disruptek | and a toy cps fsm will be like 30-50 lines. there's no trampoline, etc. |
19:45:40 | FromDiscord | <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:15 | disruptek | mratsim: here's the thing, we can do high-level optimization of the fsm. these aren't hand-written. |
19:46:38 | FromDiscord | <mratsim> but if we figure out the nnkGotoState in Nim maybe we don't need synthesis |
19:47:42 | disruptek | well, i'll let araq speak to that. |
19:47:56 | Zevv | can you whip up some kind of example? take one of my stash toys and show what it looks like, transformed? |
19:47:59 | FromDiscord | <mratsim> I assume goto state goto a state :p |
19:48:04 | disruptek | it's not strictly necessary afaik. |
19:48:08 | FromDiscord | <mratsim> but how do I set a state |
19:48:24 | disruptek | you mean for reentrant use? |
19:48:38 | Zevv | will it rely on C goto? |
19:48:45 | FromDiscord | <mratsim> yes |
19:48:50 | Zevv | so js is out |
19:48:56 | FromDiscord | <mratsim> js has goto |
19:49:00 | Zevv | what |
19:49:06 | disruptek | it will rely upon nim. |
19:49:14 | FromDiscord | <mratsim> but i don't know if that compiles on JS, Araq didn't reply |
19:49:19 | Zevv | and nim only - that is Good |
19:49:50 | FromDiscord | <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:58 | Zevv | id 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:06 | FromDiscord | <mratsim> or maybe it doesn't have goto? https://alexsexton.com/blog/2009/07/goto-dot-js/ |
19:50:20 | FromDiscord | <shadow.> pmunch if you're still here |
19:50:20 | FromDiscord | <shadow.> https://play.nim-lang.org/#ix=2Jb8 |
19:50:24 | FromDiscord | <shadow.> fixed the indexing thing |
19:50:28 | FromDiscord | <shadow.> still seems to be falling short |
19:50:41 | FromDiscord | <mratsim> @myphs you can short circuit your CPU and read the memory after, guaranteed randomness 😉 |
19:51:02 | FromDiscord | <mratsim> "Summer of Goto" :p |
19:51:30 | FromDiscord | <mratsim> I'll check if synthesis compiles in JS |
19:51:41 | FromDiscord | <myphs> That's actually my current approach, but I got into a CPU shortage recently 🙄 |
19:52:11 | FromDiscord | <mratsim> @zevv, @disruptek, why is Araq worried about other lang copying CPS? |
19:52:31 | disruptek | he says he's not. |
19:52:52 | FromDiscord | <mratsim> Is it because V is looking into Weave? https://github.com/vlang/v/issues/1868 |
19:52:54 | disbot | ➥ Proper support for distributed computing, parallelism and concurrency |
19:53:17 | disruptek | i 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:53 | disruptek | i still think v can teach us something about packed ast, but it's just my opinion. |
19:54:11 | disruptek | i mean, iiuc their approach is more what i had in mind for the technology. |
19:54:31 | FromDiscord | <mratsim> we need packed json before packed AST imo |
19:54:34 | disruptek | araq told me he is rewriting all my ic shit, so what the hell do i know. |
19:54:54 | disruptek | we already have packedjson and packedast. |
19:54:58 | * | superbia joined #nim |
19:55:23 | FromDiscord | <mratsim> JsonNode are very ergonomic but oh so wasteful |
19:55:40 | disruptek | jason doesn't even compile anymore. |
19:56:15 | disruptek | hard to give a shit when getTypeInst is broken. |
19:57:04 | Zoom[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:20 | narimiran | -d:danger? |
19:57:38 | narimiran | how can it be 100x slower on your machine than mine? |
19:58:17 | FromDiscord | <mratsim> @zevv, total noob with Nim js, I get "fopen is not defined" |
19:58:43 | FromDiscord | <mratsim> ah it's because I also dump the graph |
19:58:45 | narimiran | Zoom[m]: can you share your code? |
19:59:39 | Zoom[m] | No danger, just `-gc:orc if defined(release): --opt:speed --passC:"-flto" --passL:"-flto"` |
19:59:58 | Zoom[m] | Will push asap |
20:00:01 | narimiran | can you try with arc? |
20:01:27 | FromDiscord | <mratsim> @zevv Nim compiles goto to a do while(false) with a case switch inside. |
20:02:04 | FromDiscord | <mratsim> though I think there is a codegen error somewhere with the state |
20:04:58 | FromDiscord | <Quibono> sent a code paste, see https://play.nim-lang.org/#ix=2Jbi |
20:06:01 | Zoom[m] | narimiran: https://github.com/ZoomRmc/aoc2020_nim/blob/main/src/aoc22.nim |
20:06:12 | FromDiscord | <shadow.> well |
20:06:17 | FromDiscord | <shadow.> are you trying to make those bytes? |
20:06:20 | FromDiscord | <shadow.> are you forgetting 0b? |
20:06:22 | FromDiscord | <shadow.> @Quibono |
20:07:06 | FromDiscord | <Quibono> When I have 0b it also gets annoyed at me |
20:07:33 | FromDiscord | <shadow.> 0b is byte prefix |
20:07:38 | FromDiscord | <shadow.> you can do like |
20:07:53 | FromDiscord | <shadow.> `var x: array[3, uint8] = [0b01100100,0b01101111,0b01100111]` |
20:08:10 | narimiran | Zoom[m]: yours is slightly faster and with less instructions overall |
20:09:41 | narimiran | Zoom[m]: let me see if it helps to introduce the procs you have for deque slicing, etc. |
20:10:02 | Zoom[m] | Good to hear. There's some room for improvement still |
20:10:34 | Zoom[m] | I didn't code it for speed at all, except the check before recursion. |
20:10:48 | FromDiscord | <Quibono> sent a code paste, see https://play.nim-lang.org/#ix=2Jbl |
20:11:00 | FromDiscord | <Quibono> This still gives an error that it was expecting uint8 and got int |
20:11:03 | Zevv | mratsim: yeah I see that part, but I don't understand what we do with the stack |
20:11:13 | FromDiscord | <Daniel> Intel 765p 1TB seems like cost efficient buy now. |
20:11:21 | FromDiscord | <mratsim> @Quibono [byte 01100100,01101111,01100111] |
20:11:26 | * | Arrrrrrrr quit (Quit: Arrrrrrrr) |
20:11:35 | FromDiscord | <mratsim> (edit) "01100100,01101111,01100111]" => "0b01100100, 0b01101111, 0b01100111]" |
20:11:43 | FromDiscord | <mratsim> everything is int by default |
20:12:26 | FromDiscord | <Quibono> Okay, thank you. Lol, I'm trying to see if I can make a faster contains for binary data. |
20:12:27 | FromDiscord | <mratsim> @Zevv, stack? are you talking about the state machine or the continuation? |
20:12:50 | FromDiscord | <mratsim> @Quibono order your data and do a binary search |
20:12:53 | Zevv | I think I'm confused |
20:13:25 | FromDiscord | <mratsim> the stack is just about where do you put the context of your continuation |
20:13:51 | narimiran | Zoom[m]: calculating max every time does the trick! |
20:13:53 | FromDiscord | <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:10 | FromDiscord | <mratsim> @narimiran, did you reply to my blog post proposal? |
20:14:39 | narimiran | @mratsim i'm not sure i know what you're talking about |
20:14:58 | Zevv | yes but if you yield, it escapes the called |
20:15:05 | Zevv | caller |
20:15:12 | FromDiscord | <mratsim> @narimiran: https://gist.github.com/mratsim/61b2e25d098df0634143d501a77d8599 |
20:15:28 | FromDiscord | <mratsim> no if you yield it returns control to the caller |
20:16:01 | narimiran | @mratsim can i read it tomorrow morning? now i'm too tired for serious stuff |
20:16:07 | Zevv | I need to actually see this I think. I'm not having a clear head, that also doesn't help |
20:16:08 | FromDiscord | <mratsim> of course |
20:16:27 | FromDiscord | <mratsim> take a function that returns a value |
20:17:00 | FromDiscord | <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:13 | Zevv | sure. but take this for example: https://github.com/disruptek/cps/blob/master/stash/iterator.nim#L39 |
20:17:16 | FromDiscord | <mratsim> continuation are the same |
20:17:24 | Zevv | I instantate 2 of those. Where do the 'i's live? |
20:17:29 | FromDiscord | <mratsim> the only issue is if you return from the caller. |
20:17:31 | Zevv | not on the stack |
20:17:46 | disruptek | yes. |
20:18:18 | disruptek | var i_23423423, i_90329223: int |
20:18:21 | FromDiscord | <mratsim> it lives on the stack of their caller |
20:18:30 | Zevv | What if I *dynamically* instantiate them? |
20:18:38 | disruptek | dynamically how? |
20:18:40 | FromDiscord | <mratsim> a stack is dynamically resizable |
20:18:51 | FromDiscord | <mratsim> i.e. use alloca |
20:19:07 | FromDiscord | <mratsim> well not the stack but the space you can reserve |
20:19:45 | disruptek | remember that we see your code. we see it fully sem'd. |
20:19:52 | disruptek | we rewrite it. that is all. |
20:20:16 | Zevv | disruptek: https://play.nim-lang.org/#ix=2Jbn where do the i's live |
20:20:33 | FromDiscord | <mratsim> they don't live, they don't yield, they jive and thei jield |
20:20:42 | disruptek | heh |
20:21:08 | FromDiscord | <mratsim> on the stack/global in the for loop |
20:21:12 | disruptek | yes. |
20:21:40 | Zevv | What if I create 1 million, and 999.999 terminate |
20:21:48 | disruptek | i'm okay with that. |
20:22:08 | Zevv | I don't think I am |
20:22:21 | Zevv | if I have incoming connections of unknown duration. 1000 coming in every second |
20:22:24 | FromDiscord | <mratsim> the stack is automatically collected when you exit the function |
20:22:44 | Zevv | this can't work, either that or I'm too dumb |
20:22:56 | disruptek | you're over-thinking it. |
20:23:24 | disruptek | the syntax doesn't work, but the memory does. |
20:23:33 | FromDiscord | <mratsim> This is similar to rust zero alloc futures (actually lower level) and C++ zero alloc coroutines. |
20:23:55 | Zevv | I trust you on this, sure |
20:23:57 | FromDiscord | <mratsim> Also even in Weave, I have a demo with stack allocation with TRILLIONS of fibonacci compute |
20:24:20 | FromDiscord | <mratsim> and continuation have an advantage over wWeave: tail calls |
20:24:27 | Zevv | but with an unbound real world load. |
20:24:42 | Zevv | like I said, I have 1000 connections coming in every second, most of those go away fast but some linger |
20:24:46 | Zevv | new stuff is alloca()ed |
20:24:48 | FromDiscord | <mratsim> in the real world you have a timeout 😉 |
20:24:50 | disruptek | zevv: it gets rewritten to be /simpler/, either the compiler is doing it or we are. |
20:24:51 | Zevv | but old stuff can't be freeed |
20:25:10 | FromDiscord | <mratsim> well if you do'nt limit connection you get buffer overflow anyway |
20:25:16 | disruptek | they can be /replaced/. |
20:25:27 | FromDiscord | <mratsim> ^ this |
20:25:41 | disruptek | we don't /want/ to alloc or free. |
20:25:47 | disruptek | that's the whole point. |
20:25:50 | Zevv | no I get that, sure |
20:25:54 | disruptek | yeah. |
20:25:58 | FromDiscord | <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:02 | disruptek | so you have an array of 1MM continuations. |
20:26:09 | Zevv | but I just don't see the practical consequences adn implications yet |
20:26:19 | disruptek | daniel: because gcc. |
20:26:44 | FromDiscord | <mratsim> also @zevv, if you need autofree of alloca-ed coroutines just wrap them in an inline function. |
20:26:47 | FromDiscord | <Daniel> (edit) "chips" => "chips(transistors)" |
20:26:54 | disruptek | if gcc would just fucking stop porting itself to every damned platform... |
20:27:14 | FromDiscord | <Daniel> What do you mean gcc?..because gcc is available everyhwere? |
20:27:21 | FromDiscord | <mratsim> pretty much |
20:27:23 | disruptek | zevv: "free tco". |
20:27:55 | Zevv | ok, I'll bite |
20:27:59 | Zevv | it'll come to me later |
20:28:26 | FromDiscord | <mratsim> @Daniel C stays maybe for the same reason Esperanto has not displaced English |
20:28:35 | FromDiscord | <mratsim> despite being new and having plenty of advantages |
20:29:37 | FromDiscord | <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:37 | FromDiscord | <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:59 | FromDiscord | <mratsim> that's inertia or critical mass |
20:30:08 | Zevv | dom96: until you hit android. If you're in C-land, you're not a first class citizen there |
20:30:19 | FromDiscord | <mratsim> too big to fail would be people going in drove to save C if it was going to disappear |
20:30:28 | FromDiscord | <haxscramper> oh well |
20:30:34 | FromDiscord | <haxscramper> wrong wording again |
20:30:46 | FromDiscord | <Daniel> Well, android is apparently linux, but its actually huge JVM |
20:31:36 | FromDiscord | <Daniel> I am just puzzled how even nobody did Assembly high level version, like ++, #, script...etc |
20:32:05 | FromDiscord | <Daniel> i guess as mentioned before, because of compilers |
20:34:06 | Zevv | disruptek: I think what bothers me is that continuations have this nice "free floating" feel to them. They are not bound to *anything* |
20:34:31 | Zevv | they live in a different plane, and have nothing to do with their birthplace |
20:34:49 | Zevv | they pop into existence and just /are/ |
20:34:53 | FromDiscord | <mratsim> @Daniel the high level assembly is called C |
20:34:55 | disruptek | right, but imagine that you picked one up from the heap and put it on the stack. |
20:35:07 | Zevv | then you glue it in place |
20:35:12 | FromDiscord | <mratsim> @Zevv, like a variable. |
20:35:12 | Zevv | it can't go, it can't move |
20:35:15 | narimiran | Zoom[m]: i've updated my solution based on your ideas: https://github.com/narimiran/AdventOfCode2020/commit/b87291ebadd1516b7014852fe97c0d105a124e2a |
20:35:17 | haxscramper | disruptek: 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:35 | disruptek | if you know that you will never leave the stack, then you know how you can rewrite it even more aggressively. |
20:35:40 | disruptek | haxscramper: i'm fine with it. |
20:35:54 | Zevv | disruptek: I see that |
20:36:16 | FromDiscord | <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:31 | Zevv | disruptek: I'm just very limited by any lack of experience or formal background in this stuff |
20:36:32 | FromDiscord | <mratsim> so on the stack is the struct |
20:36:38 | Zevv | you can't do this kind of things on the feels |
20:36:43 | disruptek | sure i can. |
20:36:51 | Zevv | yeah you see where the brought you |
20:36:57 | FromDiscord | <mratsim> I have no formal background eeither |
20:36:59 | Zevv | here we are, the deaf and the blind |
20:37:04 | FromDiscord | <mratsim> I never took CS courses |
20:37:04 | Zevv | and then mratsim comes along |
20:37:20 | disruptek | unimpeded by the scientific process, you mean. |
20:37:25 | Zevv | hehe |
20:37:44 | disruptek | unfettered by expertise or even passing familiarity. |
20:38:06 | Zevv | ok, let's just go there. I know I'll catch up, these things always take some time for me to grow |
20:38:15 | disruptek | but to most of mratsim's research, i say "i don't care." |
20:38:15 | FromDiscord | <mratsim> fettered by time and rabbit holes |
20:38:21 | disruptek | i don't really care about how other people do it. |
20:38:25 | Zevv | CPS was just so very intuitive once I *got therE* |
20:38:56 | FromDiscord | <mratsim> I care why they do it like this and also how |
20:39:08 | FromDiscord | <mratsim> because the devil is in the details |
20:39:12 | Zevv | even educated fleas do it |
20:39:31 | disruptek | sure, but if it doesn't compose with the rest of nim, then it hardly matters. |
20:39:53 | Zoom[m] | narimiran: Cool! Now yours beats mine by 10-20% |
20:39:53 | Zevv | If it composes with C++, we should be good, right |
20:40:04 | disruptek | i don't want to write c++ in nim. |
20:40:07 | FromDiscord | <mratsim> no one composes with C++ |
20:40:20 | FromDiscord | <mratsim> did you see the poor people trying to access the C++ vtable? |
20:40:32 | FromDiscord | <mratsim> no? Well they ran away |
20:40:42 | Zevv | today I needed to extend a parser written in PEGTL. it was hilarious. |
20:41:18 | Zoom[m] | narimiran: I'd feel much more comfortable procrastinating over optimizing day22 the whole night, rather than completing d20p2... :P |
20:41:30 | disruptek | !repo disruptek/dist |
20:41:31 | disbot | https://github.com/disruptek/dist -- 9dist: 11a nim distribution 15 1⭐ 0🍴 |
20:41:43 | disruptek | mratsim: why won't weave submodule here? |
20:41:49 | disruptek | in the 1.2.9 branch. |
20:42:06 | disruptek | https://github.com/disruptek/dist/runs/1596779313#step:8:20 |
20:42:12 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2Jbr |
20:42:19 | FromDiscord | <Quibono> How do I make a proc that can work on arrays of variable size? |
20:42:32 | FromDiscord | <haxscramper> Make array size a generic argument |
20:42:39 | Zevv | openArray |
20:42:42 | narimiran | Zoom[m]: same here :) i'm leaving d20p2 for after christmas IFF i manage to solve all others |
20:42:43 | Prestige | Can macros access information about procs in other files, or just the local file? |
20:42:48 | disruptek | yes, that stuff needs rework for arc-sympathy. |
20:42:51 | Zevv | Prestige: not even local file |
20:42:52 | FromDiscord | <haxscramper> Or use `openarray` if particular size is not important, as zevv zaid |
20:43:03 | Zevv | only what's enclosed in the scope of your macro |
20:43:15 | disruptek | not true. |
20:43:19 | Prestige | Zevv: ah. I think this MI implementation would require a compiler change, then |
20:43:23 | Zevv | also not false |
20:43:36 | FromDiscord | <mratsim> disruptek: probably because I git cloned instead of gitsubmodule :p |
20:43:41 | disruptek | you can get info about a proc that you're calling from within scope even if it's not impl'd there. |
20:43:52 | Zevv | info, but not the implementation |
20:43:52 | disruptek | mratsim: hmm. it works on 1.4.3 branch. |
20:44:00 | FromDiscord | <mratsim> oh? |
20:44:09 | FromDiscord | <Quibono> Thank you |
20:44:15 | disruptek | seemingly. though arraymancer doesn't pass windows tests. |
20:44:18 | Zevv | disruptek, mratsim: what do I read or watch to get the hang of this new idea? |
20:44:28 | Zevv | the FSM part I trust you on, but more about the mm |
20:44:40 | disruptek | which part? i think you know more about this than i do. |
20:45:58 | disruptek | i guess you could look at the c++ coro impl. it's probably the most accessible to you. |
20:46:16 | Prestige | Maybe 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:39 | disruptek | what does MI mean? |
20:46:47 | disruptek | multiple-inheritance? |
20:46:51 | Prestige | Right |
20:46:56 | Zevv | ok, will do. Now I need to do some social stuff involving a playstation, a beer and loud cursing |
20:46:58 | disruptek | show us some code. |
20:47:15 | disruptek | zevv: maybe i'll make a demo late tonight. 👋 |
20:47:29 | Prestige | I 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:31 | disbot | ➥ Support for Multiple Inheritence ; snippet at 12https://play.nim-lang.org/#ix=2Jbu |
20:47:43 | Zevv | disruptek: you do that, lovely :) |
20:48:10 | disruptek | pestige: you can ignore that rfc; that avahe guy's a bozo. |
20:48:16 | Prestige | I'd love to be able to just write it so I could showcase the implementatin |
20:48:20 | Prestige | disruptek: hah |
20:48:52 | Prestige | I think this would be rather nice to have. Miss MI a lot with Nim and TS |
20:49:17 | FromDiscord | <bark> generally what does "cannot instantiate T" point to in generics? |
20:49:27 | disruptek | the lack of a concrete type. |
20:49:55 | disruptek | generics are like an equation that the compiler needs to solve given limited variables. |
20:50:14 | disruptek | give it some more compile-time constant types to fill those missing holes. |
20:50:33 | Prestige | the 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:50 | disruptek | prestige: 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:20 | disruptek | wrap the whole thing in a macro so you can rewrite anything you want. |
20:51:59 | Prestige | That solves like, 40% of it I suppose |
20:52:05 | FromDiscord | <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:10 | disruptek | or 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:15 | Prestige | I'd still need the implementations of the methods |
20:52:22 | FromDiscord | <mratsim> sorry 2015 and 2017 |
20:52:27 | disruptek | you'll have them if you wrap everything in one macro. |
20:52:36 | disruptek | this is just a PoC. |
20:52:38 | * | narimiran quit (Ping timeout: 256 seconds) |
20:52:41 | Prestige | true |
20:52:45 | Prestige | Good point |
20:52:52 | disruptek | you could use term rewriting but i'd recommend against it. |
20:52:59 | FromDiscord | <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:13 | FromDiscord | <mratsim> I don't agree with Araq that async/await should do the whole transformation |
20:53:26 | FromDiscord | <mratsim> continuation or suspendable functions should be a primitive |
20:53:30 | FromDiscord | <bark> I'm literally calling the procedure with procname[type1, type2]() |
20:53:44 | disruptek | bark: got code? |
20:54:00 | FromDiscord | <bark> yeah i'm trying to isolate the problem |
20:54:40 | Prestige | disruptek: 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:47 | disruptek | your result type is T1 or T2 and requires-init? |
20:54:56 | Prestige | But yeah, I could do that in a macro if it's wrapped |
20:55:04 | disruptek | prestige: sure. |
20:55:39 | FromDiscord | <sealmove> how to convert 2 bytes to a unicode Rune? |
20:55:41 | FromDiscord | <mratsim> @zevv actually 2015 "negative overhead" and 2017 "under the cover" |
20:55:41 | disruptek | if you want to really do it right, but outside the compiler, you can make a compiler pass. but it's pretty shitty. |
20:56:27 | Prestige | I should probably get familiar with the compiler at some point, anyhow |
20:56:57 | FromDiscord | <Quibono> Anyone up to look at my first stab at recursion? It's giving the wrong result and IDK why. |
20:57:28 | Prestige | @sealmove have you seen https://nim-lang.org/docs/unicode.html |
20:58:00 | FromDiscord | <sealmove> yes, looking at it |
20:58:23 | FromDiscord | <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:21 | FromDiscord | <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:23 | FromDiscord | <Quibono> https://play.nim-lang.org/#ix=2JbC Can anyone see where I'm messing up? |
21:09:31 | * | vsantana joined #nim |
21:11:37 | Prestige | well your wIdx is always 0, yes? |
21:11:58 | Prestige | so it's never equal to len(word) - 1 |
21:11:59 | FromDiscord | <Quibono> Well I want to increment it by 1 every time I get a match |
21:12:14 | FromDiscord | <Quibono> So that I search through each letter in the word |
21:12:44 | Prestige | return on line 11 then |
21:13:27 | Prestige | instead of just creating a new variable |
21:14:11 | FromDiscord | <Quibono> return false? |
21:16:06 | Prestige | https://play.nim-lang.org/#ix=2JbO |
21:16:52 | FromDiscord | <Quibono> Oh weird, okay. That hurts my brain, thank you |
21:17:05 | Prestige | No prob |
21:28:29 | * | ex_nihilo quit (Quit: Leaving) |
21:36:18 | FromDiscord | <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:54 | FromDiscord | <mratsim> why would you do that? |
21:44:36 | FromDiscord | <Quibono> I was just wondering if my search method would be faster once you take the time to convert it, is all. |
21:48:44 | Fish-Face | welp I tried switching to deques and it's either slower or broken or both |
21:48:48 | Fish-Face | I think both |
21:55:29 | * | haxscramper quit (Remote host closed the connection) |
21:56:58 | FromDiscord | <mratsim> @Quibono use proc search[T: byte|char](input: openarray[T], ...) = |
21:57:03 | FromDiscord | <mratsim> thos works on byte and char |
21:57:23 | FromDiscord | <mratsim> byte and char are semantically different but at implementation level exactly the same |
22:10:12 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2Jcb |
22:25:18 | * | Vladar quit (Quit: Leaving) |
22:32:53 | FromDiscord | <mratsim> I can't compile tests in CPS anymore :/ |
22:33:19 | FromDiscord | <mratsim> ah, it's because I have cps installed on my machine |
22:33:26 | FromDiscord | <mratsim> nimble grmblbl |
22:35:30 | disruptek | no comment. |
22:36:51 | FromDiscord | <mratsim> still can't compile |
22:37:05 | FromDiscord | <mratsim> SIGSEGV in the latest compiler |
22:37:06 | disruptek | you realize that i merged typed into master, right? |
22:37:24 | FromDiscord | <mratsim> yes, but at least one test should pass no? |
22:37:27 | disruptek | welcome to modern cps. |
22:37:39 | disruptek | no, nothing works. |
22:38:05 | FromDiscord | <mratsim> ah shoot |
22:38:19 | disruptek | just go back a commit or two. |
22:38:32 | disruptek | i mean, what are you trying to test? |
22:38:36 | FromDiscord | <mratsim> well i wanted to check the codegen of typed |
22:38:45 | disruptek | yeah, me too. 😁 |
22:39:20 | FromDiscord | <mratsim> does that include your stack update? |
22:39:51 | disruptek | 2cde45410f93690c269f4c95d0eb4bed2c7002ba |
22:40:16 | disruptek | it's experiments/main.nim |
22:41:22 | FromDiscord | <mratsim> oooh it compiles |
22:43:43 | disruptek | it's our testing dispatcher that just does timers or whatever. |
22:44:00 | FromDiscord | <mratsim> "Cont(i: 0)" you can create field that don't exist with ref object of rootobj? |
22:44:12 | FromDiscord | <mratsim> man I've been missing even more hacky stuff |
22:44:15 | disruptek | it's not a ref object. |
22:44:22 | disruptek | also, the field exists. |
22:45:10 | FromDiscord | <mratsim> when I look in the event queue file line 49 I see ref object? |
22:45:17 | disruptek | we could benefit from that self-referencial typedef for this, btw. |
22:45:44 | disruptek | the type is defined on line 54. |
22:46:13 | FromDiscord | <mratsim> I did try having `type Task = object of Task` |
22:46:20 | disruptek | haha |
22:46:22 | FromDiscord | <mratsim> it worked sometimes |
22:46:37 | disruptek | it's probably a trap for our own code. |
22:51:02 | FromDiscord | <ElegantBeef> Is there a way to force testament to set `--colors:on` for each test? |
22:51:24 | FromDiscord | <ElegantBeef> Seems like testament is disabling that option, and causing tests to pass that i dont want to |
22:51:36 | disruptek | no one uses testament. |
22:51:43 | disruptek | it's all about my testes, now. |
22:51:47 | FromDiscord | <ElegantBeef> I mean the nim repo does |
22:52:10 | FromDiscord | <ElegantBeef> I'm testing colourized output on the nim compiler and the `errmsgs` category is the best repository of most errors |
22:52:53 | FromDiscord | <ElegantBeef> But it seems that it's disabling colors for each test so it passes |
22:53:02 | disruptek | good? |
22:53:06 | FromDiscord | <ElegantBeef> No |
22:53:12 | FromDiscord | <ElegantBeef> I want them to fail so i can actually see the colouring |
22:53:28 | FromDiscord | <ElegantBeef> To see which errors need highlighted still and also what information i should highlight |
22:54:25 | FromDiscord | <ElegantBeef> I dont know a better source of all the errors |
23:03:39 | Prestige | The 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:47 | Prestige | for the stdlib, popular frameworks, etc |
23:04:53 | ForumUpdaterBot | New thread by B3liever: ECS introduction by example, see https://forum.nim-lang.org/t/7280 |
23:05:33 | * | muffindrake joined #nim |
23:07:43 | FromDiscord | <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:58 | FromDiscord | <shadow.> and yeah, more third party libraries would probably also help |
23:08:34 | Prestige | It would be nice to have some sort of "dream list" to know what people that don't use Nim, are missing |
23:09:46 | Prestige | I 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:04 | disruptek_2 | this is disruptek's alt account |
23:10:18 | Prestige | disruptek_2: imposter |
23:11:44 | Prestige | It's also difficult to integrate Nim at work because everyone knows and uses X language |
23:12:55 | disruptek_2 | i am the second disruptek |
23:13:01 | * | disruptek_2 quit (Remote host closed the connection) |
23:14:57 | FromDiscord | <mratsim> a good DLL story would help |
23:15:08 | FromDiscord | <mratsim> for integration |
23:15:44 | disruptek | the dll story is much better with arc. |
23:16:05 | FromDiscord | <ElegantBeef> No more `setupGC` |
23:16:47 | FromDiscord | <ElegantBeef> Well prestige i'm trying to make the errors more readable, so i hope that helps getting people in here |
23:17:07 | Prestige | That would be great. I also think editor support could be betterr |
23:17:19 | Prestige | Although I haven't tried vscode, maybe it's good there |
23:17:29 | FromDiscord | <ElegantBeef> It's eh everywhere |
23:17:37 | FromDiscord | <ElegantBeef> Saem i believe is working on improving nimsuggest |
23:17:40 | disruptek | i maintain that nim is not /better enough/ to justify working in an undersupported language. |
23:18:21 | Prestige | I'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:54 | FromDiscord | <ElegantBeef> I really shouldnt be the one figuring out colouring for errors 😄 https://media.discordapp.net/attachments/371759389889003532/791082366939824139/unknown.png |
23:25:17 | FromDiscord | <shadow.> disruptek can you confirm your alt |
23:25:39 | FromDiscord | <shadow.> @ElegantBeef what are you using for colors |
23:25:42 | FromDiscord | <shadow.> ansi codes? |
23:25:45 | FromDiscord | <ElegantBeef> I'm using terminal colours |
23:25:48 | FromDiscord | <ElegantBeef> so yes |
23:26:05 | FromDiscord | <ElegantBeef> I more mean i shouldnt be the one in charge of selecting what part of errors are "important" |
23:26:12 | FromDiscord | <shadow.> quick heads up cmd and powershell don't natively support those |
23:26:12 | disruptek | no doubt. |
23:26:20 | disruptek | shit, you can't even /spell/ `color`. |
23:26:25 | FromDiscord | <shadow.> you have to exec an empty terminal command to enable them |
23:26:38 | FromDiscord | <shadow.> it's odd |
23:26:42 | FromDiscord | <ElegantBeef> Sorry disruptek, as i'm Canadian i spell it properly |
23:26:45 | FromDiscord | <shadow.> lmfao |
23:26:47 | disruptek | lies. |
23:27:03 | FromDiscord | <shadow.> judging by how he started the sentence with "sorry", i believe it |
23:28:15 | Fish-Face | I have today down to 90ms |
23:28:18 | Fish-Face | it's been a bit arduous |
23:28:28 | Fish-Face | my hash routine for deques was wrong |
23:29:26 | * | tane quit (Quit: Leaving) |
23:29:41 | FromDiscord | <shadow.> i didnt even try on speed my solution just hashes `(deq1.toSeq, deq2.toSeq)` lmfao |
23:29:49 | Fish-Face | LOL |
23:29:50 | FromDiscord | <shadow.> cba to write my own hash function |
23:29:52 | Fish-Face | how long was that :P |
23:29:56 | FromDiscord | <shadow.> no idea |
23:30:00 | FromDiscord | <shadow.> with danger prolly around 500ms |
23:30:00 | FromDiscord | <shadow.> lmfao |
23:30:07 | FromDiscord | <shadow.> without -d:danger over 5 seconds... |
23:30:25 | Fish-Face | does -d:danger include all of -d:release? |
23:30:33 | FromDiscord | <shadow.> probably -d:release on steroids |
23:30:47 | Fish-Face | I got 6 seconds in debug mode before any optimisations (with seqs) |
23:30:55 | FromDiscord | <shadow.> loll |
23:30:59 | Fish-Face | I should retry that with -d:danger... |
23:32:11 | FromDiscord | <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:13 | FromDiscord | <shadow.> lol |
23:33:56 | FromDiscord | <shadow.> but yeah try with -d:danger and maybe --gc:arc idk |
23:34:06 | FromDiscord | <shadow.> --passc:-flto is also a hit or miss lol |
23:38:03 | FromDiscord | <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:18 | FromDiscord | <xCFF> other than overloading `%` |
23:39:57 | FromDiscord | <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:30 | FromDiscord | <ajusa> (edit) "marshaling" => "unmarshaling" |
23:41:50 | FromDiscord | <xCFF> If possible yeah! |
23:42:49 | FromDiscord | <xCFF> sent a code paste, see https://play.nim-lang.org/#ix=2Jcx |
23:42:58 | FromDiscord | <xCFF> seralizes to {"test":"whatevber"} |
23:43:18 | FromDiscord | <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:06 | FromDiscord | <xCFF> mostly just to keep the naming conventions w/ nim. The key i need uses underscores and nim prefers camel case |
23:44:46 | FromDiscord | <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:17 | FromDiscord | <ajusa> https://play.nim-lang.org/#ix=2JcB is a quick example of what I am talking about |
23:46:17 | FromDiscord | <xCFF> sent a code paste, see https://play.nim-lang.org/#ix=2JcC |
23:46:25 | FromDiscord | <ajusa> Yup, exactly! |
23:46:53 | FromDiscord | <xCFF> ha! no kidding. Thanks! |
23:47:14 | FromDiscord | <Quibono> Is there a way to make an array whose length is defined at runtime? |
23:48:01 | FromDiscord | <ElegantBeef> Nope arrays length has to be defined at compiletime |
23:50:08 | FromDiscord | <Quibono> Hrm tricksy |
23:51:19 | FromDiscord | <Quibono> Is there any way to be silly and bypass that by auto generating arrays of length 2..x at compile time? |
23:51:46 | FromDiscord | <ElegantBeef> Why not just use seqs? |
23:52:14 | FromDiscord | <Quibono> Seqs use the heap right? |
23:52:23 | FromDiscord | <ElegantBeef> Yes |
23:52:45 | FromDiscord | <Quibono> I'm trying to brain myself with a hard-ish real time system. |
23:52:55 | FromDiscord | <Quibono> Because I love myself lol. |
23:53:02 | FromDiscord | <ElegantBeef> Then use an array larger than you'll ever need |
23:53:38 | FromDiscord | <Quibono> And just check if I hit a zero as a way to stop looking at it? |
23:57:04 | FromDiscord | <Quibono> For some stuff I know exactly how big it is, but yeah that's a good point. |
23:58:05 | FromDiscord | <ElegantBeef> Well you can just store the index of the last added object |