00:15:21 | NimEventer | New thread by Mardiyah: Do name the array element , see https://forum.nim-lang.org/t/9106 |
00:20:24 | * | noeontheend joined #nim |
00:20:45 | * | lumo_e quit (Read error: Connection reset by peer) |
00:39:25 | NimEventer | New thread by Veksha: Pass as parameter only a certain procedure from multiple with the same name (overloaded procs), see https://forum.nim-lang.org/t/9107 |
00:52:27 | * | vicfred quit (Quit: Leaving) |
00:57:06 | FromDiscord | <TryAngle> In reply to @Yardanico "nimble.directory actually tries to": hmm interesting, so they are build as some kind of test but never stored / hosted? |
00:57:54 | FromDiscord | <Yardanico> No, you were actually able to check them, but apparently as beef said it's broken now |
01:02:16 | FromDiscord | <TryAngle> In reply to @Yardanico "No, you were actually": ah I see ok, because I checked last week or so and was wondered why I didn't find anything but this makes sense then |
01:02:48 | * | jmdaemon quit (Read error: Connection reset by peer) |
01:03:40 | * | jmdaemon joined #nim |
01:14:20 | FromDiscord | <Alea> do you just update a package by doing nimble install? or do you need to uninstall the existing one first? |
01:14:52 | FromDiscord | <Elegantbeef> You can have multiple versions installed concurrently |
01:15:29 | FromDiscord | <Alea> is there a command to update the existing install? |
01:16:18 | FromDiscord | <Elegantbeef> nope |
01:16:48 | FromDiscord | <Alea> :BwaahSnap: |
01:16:55 | FromDiscord | <Alea> this seems like an odd thing to be missing |
01:17:10 | FromDiscord | <Elegantbeef> You dont generally need to update all your packages |
01:17:20 | FromDiscord | <Alea> I mean just updating one |
01:17:30 | * | rockcavera quit (Remote host closed the connection) |
01:17:38 | * | neurocyte8614492 quit (Ping timeout: 250 seconds) |
01:17:51 | FromDiscord | <Elegantbeef> Just install it again it'll fetch the recent one then move your min version |
01:19:11 | FromDiscord | <TryAngle> what does↵`new result`↵do? |
01:19:16 | FromDiscord | <TryAngle> or what does new do in general? |
01:19:21 | FromDiscord | <TryAngle> (edit) "or what does new ... do" added "keyword" |
01:19:22 | FromDiscord | <Alea> treeform hasn't made a new boxy release :BwaahSnap: |
01:19:26 | FromDiscord | <Elegantbeef> New heap allocates the value |
01:19:40 | FromDiscord | <Elegantbeef> `new int` allocates a `ref int` and 0's it |
01:19:42 | FromDiscord | <ajusa> what's the "easiest" way to call a proc in a new thread and async wait for its answer? I know about https://github.com/yglukhov/asyncthreadpool but curious if there are other solutions. |
01:20:10 | FromDiscord | <Elegantbeef> The built in thread pool? |
01:20:14 | FromDiscord | <TryAngle> ah I see, pretty cool↵thanks 🥩 🥺 |
01:22:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Zne |
01:23:09 | FromDiscord | <ajusa> oh just poll on the result, not sure why I didn't think of that |
01:23:34 | FromDiscord | <ajusa> thanks for the elegant response as always |
01:26:22 | FromDiscord | <ajusa> sent a code paste, see https://paste.rs/Tba |
01:26:44 | FromDiscord | <Elegantbeef> Yea if you make a template you can make it 100% generic |
01:27:04 | FromDiscord | <Elegantbeef> `p: proc): auto` |
01:27:11 | FromDiscord | <Alea> Ok I forked the repo and made a release including the new stuff nimble install ``link`` #head doesn't seem to grab the new release though |
01:27:46 | FromDiscord | <Alea> I assume that's because my stuff isn't on the package list right? |
01:28:58 | FromDiscord | <Alea> ah, got it? |
01:36:06 | FromDiscord | <!Patitotective> i was wondering if someone knew if to wrap a c library i should only include the header↵because there are more .h, .m .c files but idk↵cause in the example (`test_opendialog.c`) it just include `nfd.h` but if i run `gcc test_opendialog.c` i get `test_opendialog.c:(.text+0x3a): undefined reference 'to NFD_OpenDialog'`↵https://github.com/mlabbe/nativefiledialog 😕 |
01:37:21 | FromDiscord | <Elegantbeef> You arent linking the library afaik |
01:37:40 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/dialogs btw |
01:38:58 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "You arent linking the": l-linking? 😕↵haven't you wrote an article...? lol |
01:39:22 | FromDiscord | <Elegantbeef> Nah i dont touch the C compiler that's for nerds |
01:39:38 | FromDiscord | <!Patitotective> :[ |
01:39:50 | FromDiscord | <Elegantbeef> https://github.com/mlabbe/nativefiledialog#compiling-your-programs |
01:40:01 | FromDiscord | <Elegantbeef> It's the same as for C |
01:41:05 | FromDiscord | <!Patitotective> but how do i get that `nfd.lib`? i have done `make` but it ouputs binarys not libs |
01:42:05 | FromDiscord | <Elegantbeef> > nfd.a will be built for release builds, and nfd\_d.a will be built for debug builds.\` |
01:43:30 | FromDiscord | <Elegantbeef> There should be a `build/lib` |
01:44:11 | FromDiscord | <!Patitotective> oh there is `libnfd.a` :D↵now i put that library next to my script? |
01:44:23 | FromDiscord | <Elegantbeef> No it's a static library |
01:44:25 | FromDiscord | <Elegantbeef> You link it |
01:44:56 | FromDiscord | <!Patitotective> what does _link_ means? |
01:45:10 | FromDiscord | <!Patitotective> like linux symlinks or? |
01:45:39 | FromDiscord | <Elegantbeef> Do yourself a favour and type in your favourite search engine "How to link a static library C" |
01:49:53 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3VbO |
01:50:28 | FromDiscord | <Elegantbeef> `-static -lnfd` |
01:52:53 | FromDiscord | <demotomohiro> I think you need to link gtk related libraries. |
01:53:04 | FromDiscord | <loaf> do any of you have experience using emscripten |
01:53:42 | FromDiscord | <demotomohiro> Probably libnfd.a depends other libraries and you need to link them. |
01:55:13 | FromDiscord | <demotomohiro> I used emscripten long time ago. |
01:56:00 | FromDiscord | <loaf> isnt there a way to automatically generate the structural html/js? |
01:59:25 | FromDiscord | <demotomohiro> If I remember collectly, I just used html file copied from somewhere when I used emscripten. |
01:59:37 | FromDiscord | <loaf> oh |
01:59:50 | FromDiscord | <loaf> because im just going by this |
01:59:52 | FromDiscord | <loaf> https://github.com/treeform/nim_emscripten_tutorial |
02:00:19 | FromDiscord | <loaf> sent a code paste, see https://paste.rs/EOP |
02:04:57 | FromDiscord | <demotomohiro> That `switch` is a nimscript proc that adds Nim compiler option. ↵`passL` pass specified arguments to backend compiler when linking. |
02:06:39 | FromDiscord | <demotomohiro> If you want to know what `-o` or `--shell-file` option do, you need to read emscripten manual. |
02:07:54 | * | noeontheend quit (Ping timeout: 250 seconds) |
02:08:39 | FromDiscord | <demotomohiro> Probably you need to get shell_minimal.html from emscripten's documents or write it manually. |
02:09:28 | FromDiscord | <loaf> sent a code paste, see https://play.nim-lang.org/#ix=3VbQ |
02:11:30 | FromDiscord | <loaf> i just dont know how nimscript procs work tbh |
02:12:10 | FromDiscord | <demotomohiro> switch("passL", "-o xxx") works like nim c --passL:"-o xxx" file.nim |
02:12:18 | FromDiscord | <loaf> oh ok |
02:14:11 | * | noeontheend joined #nim |
02:15:16 | FromDiscord | <demotomohiro> "emcc step0.c -o step0.html --shell-file shell_minimal.html" worked on your PC? That tutorial repo provides shell_minimal.html. |
02:15:37 | FromDiscord | <loaf> yeah it did |
02:15:53 | FromDiscord | <loaf> i was just wondering for my own project tbh |
02:17:48 | FromDiscord | <Valdar> Is there a best practice for putting code outside a proc or other block in a module? Is that accepted, or a no-no? |
02:19:34 | FromDiscord | <demotomohiro> This page explains about .nims file: https://nim-lang.org/docs/nims.html↵This page explains Nim compiler options: https://nim-lang.org/docs/nimc.html |
02:25:22 | * | dropkick quit (Quit: Leaving) |
02:28:05 | * | ltriant_ quit (Ping timeout: 256 seconds) |
02:28:14 | FromDiscord | <Anuke> Why is re-declaring templates (as opposed to procs) allowed? https://media.discordapp.net/attachments/371759389889003532/964351414044348508/unknown.png |
02:28:16 | * | noeontheend quit (Ping timeout: 250 seconds) |
02:30:28 | FromDiscord | <morgan> in a macro, how do i get the value of a char nimnode? |
02:30:43 | FromDiscord | <morgan> i've tried strVal(), chr(intVal()) |
02:30:54 | FromDiscord | <morgan> neither work |
02:31:08 | FromDiscord | <Elegantbeef> `.intval` |
02:31:09 | FromDiscord | <Elegantbeef> No clue dont think it should↵(@Anuke) |
02:32:37 | FromDiscord | <Elegantbeef> Works fine |
02:32:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/7CR |
02:32:48 | FromDiscord | <Anuke> <https://github.com/nim-lang/Nim/issues/8275> ancient bug it seems |
02:33:45 | * | arkurious quit (Quit: Leaving) |
02:33:49 | FromDiscord | <morgan> it still says `Error: node lacks field: intVal`, it's coming in from a tuple in a seq[untyped] if that makes any difference |
02:34:20 | FromDiscord | <Elegantbeef> are you sure it's a `nnkCharLit`? |
02:34:40 | FromDiscord | <Elegantbeef> Not working is better with an error and example |
02:35:15 | FromDiscord | <morgan> im printing out what is coming in and using the type from getType(input).repr to case stuff |
02:35:19 | FromDiscord | <morgan> and it's a char |
02:35:36 | FromDiscord | <morgan> how do i print out its type? |
02:35:56 | FromDiscord | <Elegantbeef> `.kind`? |
02:36:26 | FromDiscord | <morgan> oh it's empty |
02:36:41 | FromDiscord | <morgan> i wonder if i need to shift every index up one |
02:37:56 | FromDiscord | <morgan> oh i see it's in a tupleconstr node |
02:54:23 | * | ltriant joined #nim |
02:54:40 | * | rockcavera joined #nim |
02:54:40 | * | rockcavera quit (Changing host) |
02:54:40 | * | rockcavera joined #nim |
02:58:21 | FromDiscord | <loaf> so im trying to make a wasm gui |
02:59:17 | FromDiscord | <loaf> and idk what library to use anymore |
03:06:39 | FromDiscord | <ynfle> HTML? |
03:08:29 | FromDiscord | <Rika> id prolly assume hes using a canvas for drawing |
03:08:38 | FromDiscord | <Rika> though then its still a pian |
03:08:40 | FromDiscord | <Rika> (edit) "pian" => "pain" |
03:14:00 | FromDiscord | <loaf> i was going to use https://github.com/yglukhov/nimx |
03:14:13 | FromDiscord | <loaf> but it doesnt seem like the wasm nake flag works anymore |
03:16:29 | FromDiscord | <demotomohiro> I duckduckgo "imgui wasm" and i |
03:17:01 | FromDiscord | <demotomohiro> there are projects that use imgui on wasm |
03:19:22 | FromDiscord | <!Patitotective> duckduckwent? |
03:19:35 | FromDiscord | <Elegantbeef> ddg'd |
03:22:55 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=3Vc5 |
03:23:02 | FromDiscord | <morgan> oops sent early |
03:23:05 | FromDiscord | <morgan> (edit) "https://play.nim-lang.org/#ix=3Vc5" => "https://play.nim-lang.org/#ix=3Vc6" |
03:23:30 | FromDiscord | <morgan> so why would it work to do stuff with f on the first two lines but the second two complain that `Error: cannot evaluate at compile time: f` |
03:25:04 | FromDiscord | <Rika> what is "f";s type |
03:25:19 | FromDiscord | <morgan> untyped but it's a tree of NimNodes |
03:25:22 | FromDiscord | <morgan> this is in a macro |
03:25:32 | FromDiscord | <morgan> https://nim-lang.org/docs/macros.html#bindSym%2C%2CBindSymRule |
03:25:54 | FromDiscord | <Elegantbeef> Cause `bindsym` takes a `static string` |
03:26:21 | FromDiscord | <morgan> it says it can take a NimNode |
03:26:28 | FromDiscord | <Elegantbeef> There is 0 point in bindsym here |
03:26:35 | FromDiscord | <morgan> ok |
03:26:39 | FromDiscord | <Elegantbeef> `if ident is a NimNode, it must have nnkIdent kind. ` |
03:27:02 | FromDiscord | <morgan> sent a code paste, see https://paste.rs/s9H |
03:27:27 | FromDiscord | <Elegantbeef> What is your macro doing? |
03:28:22 | FromDiscord | <morgan> im trying to take in a list of tuples of params that it will create flags from and assign them to the command you pass in |
03:28:38 | FromDiscord | <Elegantbeef> Ok so yea no reason to bind sym |
03:28:58 | FromDiscord | <morgan> i was trying to get more info about the Idents so i can know what they do |
03:29:05 | FromDiscord | <Elegantbeef> Well make it `typed` |
03:29:17 | FromDiscord | <morgan> that didn't work |
03:29:49 | FromDiscord | <morgan> `Error: type mismatch: got '(char, bool, int)' for '('d', true, dref)' but expected '(char, string, bool, proc (val: int){.gcsafe, locks: 0.})'` |
03:30:42 | FromDiscord | <morgan> i was using an openArray of untyped stuff before but i got a similar error to that when i added a second one to it |
03:31:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vc7 |
03:31:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vc8 |
03:31:50 | FromDiscord | <morgan> i get literally the same error |
03:32:00 | FromDiscord | <morgan> wait |
03:32:02 | FromDiscord | <morgan> nvm |
03:32:03 | FromDiscord | <Elegantbeef> I just showed code that compiles |
03:32:30 | FromDiscord | <morgan> i had them in brackets |
03:32:39 | FromDiscord | <morgan> so it was getting passed in as one thing |
03:32:52 | FromDiscord | <morgan> now i get a different error, thanks for the help |
03:35:15 | * | zeus-supreme joined #nim |
03:38:32 | * | zeus-supreme1 quit (Ping timeout: 248 seconds) |
03:47:02 | FromDiscord | <Elegantbeef> No problem |
03:56:08 | * | dogtooth quit (Ping timeout: 248 seconds) |
04:06:52 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
04:11:12 | * | jmdaemon joined #nim |
04:24:11 | * | slowButPresent quit (Quit: leaving) |
04:39:05 | FromDiscord | <!Patitotective> 🌃 |
04:59:27 | * | rockcavera quit (Ping timeout: 240 seconds) |
05:06:08 | FromDiscord | <creikey> Beef do you have a good explanation for what tlsEmulation:off is for in nim 1.6.4? |
05:06:38 | FromDiscord | <Elegantbeef> thread local storage emulation |
05:10:08 | FromDiscord | <creikey> In reply to @Elegantbeef "thread local storage emulation": just read the wiki for thread local storage |
05:10:19 | FromDiscord | <creikey> why would it need to be "emulated"? You get thread local storage through winapi on windows right |
05:12:12 | FromDiscord | <Elegantbeef> I do not know |
05:12:25 | FromDiscord | <Elegantbeef> Think it's mainly for Mingw/pthread |
05:37:41 | FromDiscord | <Rika> TFW I always thought how “TLS” as in the protocol was emulated lol |
05:38:15 | FromDiscord | <Elegantbeef> Hey i also intially thought that |
05:39:29 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
05:41:55 | * | Gustavo6046 joined #nim |
05:46:03 | FromDiscord | <leorize> that's emulation↵(@creikey) |
05:50:51 | FromDiscord | <leorize> "native" TLS is where the OS supports the allocation and declaration of these objects statically, so to speak |
05:51:20 | FromDiscord | <leorize> in Nim however it's just whether the C compiler supports `_Thread` or `thread_local` |
05:54:19 | FromDiscord | <Sabena Sema> its easy to add static constructors and destructors of your own |
05:54:49 | FromDiscord | <Sabena Sema> you can use flsalloc, but also one of the .crt$ sections is constructors and one destructors |
06:05:45 | FromDiscord | <OceanMongrel> can i just say not having to use brackets for function calls is making me quite happy |
06:06:26 | FromDiscord | <Elegantbeef> I think you can say that |
06:07:30 | FromDiscord | <OceanMongrel> ok thanks |
06:12:10 | FromDiscord | <Elegantbeef> Jokes aside yea it's quite lovely |
06:12:23 | NimEventer | New thread by Huantian: Concurrent File Download with Async, see https://forum.nim-lang.org/t/9108 |
06:12:32 | FromDiscord | <huantian> finally doing threading |
06:12:52 | FromDiscord | <huantian> weird that the bridge capitalizes usernames |
06:13:54 | FromDiscord | <Elegantbeef> Does `downloadFile` not work for you? |
06:14:33 | FromDiscord | <huantian> the question is less about how to download a file and more on how to do it concurrently with max concurrent downloads |
06:15:53 | FromDiscord | <Elegantbeef> Think a seq + callbacks is the way |
06:17:48 | FromDiscord | <huantian> yeah I might just do that tbh |
06:18:21 | FromDiscord | <morgan> great so i was making progress and now something is causing a segfault in the compiler and i am really confused what would be doing that |
06:19:11 | FromDiscord | <morgan> well i commented out the code i was just working on and it still happens soooooo |
06:19:48 | FromDiscord | <xflywind> Is someone familiar with pegs? Is grammar like https://github.com/nim-lang/Nim/blob/dc4cc2dca53e3772efb3654a4ddbbe8350d1db43/tests/stdlib/tpegs.nim#L306 correct? |
06:22:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/bM8 |
06:22:45 | FromDiscord | <Elegantbeef> Might not be proper |
06:24:47 | FromDiscord | <Elegantbeef> Might need a full collection instead |
06:24:53 | FromDiscord | <huantian> hm I think I'll have to make multiple async http clients as well |
06:25:44 | FromDiscord | <Elegantbeef> Perhaps, also think this wont work due to the blocking `waitfor` |
06:25:56 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/HYe |
06:25:58 | FromDiscord | <Elegantbeef> Think it needs a blocking busy room |
06:27:22 | FromDiscord | <Elegantbeef> I pretend to known everything i know about async, so yea good luck |
06:28:45 | FromDiscord | <huantian> Hey at least I have your elegant moral support heh |
06:30:31 | FromDiscord | <Elegantbeef> Hey that's like having newspaper whilst in a porta-potty |
06:30:40 | FromDiscord | <Elegantbeef> having newspaper and no toiler paper\ |
06:31:13 | FromDiscord | <Elegantbeef> Ways to ruin jokes for $400 please alex |
06:50:50 | FromDiscord | <Rika> Put all futures into a sequence and await that? |
06:51:19 | FromDiscord | <Rika> I just skimmed through the question |
06:51:21 | FromDiscord | <Rika> BRB |
06:51:23 | FromDiscord | <Elegantbeef> Yea batches are easy |
06:52:21 | FromDiscord | <Elegantbeef> The ideal thing is something like my suggestion but without the waitfor but a sleeping while loop |
06:52:43 | FromDiscord | <Elegantbeef> Atleast i think |
06:53:18 | FromDiscord | <leorize> there's `asyncfutures.all()` if that's what you need |
06:53:57 | FromDiscord | <Elegantbeef> Yea that'd work for the batch method |
06:55:08 | FromDiscord | <Elegantbeef> The downside of batching is it waits until the longest async is done, so if you have like 7 10kb files and 1 1gb file you have to wait until the 1gb is done |
06:57:15 | FromDiscord | <Rika> There’s no fix to that, if you need all then you need all? |
06:57:22 | FromDiscord | <Rika> If you don’t need all then ??? |
06:57:36 | FromDiscord | <Rika> You’ll have to know beforehand what you need for what part |
06:57:39 | FromDiscord | <Rika> That gets messy |
06:57:58 | FromDiscord | <Rika> There’s no reason to batch if you need all, and you’re gonna have to manually determine batches if you need some |
06:57:59 | FromDiscord | <Elegantbeef> eh you just make a buffer of them and iterate over it every so often in a sleeping loop |
06:58:08 | * | Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected]) |
06:58:13 | FromDiscord | <Elegantbeef> batches are the `all` method |
06:58:16 | FromDiscord | <Elegantbeef> you do 8 at a time |
06:58:26 | FromDiscord | <Elegantbeef> when those 8 are done you move to the next 8 |
06:58:29 | FromDiscord | <Rika> Yes and so what if I do 8 at a time if I need them all |
06:58:32 | * | Gustavo6046 joined #nim |
06:58:41 | FromDiscord | <Elegantbeef> Say you have 10 files |
06:58:48 | FromDiscord | <Rika> Yes so what’s the difference between doing eight at a time and doing all at the same time |
06:59:01 | FromDiscord | <Elegantbeef> you download 8 and before you can download the remaining 2 files you have to wait for the 1gb file to finish |
06:59:03 | FromDiscord | <Rika> You do all ten files one is massive, your bottleneck is only the massive file |
06:59:24 | FromDiscord | <Elegantbeef> Oh you're saying batch them all together |
06:59:26 | FromDiscord | <Rika> You do 8 at a time and the massive one is last, your bottleneck is the longest small file AND the massive file |
06:59:34 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=3Vcr |
06:59:46 | FromDiscord | <Elegantbeef> `dref[]` is dereferencing a nil |
06:59:53 | FromDiscord | <Elegantbeef> `var dref = new int64` |
07:00:02 | FromDiscord | <morgan> ooooh ok |
07:00:25 | FromDiscord | <morgan> i was trying to put it all in one but it for some reason didn't like it |
07:00:27 | FromDiscord | <huantian> I don’t know if batching all 1000+ future will work |
07:00:30 | FromDiscord | <morgan> ill try with new |
07:00:53 | FromDiscord | <Elegantbeef> Yea huan that's what i'm talking about, that's when you're really harming transfer speeds and file descriptors |
07:00:57 | * | Gustavo6046 quit (Remote host closed the connection) |
07:01:06 | FromDiscord | <morgan> ok yea that works |
07:01:10 | FromDiscord | <Elegantbeef> with a batch of like 8 you're atleast only dividing you max throughput by like 8 |
07:04:08 | FromDiscord | <huantian> I mean an 8x improvement in download speed is non negligible |
07:04:19 | FromDiscord | <Rika> If it’s a thousand then yes batching is better |
07:04:24 | FromDiscord | <Rika> I mean |
07:04:26 | FromDiscord | <Rika> Smaller batches |
07:06:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vcs |
07:06:41 | FromDiscord | <Elegantbeef> I havent ran it so no clue if it works |
07:07:02 | FromDiscord | <Rika> This looks awful |
07:07:03 | FromDiscord | <Rika> Lmao |
07:07:22 | FromDiscord | <Rika> Doesn’t futures also have an any proc |
07:08:16 | FromDiscord | <Elegantbeef> Not that i can see |
07:24:13 | * | kenran joined #nim |
07:24:22 | * | kenran quit (Client Quit) |
07:27:00 | FromDiscord | <hmmm> broskis! gud firday to u all! Stupid question, if I have a recursive function, hmmm how many times can it calls itself before running out of stacks? |
07:27:28 | FromDiscord | <Elegantbeef> There is no set size depends on the function and your stack size |
07:27:36 | FromDiscord | <hmmm> hmmm |
07:27:40 | FromDiscord | <hmmm> how can I check? |
07:28:00 | FromDiscord | <Elegantbeef> If that's an actual issue perhaps dont do it recursively but instead do it iteratively |
07:29:33 | FromDiscord | <hmmm> yea I must try to turn it into a while proc but my cute function of 5 lines turns into a 30 lines monster lol so I wanted to know if it's really necessary |
07:29:56 | FromDiscord | <Elegantbeef> Your program is also probably faster due to lacking TCO |
07:30:04 | FromDiscord | <hmmm> wot is TCO |
07:30:18 | FromDiscord | <Elegantbeef> tail call optimization |
07:30:52 | FromDiscord | <Elegantbeef> It's an optimization for recursive calls |
07:30:54 | FromDiscord | <Elegantbeef> What's the code you have |
07:32:39 | FromDiscord | <hmmm> its something that traverses my weird tree. The recursive function checks if a node has children and if it has call itself again on the children. To make it work on a while I was trying to simulate a stack that tracks nodes with children but hmmm it's been messy so far |
07:33:44 | FromDiscord | <Elegantbeef> Ah tree traversal is one of the few things that's easier to reason recursively |
07:33:49 | FromDiscord | <hmmm> yea! |
07:34:10 | FromDiscord | <hmmm> all the recursive functions were very easy and natural to write and now I'm struggling lol |
07:35:10 | FromDiscord | <Elegantbeef> So what's the function do |
07:36:21 | FromDiscord | <hmmm> oh I started with the easiest one, headCount, it will simply count the number of nodes and children and output to total number |
07:44:23 | FromDiscord | <hmmm> the tree is made that every node can have from 0 to infinite children and so on, hmmm like a filesystem |
07:49:04 | FromDiscord | <Rika> How deep does it go |
07:49:21 | FromDiscord | <Rika> You can rest assured a few hundred in depth is fine, start worrying when you hit a thousand |
07:51:21 | FromDiscord | <hmmm> hmm for all purposes it should be fine, but I wanted to see if it was easy to turn the procs into iterative. So far it has been messy lol but it should be doable. They should also run faster I think |
07:52:13 | * | ehmry quit (Ping timeout: 256 seconds) |
07:52:32 | FromDiscord | <Rika> It’s usually done by just making a manual stack really |
07:53:40 | FromDiscord | <hmmm> yea I'm trying, I'm hitting all sorts of counter related roadblocks lol |
07:53:53 | FromDiscord | <hmmm> turns out I'm not very good at counting! |
07:57:10 | * | ehmry joined #nim |
08:07:11 | FromDiscord | <Rika> I’m sure beef can relate |
08:08:21 | FromDiscord | <Elegantbeef> Hey i can count to as high as i have fingers 12 is pretty high! |
08:17:23 | FromDiscord | <Rika> That’s cool, you have a twelve fingered hand |
08:32:53 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3VcB |
08:33:48 | FromDiscord | <hmmm> this ugly monster is the iterative version of three line of cute recursive proc 😦 |
08:34:50 | FromDiscord | <hmmm> I heard functional programming is all about cute recursive procs, maybe I should try 🤔 |
08:56:58 | FromDiscord | <planetis> Now on hacker news, RamanLabs deep learning written in Nim |
08:58:04 | FromDiscord | <Rika> Cool |
08:58:16 | FromDiscord | <Rika> Did we ever hear of someone doing that here in this chat |
09:00:45 | FromDiscord | <planetis> No idea, can't find anything |
09:01:12 | FromDiscord | <planetis> Maybe Nim science folks know better |
09:18:41 | FromDiscord | <hugogranstrom> Not heard of it \:o Is it the article with id 31030867? |
09:25:10 | FromDiscord | <hugogranstrom> Here's their website and their blog has a post about Python interop https://ramanlabs.in/ |
09:26:07 | FromDiscord | <hugogranstrom> But they seem to be selling it as a product so we won't probably see the actual Nim code sadly |
09:34:20 | FromDiscord | <jmgomez> In reply to @Elegantbeef "Dont know if Nim": FYI got a reply on the forums saying that stack: var FFrame did conver it to FFfame& |
09:35:07 | * | jmdaemon quit (Ping timeout: 240 seconds) |
09:41:57 | * | Guest14 joined #nim |
09:43:24 | * | Guest14 quit (Client Quit) |
09:50:15 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3VcL |
10:05:11 | * | zeus-supreme1 joined #nim |
10:08:13 | * | zeus-supreme quit (Ping timeout: 256 seconds) |
12:49:32 | * | slowButPresent joined #nim |
12:55:46 | * | wyrd quit (Remote host closed the connection) |
12:56:05 | * | wyrd joined #nim |
12:56:17 | * | noeontheend joined #nim |
13:02:29 | * | arkurious joined #nim |
13:03:04 | * | noeontheend quit (Read error: Connection reset by peer) |
13:03:17 | * | noeontheend joined #nim |
14:35:24 | * | noeontheend quit (Ping timeout: 250 seconds) |
14:44:06 | * | xet7 quit (Remote host closed the connection) |
14:45:22 | * | xet7 joined #nim |
14:55:24 | FromDiscord | <sOkam!> Do you guys know of any bash to nimscript converter? |
14:58:57 | FromDiscord | <Yardanico> In reply to @jmgomez "cant I call emit": yes |
14:59:07 | FromDiscord | <Yardanico> but you have to backquote Nim identifiers that you want to use in the C code |
14:59:39 | FromDiscord | <Yardanico> or the newer method is to use array |
14:59:51 | * | noeontheend joined #nim |
15:00:36 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/3r4 |
15:09:52 | * | vicecea joined #nim |
15:11:20 | vicecea | Hi, is there an anlogue to c-style opening up a new "body/scope", i.e. `{ stmt... }`? Thanks for any pointers. |
15:12:05 | FromDiscord | <Yardanico> yes, `block` |
15:12:24 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#statements-and-expressions-block-statement |
15:12:47 | FromDiscord | <Yardanico> you can have named/unnamed blocks, and you can break out of named blocks |
15:13:02 | vicecea | Yardanico_: thanks! that looks perfect |
15:13:12 | FromDiscord | <Yardanico> well, you can break from unnamed blocks too |
15:14:11 | FromDiscord | <leorize> it's not possible, unfortunately. nimscript lacks many of bash's features↵(@sOkam!) |
15:15:34 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "https://github.com/nim-lang/dialogs btw": i dont see any example on how to use them↵and they ask for `PWindow` which is `pointer`↵and it doesn't work with a gintro window |
15:15:56 | FromDiscord | <System64 ~ Flandre Scarlet> Hi, how can I write a byte into a file please? I tried ``stdout.write(((data.audioData[i0]).char))`` but it crashes due to overflow |
15:16:10 | FromDiscord | <sOkam!> In reply to @leorize "it's not possible, unfortunately.": Just found `Vindaar/shell`. Not quite what I was thinking, but close enough I guess 🤔 |
15:18:03 | * | pro joined #nim |
15:42:52 | FromDiscord | <dom96> In reply to @System64 "Hi, how can I": `s/char/byte/` possibly |
15:56:22 | nrds | <Prestige99> @dom96 can you take a look at https://github.com/nim-lang/irc/pull/25 if you're able to review and/or merge on that repo? |
15:59:43 | FromDiscord | <Yardanico> NimBot123 :D |
16:00:16 | FromDiscord | <Rika> Yeah I thought that was extraneous |
16:01:44 | nrds | <Prestige99> Probably left over from debugging I imagine |
16:09:25 | * | Gustavo6046 joined #nim |
16:10:33 | * | Gustavo6046 quit (Max SendQ exceeded) |
16:11:18 | * | Gustavo6046 joined #nim |
16:12:15 | * | toulene joined #nim |
16:34:17 | * | jmdaemon joined #nim |
16:35:27 | * | zeus-supreme joined #nim |
16:38:16 | * | zeus-supreme1 quit (Ping timeout: 248 seconds) |
16:46:56 | FromDiscord | <dom96> reviewed & merged |
16:47:06 | FromDiscord | <dom96> check out my comment 🙂 |
16:47:16 | FromDiscord | <dom96> and thanks for the PR! |
16:52:25 | * | pro quit (Quit: pro) |
16:53:23 | * | jmd_ joined #nim |
16:53:27 | * | jmdaemon quit (Ping timeout: 240 seconds) |
17:05:46 | * | jmd_ quit (Ping timeout: 250 seconds) |
17:07:13 | * | rockcavera joined #nim |
17:07:13 | * | rockcavera quit (Changing host) |
17:07:13 | * | rockcavera joined #nim |
17:08:04 | * | jmdaemon joined #nim |
17:12:09 | * | vicfred joined #nim |
17:15:06 | nrds | <Prestige99> DarthOreo: ^^ thanks :) |
17:19:09 | nrds | <DarthOreo99> dom96 thanks! |
17:19:23 | nrds | <DarthOreo99> my first forray into nim was that :D |
17:25:13 | * | jmdaemon quit (Ping timeout: 248 seconds) |
17:25:54 | * | jmdaemon joined #nim |
17:38:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @dom96 "`s/char/byte/` possibly": Char doesn't work |
17:41:47 | FromDiscord | <dom96> you mean `byte`? |
17:50:37 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3Vey |
18:03:16 | FromDiscord | <Rika> Callbacks boo |
18:03:53 | FromDiscord | <Rika> I might look into it later/tomorrow |
18:04:00 | FromDiscord | <demotomohiro> @System64 ~ Flandre Scarlet This proc might work for your case: https://nim-lang.org/docs/io.html#writeBuffer%2CFile%2Cpointer%2CNatural |
18:04:17 | FromDiscord | <d4rckh> How can I load a .cer file into my httpclient? I think it's called CA root certificate |
18:12:34 | FromDiscord | <Yardanico> In reply to @d4rckh "How can I load": https://nim-lang.org/docs/net.html#newContext%2Cstring%2Cstring%2Cstring%2Cstring certFile |
18:12:46 | FromDiscord | <Yardanico> but if you just need to disable cert validation you can just set verifyMode=CVerifyNone |
18:13:08 | FromDiscord | <Yardanico> and then you pass that context as sslContext to newHttpClient/newAsyncHttpClient |
18:13:09 | FromDiscord | <Yardanico> https://nim-lang.org/docs/httpclient.html#sslslashtls-support |
18:13:47 | FromDiscord | <d4rckh> thanks! |
18:14:05 | FromDiscord | <639cdc5b65704dd36a425e849bd59ca3> Are NimSkull windows binaries avaliable?↵https://github.com/nim-works/nimskull |
18:18:30 | FromDiscord | <huantian> In reply to @Rika "Callbacks boo": a fun side effect is that SIGINTing it doesn't stop the callbacks, apparently |
18:23:19 | FromDiscord | <huantian> though I guess that's just an async thing? |
18:25:12 | FromDiscord | <huantian> nope nevermind that was a vscode jank thing |
18:26:11 | FromDiscord | <!Patitotective> is there a way to set a default kind for variant objects? the thing is that if you dont give it a kind it raises an `Illegal storage access` error which is not so-descriptive |
18:26:16 | FromDiscord | <!Patitotective> (edit) "so-descriptive" => "so-descriptive↵https://play.nim-lang.org/#ix=3VeP" |
18:27:41 | FromDiscord | <enthus1ast> @!Patitotective\: no the reason is that its just a ref |
18:27:48 | FromDiscord | <enthus1ast> not initialized |
18:28:32 | * | noeontheend quit (Ping timeout: 250 seconds) |
18:28:43 | FromDiscord | <enthus1ast> var variant = Variant(kind\: Vint) |
18:28:45 | FromDiscord | <!Patitotective> and how do i auto initialize it? or just raise a better error |
18:29:54 | FromDiscord | <enthus1ast> do this\:↵var variant = Variant(kind\: Vint) |
18:30:53 | FromDiscord | <enthus1ast> VInt i mean |
18:30:59 | FromDiscord | <enthus1ast> or VFloat etc... |
18:31:07 | FromDiscord | <!Patitotective> yea but what if some object has a field of type `Variant` and i accidentally forget to initialize it |
18:32:05 | FromDiscord | <enthus1ast> well, create newYourstuff procs that do this for you |
18:32:21 | FromDiscord | <enthus1ast> and always call these |
18:32:34 | FromDiscord | <!Patitotective> well thanks 🙃 |
18:37:53 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3VeS |
18:39:36 | FromDiscord | <d4rckh> (edit) "https://play.nim-lang.org/#ix=3VeS" => "https://play.nim-lang.org/#ix=3VeT" |
18:52:48 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "<@380360389377916939> This proc might": Ah thanks, will try this |
19:04:32 | * | rockcavera quit (Remote host closed the connection) |
19:10:28 | NimEventer | New thread by Jwatson-CO-edu: Confusion about proc forward declarations, see https://forum.nim-lang.org/t/9109 |
19:56:03 | vicecea | Hi, given that I have a `type FooSeq = seq[uint]` and I have `var fs: FooSeq` - is there a shortcut like `new(fs)` I can use to initialize a `newSeq` without specifying the type of `FooSeq` again? |
19:57:49 | * | Gustavo6046 quit (Remote host closed the connection) |
19:58:20 | * | Gustavo6046 joined #nim |
20:01:46 | * | rockcavera joined #nim |
20:01:46 | * | rockcavera quit (Changing host) |
20:01:46 | * | rockcavera joined #nim |
20:01:53 | FromDiscord | <Yardanico> just call `newSeq` on `fs` itself |
20:01:57 | FromDiscord | <Yardanico> https://nim-lang.org/docs/system.html#newSeq%2Cseq%5BT%5D%2CNatural |
20:02:09 | FromDiscord | <Yardanico> `fs.newSeq()` |
20:02:20 | FromDiscord | <Yardanico> but again, you only need newSeq if you want to preallocate some len |
20:03:34 | vicecea | Yardanico_: ah thanks, I thought I needed to initialize myself or else it would be `nil`, I can see I was wrong, thanks! |
20:04:04 | FromDiscord | <Yardanico> that was the case a looot of nim versions ago |
20:04:11 | FromDiscord | <Yardanico> but nowadays strings and seqs are preinitialized |
20:08:33 | * | kenran joined #nim |
21:02:12 | FromDiscord | <slymilano> Happy weekend everybody - Nim is such a lovely language. I am going to find a way to use it in my startups tech stack. |
21:15:57 | * | kenran quit (Quit: WeeChat info:version) |
21:30:37 | FromDiscord | <ratapenado> Hi, I have a stupid question: why is there a countup and countdown and not a simple count that works both way ? It would make things slower ? |
21:30:58 | FromDiscord | <Elegantbeef> Yes |
21:31:04 | FromDiscord | <Elegantbeef> Also `for x in 0..10` exists for count up |
21:31:34 | FromDiscord | <Elegantbeef> you can also make your own count iterator |
21:34:07 | FromDiscord | <demotomohiro> I think most of people dont use count that can go both way. |
21:35:37 | FromDiscord | <ratapenado> In reply to @Elegantbeef "Yes": Thanks |
21:36:03 | FromDiscord | <ElegantBeef> Damn bridge dieded |
21:36:06 | FromDiscord | <Elegantbeef> whoops |
21:36:06 | FromDiscord | <Elegantbeef> that should be `iterator` not `iterate` |
21:36:06 | FromDiscord | <Elegantbeef> Think the argument is "Count up is vastly more common and it's not worth slowing down the iterator for the odd cases it's not" |
21:36:07 | FromDiscord | <Elegantbeef> depending on what you're doing you also can just do `for x in min(a, b)..max(a, b)` |
21:36:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vft |
21:36:10 | FromDiscord | <ElegantBeef> There we go |
21:36:15 | FromDiscord | <ElegantBeef> Dumb bridge is dumb |
21:36:33 | FromDiscord | <huantian> you could also have something like python's range, where you have to specify the step to be negative to count down |
21:41:01 | FromDiscord | <ElegantBeef> Also huan what's the async download you ended up going with? |
21:41:36 | FromDiscord | <ElegantBeef> Just scrolled up and found where you mentioned me, but i apparently didnt get notified on matrix |
21:44:46 | FromDiscord | <huantian> yeah I modified it to just store the index of the current url instead of popping from the seq |
21:45:10 | FromDiscord | <ElegantBeef> Wonder if https://play.nim-lang.org/#ix=3Vfx works any(yes still kinda dumb) |
21:52:30 | FromDiscord | <Zoom> You're welcome!↵(@huantian) |
21:52:44 | FromDiscord | <huantian> yeah thanks for the tip! |
22:16:52 | * | tiorock joined #nim |
22:16:52 | * | tiorock quit (Changing host) |
22:16:52 | * | tiorock joined #nim |
22:16:52 | * | rockcavera is now known as Guest7389 |
22:16:52 | * | tiorock is now known as rockcavera |
22:17:52 | NimEventer | New post on r/nim by JellyFish_AZ: Create arrays in Python-ish style, see https://reddit.com/r/nim/comments/u4j9y0/create_arrays_in_pythonish_style/ |
22:19:36 | * | Guest7389 quit (Ping timeout: 248 seconds) |
22:25:07 | NimEventer | New question by pooooky: `when` does not work as expected in Nim lang, see https://stackoverflow.com/questions/71889476/when-does-not-work-as-expected-in-nim-lang |
22:36:39 | FromDiscord | <Elegantbeef> By the way @morgan i realized what you were doing with the macro and why not just use a converter https://play.nim-lang.org/#ix=3VfK |
22:38:24 | FromDiscord | <morgan> oh use a converter to create the full variant type? |
22:38:41 | FromDiscord | <Elegantbeef> Look at my code |
22:38:50 | FromDiscord | <Elegantbeef> I take in tuples and emit the flags |
22:39:05 | FromDiscord | <Elegantbeef> I of course dont use a complex variant cause there isnt any reason to imo |
22:40:11 | FromDiscord | <morgan> oh i could use a generic proc to get the different type versions |
22:40:48 | FromDiscord | <Elegantbeef> Yep |
22:40:59 | FromDiscord | <Elegantbeef> The code i provided is vastly less complex than what you presently have afaict |
22:41:32 | FromDiscord | <morgan> i’ll look at it more in depth later when i’m back at my computer, thanks |
22:58:52 | FromDiscord | <Ayy Lmao> Is there a way to call cleanup code when a reference is no longer held by anything? |
23:04:52 | * | zeus-supreme1 joined #nim |
23:07:40 | * | zeus-supreme quit (Ping timeout: 246 seconds) |
23:20:39 | FromDiscord | <Elegantbeef> There are desructors/finalizers but i dont know if those are what you want |
23:21:29 | FromDiscord | <Ayy Lmao> In reply to @Elegantbeef "There are desructors/finalizers but": From the small amount of testing I did, I couldn't get destructors to be called with references. Maybe I did something wrong though. |
23:21:52 | FromDiscord | <Elegantbeef> You need to make a normal object with a destructor and do `MyRefType = ref Base` |
23:22:13 | FromDiscord | <Elegantbeef> Finalizers also can be used `new(MyRefType, myFinalizer)` |
23:25:31 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3VfV |
23:26:00 | FromDiscord | <Ayy Lmao> This doesn't seem to print `Test destroyed.` for me |
23:26:09 | FromDiscord | <Elegantbeef> `--mm:orc`? |
23:26:22 | FromDiscord | <Elegantbeef> Destructors only work predicitibly with `orc`/`arc` |
23:26:48 | FromDiscord | <Elegantbeef> Works fine |
23:26:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3VfW |
23:27:01 | FromDiscord | <Elegantbeef> works fine with refc\ |
23:27:44 | FromDiscord | <Ayy Lmao> So you can't count on a destructor being called with a ref unless you are using orc or arc? |
23:27:53 | FromDiscord | <Elegantbeef> No you can |
23:28:12 | FromDiscord | <Elegantbeef> It's just that Nim's GC doesnt collect before the program exits so it doesnt seem to work |
23:28:25 | FromDiscord | <Ayy Lmao> Ah, I figured that might be the problem. |
23:29:32 | FromDiscord | <Elegantbeef> In a proper program it'll be proper, the only thing is they're not deterministic |
23:29:43 | FromDiscord | <Ayy Lmao> I guess I'm kind of confused if it is idiomatic in Nim to wrap cleanup code for a c lib in a destructor, or to expect the user to call the code manually. |
23:30:01 | FromDiscord | <Elegantbeef> Destructor |
23:32:40 | FromDiscord | <Ayy Lmao> In reply to @Elegantbeef "Destructor": Thanks for the help! |
23:53:23 | NimEventer | New question by pooooky: how to pass +, -, etc. to macro in Nim, see https://stackoverflow.com/questions/71889937/how-to-pass-etc-to-macro-in-nim |