<< 15-04-2022 >>

00:15:21NimEventerNew 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:25NimEventerNew 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:06FromDiscord<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:54FromDiscord<Yardanico> No, you were actually able to check them, but apparently as beef said it's broken now
01:02:16FromDiscord<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:20FromDiscord<Alea> do you just update a package by doing nimble install? or do you need to uninstall the existing one first?
01:14:52FromDiscord<Elegantbeef> You can have multiple versions installed concurrently
01:15:29FromDiscord<Alea> is there a command to update the existing install?
01:16:18FromDiscord<Elegantbeef> nope
01:16:48FromDiscord<Alea> :BwaahSnap:
01:16:55FromDiscord<Alea> this seems like an odd thing to be missing
01:17:10FromDiscord<Elegantbeef> You dont generally need to update all your packages
01:17:20FromDiscord<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:51FromDiscord<Elegantbeef> Just install it again it'll fetch the recent one then move your min version
01:19:11FromDiscord<TryAngle> what does↵`new result`↵do?
01:19:16FromDiscord<TryAngle> or what does new do in general?
01:19:21FromDiscord<TryAngle> (edit) "or what does new ... do" added "keyword"
01:19:22FromDiscord<Alea> treeform hasn't made a new boxy release :BwaahSnap:
01:19:26FromDiscord<Elegantbeef> New heap allocates the value
01:19:40FromDiscord<Elegantbeef> `new int` allocates a `ref int` and 0's it
01:19:42FromDiscord<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:10FromDiscord<Elegantbeef> The built in thread pool?
01:20:14FromDiscord<TryAngle> ah I see, pretty cool↵thanks 🥩 🥺
01:22:52FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Zne
01:23:09FromDiscord<ajusa> oh just poll on the result, not sure why I didn't think of that
01:23:34FromDiscord<ajusa> thanks for the elegant response as always
01:26:22FromDiscord<ajusa> sent a code paste, see https://paste.rs/Tba
01:26:44FromDiscord<Elegantbeef> Yea if you make a template you can make it 100% generic
01:27:04FromDiscord<Elegantbeef> `p: proc): auto`
01:27:11FromDiscord<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:46FromDiscord<Alea> I assume that's because my stuff isn't on the package list right?
01:28:58FromDiscord<Alea> ah, got it?
01:36:06FromDiscord<!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:21FromDiscord<Elegantbeef> You arent linking the library afaik
01:37:40FromDiscord<Elegantbeef> https://github.com/nim-lang/dialogs btw
01:38:58FromDiscord<!Patitotective> In reply to @Elegantbeef "You arent linking the": l-linking? 😕↵haven't you wrote an article...? lol
01:39:22FromDiscord<Elegantbeef> Nah i dont touch the C compiler that's for nerds
01:39:38FromDiscord<!Patitotective> :[
01:39:50FromDiscord<Elegantbeef> https://github.com/mlabbe/nativefiledialog#compiling-your-programs
01:40:01FromDiscord<Elegantbeef> It's the same as for C
01:41:05FromDiscord<!Patitotective> but how do i get that `nfd.lib`? i have done `make` but it ouputs binarys not libs
01:42:05FromDiscord<Elegantbeef> > nfd.a will be built for release builds, and nfd\_d.a will be built for debug builds.\`
01:43:30FromDiscord<Elegantbeef> There should be a `build/lib`
01:44:11FromDiscord<!Patitotective> oh there is `libnfd.a` :D↵now i put that library next to my script?
01:44:23FromDiscord<Elegantbeef> No it's a static library
01:44:25FromDiscord<Elegantbeef> You link it
01:44:56FromDiscord<!Patitotective> what does _link_ means?
01:45:10FromDiscord<!Patitotective> like linux symlinks or?
01:45:39FromDiscord<Elegantbeef> Do yourself a favour and type in your favourite search engine "How to link a static library C"
01:49:53FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3VbO
01:50:28FromDiscord<Elegantbeef> `-static -lnfd`
01:52:53FromDiscord<demotomohiro> I think you need to link gtk related libraries.
01:53:04FromDiscord<loaf> do any of you have experience using emscripten
01:53:42FromDiscord<demotomohiro> Probably libnfd.a depends other libraries and you need to link them.
01:55:13FromDiscord<demotomohiro> I used emscripten long time ago.
01:56:00FromDiscord<loaf> isnt there a way to automatically generate the structural html/js?
01:59:25FromDiscord<demotomohiro> If I remember collectly, I just used html file copied from somewhere when I used emscripten.
01:59:37FromDiscord<loaf> oh
01:59:50FromDiscord<loaf> because im just going by this
01:59:52FromDiscord<loaf> https://github.com/treeform/nim_emscripten_tutorial
02:00:19FromDiscord<loaf> sent a code paste, see https://paste.rs/EOP
02:04:57FromDiscord<demotomohiro> That `switch` is a nimscript proc that adds Nim compiler option. ↵`passL` pass specified arguments to backend compiler when linking.
02:06:39FromDiscord<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:39FromDiscord<demotomohiro> Probably you need to get shell_minimal.html from emscripten's documents or write it manually.
02:09:28FromDiscord<loaf> sent a code paste, see https://play.nim-lang.org/#ix=3VbQ
02:11:30FromDiscord<loaf> i just dont know how nimscript procs work tbh
02:12:10FromDiscord<demotomohiro> switch("passL", "-o xxx") works like nim c --passL:"-o xxx" file.nim
02:12:18FromDiscord<loaf> oh ok
02:14:11*noeontheend joined #nim
02:15:16FromDiscord<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:37FromDiscord<loaf> yeah it did
02:15:53FromDiscord<loaf> i was just wondering for my own project tbh
02:17:48FromDiscord<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:34FromDiscord<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:14FromDiscord<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:28FromDiscord<morgan> in a macro, how do i get the value of a char nimnode?
02:30:43FromDiscord<morgan> i've tried strVal(), chr(intVal())
02:30:54FromDiscord<morgan> neither work
02:31:08FromDiscord<Elegantbeef> `.intval`
02:31:09FromDiscord<Elegantbeef> No clue dont think it should↵(@Anuke)
02:32:37FromDiscord<Elegantbeef> Works fine
02:32:38FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/7CR
02:32:48FromDiscord<Anuke> <https://github.com/nim-lang/Nim/issues/8275> ancient bug it seems
02:33:45*arkurious quit (Quit: Leaving)
02:33:49FromDiscord<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:20FromDiscord<Elegantbeef> are you sure it's a `nnkCharLit`?
02:34:40FromDiscord<Elegantbeef> Not working is better with an error and example
02:35:15FromDiscord<morgan> im printing out what is coming in and using the type from getType(input).repr to case stuff
02:35:19FromDiscord<morgan> and it's a char
02:35:36FromDiscord<morgan> how do i print out its type?
02:35:56FromDiscord<Elegantbeef> `.kind`?
02:36:26FromDiscord<morgan> oh it's empty
02:36:41FromDiscord<morgan> i wonder if i need to shift every index up one
02:37:56FromDiscord<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:21FromDiscord<loaf> so im trying to make a wasm gui
02:59:17FromDiscord<loaf> and idk what library to use anymore
03:06:39FromDiscord<ynfle> HTML?
03:08:29FromDiscord<Rika> id prolly assume hes using a canvas for drawing
03:08:38FromDiscord<Rika> though then its still a pian
03:08:40FromDiscord<Rika> (edit) "pian" => "pain"
03:14:00FromDiscord<loaf> i was going to use https://github.com/yglukhov/nimx
03:14:13FromDiscord<loaf> but it doesnt seem like the wasm nake flag works anymore
03:16:29FromDiscord<demotomohiro> I duckduckgo "imgui wasm" and i
03:17:01FromDiscord<demotomohiro> there are projects that use imgui on wasm
03:19:22FromDiscord<!Patitotective> duckduckwent?
03:19:35FromDiscord<Elegantbeef> ddg'd
03:22:55FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#ix=3Vc5
03:23:02FromDiscord<morgan> oops sent early
03:23:05FromDiscord<morgan> (edit) "https://play.nim-lang.org/#ix=3Vc5" => "https://play.nim-lang.org/#ix=3Vc6"
03:23:30FromDiscord<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:04FromDiscord<Rika> what is "f";s type
03:25:19FromDiscord<morgan> untyped but it's a tree of NimNodes
03:25:22FromDiscord<morgan> this is in a macro
03:25:32FromDiscord<morgan> https://nim-lang.org/docs/macros.html#bindSym%2C%2CBindSymRule
03:25:54FromDiscord<Elegantbeef> Cause `bindsym` takes a `static string`
03:26:21FromDiscord<morgan> it says it can take a NimNode
03:26:28FromDiscord<Elegantbeef> There is 0 point in bindsym here
03:26:35FromDiscord<morgan> ok
03:26:39FromDiscord<Elegantbeef> `if ident is a NimNode, it must have nnkIdent kind. `
03:27:02FromDiscord<morgan> sent a code paste, see https://paste.rs/s9H
03:27:27FromDiscord<Elegantbeef> What is your macro doing?
03:28:22FromDiscord<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:38FromDiscord<Elegantbeef> Ok so yea no reason to bind sym
03:28:58FromDiscord<morgan> i was trying to get more info about the Idents so i can know what they do
03:29:05FromDiscord<Elegantbeef> Well make it `typed`
03:29:17FromDiscord<morgan> that didn't work
03:29:49FromDiscord<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:42FromDiscord<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:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vc7
03:31:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vc8
03:31:50FromDiscord<morgan> i get literally the same error
03:32:00FromDiscord<morgan> wait
03:32:02FromDiscord<morgan> nvm
03:32:03FromDiscord<Elegantbeef> I just showed code that compiles
03:32:30FromDiscord<morgan> i had them in brackets
03:32:39FromDiscord<morgan> so it was getting passed in as one thing
03:32:52FromDiscord<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:02FromDiscord<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:05FromDiscord<!Patitotective> 🌃
04:59:27*rockcavera quit (Ping timeout: 240 seconds)
05:06:08FromDiscord<creikey> Beef do you have a good explanation for what tlsEmulation:off is for in nim 1.6.4?
05:06:38FromDiscord<Elegantbeef> thread local storage emulation
05:10:08FromDiscord<creikey> In reply to @Elegantbeef "thread local storage emulation": just read the wiki for thread local storage
05:10:19FromDiscord<creikey> why would it need to be "emulated"? You get thread local storage through winapi on windows right
05:12:12FromDiscord<Elegantbeef> I do not know
05:12:25FromDiscord<Elegantbeef> Think it's mainly for Mingw/pthread
05:37:41FromDiscord<Rika> TFW I always thought how “TLS” as in the protocol was emulated lol
05:38:15FromDiscord<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:03FromDiscord<leorize> that's emulation↵(@creikey)
05:50:51FromDiscord<leorize> "native" TLS is where the OS supports the allocation and declaration of these objects statically, so to speak
05:51:20FromDiscord<leorize> in Nim however it's just whether the C compiler supports `_Thread` or `thread_local`
05:54:19FromDiscord<Sabena Sema> its easy to add static constructors and destructors of your own
05:54:49FromDiscord<Sabena Sema> you can use flsalloc, but also one of the .crt$ sections is constructors and one destructors
06:05:45FromDiscord<OceanMongrel> can i just say not having to use brackets for function calls is making me quite happy
06:06:26FromDiscord<Elegantbeef> I think you can say that
06:07:30FromDiscord<OceanMongrel> ok thanks
06:12:10FromDiscord<Elegantbeef> Jokes aside yea it's quite lovely
06:12:23NimEventerNew thread by Huantian: Concurrent File Download with Async, see https://forum.nim-lang.org/t/9108
06:12:32FromDiscord<huantian> finally doing threading
06:12:52FromDiscord<huantian> weird that the bridge capitalizes usernames
06:13:54FromDiscord<Elegantbeef> Does `downloadFile` not work for you?
06:14:33FromDiscord<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:53FromDiscord<Elegantbeef> Think a seq + callbacks is the way
06:17:48FromDiscord<huantian> yeah I might just do that tbh
06:18:21FromDiscord<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:11FromDiscord<morgan> well i commented out the code i was just working on and it still happens soooooo
06:19:48FromDiscord<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:42FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/bM8
06:22:45FromDiscord<Elegantbeef> Might not be proper
06:24:47FromDiscord<Elegantbeef> Might need a full collection instead
06:24:53FromDiscord<huantian> hm I think I'll have to make multiple async http clients as well
06:25:44FromDiscord<Elegantbeef> Perhaps, also think this wont work due to the blocking `waitfor`
06:25:56FromDiscord<huantian> sent a code paste, see https://paste.rs/HYe
06:25:58FromDiscord<Elegantbeef> Think it needs a blocking busy room
06:27:22FromDiscord<Elegantbeef> I pretend to known everything i know about async, so yea good luck
06:28:45FromDiscord<huantian> Hey at least I have your elegant moral support heh
06:30:31FromDiscord<Elegantbeef> Hey that's like having newspaper whilst in a porta-potty
06:30:40FromDiscord<Elegantbeef> having newspaper and no toiler paper\
06:31:13FromDiscord<Elegantbeef> Ways to ruin jokes for $400 please alex
06:50:50FromDiscord<Rika> Put all futures into a sequence and await that?
06:51:19FromDiscord<Rika> I just skimmed through the question
06:51:21FromDiscord<Rika> BRB
06:51:23FromDiscord<Elegantbeef> Yea batches are easy
06:52:21FromDiscord<Elegantbeef> The ideal thing is something like my suggestion but without the waitfor but a sleeping while loop
06:52:43FromDiscord<Elegantbeef> Atleast i think
06:53:18FromDiscord<leorize> there's `asyncfutures.all()` if that's what you need
06:53:57FromDiscord<Elegantbeef> Yea that'd work for the batch method
06:55:08FromDiscord<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:15FromDiscord<Rika> There’s no fix to that, if you need all then you need all?
06:57:22FromDiscord<Rika> If you don’t need all then ???
06:57:36FromDiscord<Rika> You’ll have to know beforehand what you need for what part
06:57:39FromDiscord<Rika> That gets messy
06:57:58FromDiscord<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:59FromDiscord<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:13FromDiscord<Elegantbeef> batches are the `all` method
06:58:16FromDiscord<Elegantbeef> you do 8 at a time
06:58:26FromDiscord<Elegantbeef> when those 8 are done you move to the next 8
06:58:29FromDiscord<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:41FromDiscord<Elegantbeef> Say you have 10 files
06:58:48FromDiscord<Rika> Yes so what’s the difference between doing eight at a time and doing all at the same time
06:59:01FromDiscord<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:03FromDiscord<Rika> You do all ten files one is massive, your bottleneck is only the massive file
06:59:24FromDiscord<Elegantbeef> Oh you're saying batch them all together
06:59:26FromDiscord<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:34FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#ix=3Vcr
06:59:46FromDiscord<Elegantbeef> `dref[]` is dereferencing a nil
06:59:53FromDiscord<Elegantbeef> `var dref = new int64`
07:00:02FromDiscord<morgan> ooooh ok
07:00:25FromDiscord<morgan> i was trying to put it all in one but it for some reason didn't like it
07:00:27FromDiscord<huantian> I don’t know if batching all 1000+ future will work
07:00:30FromDiscord<morgan> ill try with new
07:00:53FromDiscord<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:06FromDiscord<morgan> ok yea that works
07:01:10FromDiscord<Elegantbeef> with a batch of like 8 you're atleast only dividing you max throughput by like 8
07:04:08FromDiscord<huantian> I mean an 8x improvement in download speed is non negligible
07:04:19FromDiscord<Rika> If it’s a thousand then yes batching is better
07:04:24FromDiscord<Rika> I mean
07:04:26FromDiscord<Rika> Smaller batches
07:06:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vcs
07:06:41FromDiscord<Elegantbeef> I havent ran it so no clue if it works
07:07:02FromDiscord<Rika> This looks awful
07:07:03FromDiscord<Rika> Lmao
07:07:22FromDiscord<Rika> Doesn’t futures also have an any proc
07:08:16FromDiscord<Elegantbeef> Not that i can see
07:24:13*kenran joined #nim
07:24:22*kenran quit (Client Quit)
07:27:00FromDiscord<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:28FromDiscord<Elegantbeef> There is no set size depends on the function and your stack size
07:27:36FromDiscord<hmmm> hmmm
07:27:40FromDiscord<hmmm> how can I check?
07:28:00FromDiscord<Elegantbeef> If that's an actual issue perhaps dont do it recursively but instead do it iteratively
07:29:33FromDiscord<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:56FromDiscord<Elegantbeef> Your program is also probably faster due to lacking TCO
07:30:04FromDiscord<hmmm> wot is TCO
07:30:18FromDiscord<Elegantbeef> tail call optimization
07:30:52FromDiscord<Elegantbeef> It's an optimization for recursive calls
07:30:54FromDiscord<Elegantbeef> What's the code you have
07:32:39FromDiscord<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:44FromDiscord<Elegantbeef> Ah tree traversal is one of the few things that's easier to reason recursively
07:33:49FromDiscord<hmmm> yea!
07:34:10FromDiscord<hmmm> all the recursive functions were very easy and natural to write and now I'm struggling lol
07:35:10FromDiscord<Elegantbeef> So what's the function do
07:36:21FromDiscord<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:23FromDiscord<hmmm> the tree is made that every node can have from 0 to infinite children and so on, hmmm like a filesystem
07:49:04FromDiscord<Rika> How deep does it go
07:49:21FromDiscord<Rika> You can rest assured a few hundred in depth is fine, start worrying when you hit a thousand
07:51:21FromDiscord<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:32FromDiscord<Rika> It’s usually done by just making a manual stack really
07:53:40FromDiscord<hmmm> yea I'm trying, I'm hitting all sorts of counter related roadblocks lol
07:53:53FromDiscord<hmmm> turns out I'm not very good at counting!
07:57:10*ehmry joined #nim
08:07:11FromDiscord<Rika> I’m sure beef can relate
08:08:21FromDiscord<Elegantbeef> Hey i can count to as high as i have fingers 12 is pretty high!
08:17:23FromDiscord<Rika> That’s cool, you have a twelve fingered hand
08:32:53FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3VcB
08:33:48FromDiscord<hmmm> this ugly monster is the iterative version of three line of cute recursive proc 😦
08:34:50FromDiscord<hmmm> I heard functional programming is all about cute recursive procs, maybe I should try 🤔
08:56:58FromDiscord<planetis> Now on hacker news, RamanLabs deep learning written in Nim
08:58:04FromDiscord<Rika> Cool
08:58:16FromDiscord<Rika> Did we ever hear of someone doing that here in this chat
09:00:45FromDiscord<planetis> No idea, can't find anything
09:01:12FromDiscord<planetis> Maybe Nim science folks know better
09:18:41FromDiscord<hugogranstrom> Not heard of it \:o Is it the article with id 31030867?
09:25:10FromDiscord<hugogranstrom> Here's their website and their blog has a post about Python interop https://ramanlabs.in/
09:26:07FromDiscord<hugogranstrom> But they seem to be selling it as a product so we won't probably see the actual Nim code sadly
09:34:20FromDiscord<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:15FromDiscord<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:24FromDiscord<sOkam!> Do you guys know of any bash to nimscript converter?
14:58:57FromDiscord<Yardanico> In reply to @jmgomez "cant I call emit": yes
14:59:07FromDiscord<Yardanico> but you have to backquote Nim identifiers that you want to use in the C code
14:59:39FromDiscord<Yardanico> or the newer method is to use array
14:59:51*noeontheend joined #nim
15:00:36FromDiscord<Yardanico> sent a code paste, see https://paste.rs/3r4
15:09:52*vicecea joined #nim
15:11:20viceceaHi, is there an anlogue to c-style opening up a new "body/scope", i.e. `{ stmt... }`? Thanks for any pointers.
15:12:05FromDiscord<Yardanico> yes, `block`
15:12:24FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#statements-and-expressions-block-statement
15:12:47FromDiscord<Yardanico> you can have named/unnamed blocks, and you can break out of named blocks
15:13:02viceceaYardanico_: thanks! that looks perfect
15:13:12FromDiscord<Yardanico> well, you can break from unnamed blocks too
15:14:11FromDiscord<leorize> it's not possible, unfortunately. nimscript lacks many of bash's features↵(@sOkam!)
15:15:34FromDiscord<!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:56FromDiscord<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:10FromDiscord<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:52FromDiscord<dom96> In reply to @System64 "Hi, how can I": `s/char/byte/` possibly
15:56:22nrds<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:43FromDiscord<Yardanico> NimBot123 :D
16:00:16FromDiscord<Rika> Yeah I thought that was extraneous
16:01:44nrds<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:56FromDiscord<dom96> reviewed & merged
16:47:06FromDiscord<dom96> check out my comment 🙂
16:47:16FromDiscord<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:06nrds<Prestige99> DarthOreo: ^^ thanks :)
17:19:09nrds<DarthOreo99> dom96 thanks!
17:19:23nrds<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:17FromDiscord<System64 ~ Flandre Scarlet> In reply to @dom96 "`s/char/byte/` possibly": Char doesn't work
17:41:47FromDiscord<dom96> you mean `byte`?
17:50:37FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3Vey
18:03:16FromDiscord<Rika> Callbacks boo
18:03:53FromDiscord<Rika> I might look into it later/tomorrow
18:04:00FromDiscord<demotomohiro> @System64 ~ Flandre Scarlet This proc might work for your case: https://nim-lang.org/docs/io.html#writeBuffer%2CFile%2Cpointer%2CNatural
18:04:17FromDiscord<d4rckh> How can I load a .cer file into my httpclient? I think it's called CA root certificate
18:12:34FromDiscord<Yardanico> In reply to @d4rckh "How can I load": https://nim-lang.org/docs/net.html#newContext%2Cstring%2Cstring%2Cstring%2Cstring certFile
18:12:46FromDiscord<Yardanico> but if you just need to disable cert validation you can just set verifyMode=CVerifyNone
18:13:08FromDiscord<Yardanico> and then you pass that context as sslContext to newHttpClient/newAsyncHttpClient
18:13:09FromDiscord<Yardanico> https://nim-lang.org/docs/httpclient.html#sslslashtls-support
18:13:47FromDiscord<d4rckh> thanks!
18:14:05FromDiscord<639cdc5b65704dd36a425e849bd59ca3> Are NimSkull windows binaries avaliable?↵https://github.com/nim-works/nimskull
18:18:30FromDiscord<huantian> In reply to @Rika "Callbacks boo": a fun side effect is that SIGINTing it doesn't stop the callbacks, apparently
18:23:19FromDiscord<huantian> though I guess that's just an async thing?
18:25:12FromDiscord<huantian> nope nevermind that was a vscode jank thing
18:26:11FromDiscord<!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:16FromDiscord<!Patitotective> (edit) "so-descriptive" => "so-descriptive↵https://play.nim-lang.org/#ix=3VeP"
18:27:41FromDiscord<enthus1ast> @!Patitotective\: no the reason is that its just a ref
18:27:48FromDiscord<enthus1ast> not initialized
18:28:32*noeontheend quit (Ping timeout: 250 seconds)
18:28:43FromDiscord<enthus1ast> var variant = Variant(kind\: Vint)
18:28:45FromDiscord<!Patitotective> and how do i auto initialize it? or just raise a better error
18:29:54FromDiscord<enthus1ast> do this\:↵var variant = Variant(kind\: Vint)
18:30:53FromDiscord<enthus1ast> VInt i mean
18:30:59FromDiscord<enthus1ast> or VFloat etc...
18:31:07FromDiscord<!Patitotective> yea but what if some object has a field of type `Variant` and i accidentally forget to initialize it
18:32:05FromDiscord<enthus1ast> well, create newYourstuff procs that do this for you
18:32:21FromDiscord<enthus1ast> and always call these
18:32:34FromDiscord<!Patitotective> well thanks 🙃
18:37:53FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3VeS
18:39:36FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3VeS" => "https://play.nim-lang.org/#ix=3VeT"
18:52:48FromDiscord<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:28NimEventerNew thread by Jwatson-CO-edu: Confusion about proc forward declarations, see https://forum.nim-lang.org/t/9109
19:56:03viceceaHi, 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:53FromDiscord<Yardanico> just call `newSeq` on `fs` itself
20:01:57FromDiscord<Yardanico> https://nim-lang.org/docs/system.html#newSeq%2Cseq%5BT%5D%2CNatural
20:02:09FromDiscord<Yardanico> `fs.newSeq()`
20:02:20FromDiscord<Yardanico> but again, you only need newSeq if you want to preallocate some len
20:03:34viceceaYardanico_: ah thanks, I thought I needed to initialize myself or else it would be `nil`, I can see I was wrong, thanks!
20:04:04FromDiscord<Yardanico> that was the case a looot of nim versions ago
20:04:11FromDiscord<Yardanico> but nowadays strings and seqs are preinitialized
20:08:33*kenran joined #nim
21:02:12FromDiscord<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:37FromDiscord<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:58FromDiscord<Elegantbeef> Yes
21:31:04FromDiscord<Elegantbeef> Also `for x in 0..10` exists for count up
21:31:34FromDiscord<Elegantbeef> you can also make your own count iterator
21:34:07FromDiscord<demotomohiro> I think most of people dont use count that can go both way.
21:35:37FromDiscord<ratapenado> In reply to @Elegantbeef "Yes": Thanks
21:36:03FromDiscord<ElegantBeef> Damn bridge dieded
21:36:06FromDiscord<Elegantbeef> whoops
21:36:06FromDiscord<Elegantbeef> that should be `iterator` not `iterate`
21:36:06FromDiscord<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:07FromDiscord<Elegantbeef> depending on what you're doing you also can just do `for x in min(a, b)..max(a, b)`
21:36:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Vft
21:36:10FromDiscord<ElegantBeef> There we go
21:36:15FromDiscord<ElegantBeef> Dumb bridge is dumb
21:36:33FromDiscord<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:01FromDiscord<ElegantBeef> Also huan what's the async download you ended up going with?
21:41:36FromDiscord<ElegantBeef> Just scrolled up and found where you mentioned me, but i apparently didnt get notified on matrix
21:44:46FromDiscord<huantian> yeah I modified it to just store the index of the current url instead of popping from the seq
21:45:10FromDiscord<ElegantBeef> Wonder if https://play.nim-lang.org/#ix=3Vfx works any(yes still kinda dumb)
21:52:30FromDiscord<Zoom> You're welcome!↵(@huantian)
21:52:44FromDiscord<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:52NimEventerNew 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:07NimEventerNew 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:39FromDiscord<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:24FromDiscord<morgan> oh use a converter to create the full variant type?
22:38:41FromDiscord<Elegantbeef> Look at my code
22:38:50FromDiscord<Elegantbeef> I take in tuples and emit the flags
22:39:05FromDiscord<Elegantbeef> I of course dont use a complex variant cause there isnt any reason to imo
22:40:11FromDiscord<morgan> oh i could use a generic proc to get the different type versions
22:40:48FromDiscord<Elegantbeef> Yep
22:40:59FromDiscord<Elegantbeef> The code i provided is vastly less complex than what you presently have afaict
22:41:32FromDiscord<morgan> i’ll look at it more in depth later when i’m back at my computer, thanks
22:58:52FromDiscord<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:39FromDiscord<Elegantbeef> There are desructors/finalizers but i dont know if those are what you want
23:21:29FromDiscord<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:52FromDiscord<Elegantbeef> You need to make a normal object with a destructor and do `MyRefType = ref Base`
23:22:13FromDiscord<Elegantbeef> Finalizers also can be used `new(MyRefType, myFinalizer)`
23:25:31FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3VfV
23:26:00FromDiscord<Ayy Lmao> This doesn't seem to print `Test destroyed.` for me
23:26:09FromDiscord<Elegantbeef> `--mm:orc`?
23:26:22FromDiscord<Elegantbeef> Destructors only work predicitibly with `orc`/`arc`
23:26:48FromDiscord<Elegantbeef> Works fine
23:26:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3VfW
23:27:01FromDiscord<Elegantbeef> works fine with refc\
23:27:44FromDiscord<Ayy Lmao> So you can't count on a destructor being called with a ref unless you are using orc or arc?
23:27:53FromDiscord<Elegantbeef> No you can
23:28:12FromDiscord<Elegantbeef> It's just that Nim's GC doesnt collect before the program exits so it doesnt seem to work
23:28:25FromDiscord<Ayy Lmao> Ah, I figured that might be the problem.
23:29:32FromDiscord<Elegantbeef> In a proper program it'll be proper, the only thing is they're not deterministic
23:29:43FromDiscord<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:01FromDiscord<Elegantbeef> Destructor
23:32:40FromDiscord<Ayy Lmao> In reply to @Elegantbeef "Destructor": Thanks for the help!
23:53:23NimEventerNew 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