<< 25-12-2023 >>

00:00:10*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
00:00:37*antranigv joined #nim
00:55:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @heysokam "<@380360389377916939> do you have": I think I modded NimGL's imGUI to support nglfw
00:58:16FromDiscord<sOkam! 🫐> In reply to @sys64 "I think I modded": oh true, I forgot about that
01:01:24*Mister_Magister quit (Quit: bye)
01:03:24*Mister_Magister joined #nim
03:09:15*hapisnake joined #nim
03:26:35*hapisnake quit (Quit: Client closed)
03:27:03NimEventerNew Nimble package! threadButler - Use threads as if they were servers/microservices to enable multi-threading with a simple mental model., see https://github.com/PhilippMDoerner/Appster
03:40:06FromDiscord<diogenesoftoronto> Hey guys, just wanted to wish you all happy holidays. Discord is filled with ready-made that you don't even read, you just copy and paste to every server, I don't like that, I like writing from my heart. Our friendship, from the deepest to virtual, is very important to me and couldn't ever be represented by a cookie-cutter message from anywhere. So, I'd like to thank you all, you're the best cat picture server I've ever interact
03:54:57FromDiscord<BALMZ APP> Hi
03:58:14FromDiscord<Elegantbeef> Hello
04:50:08FromDiscord<Pancakeswap> sent a long message, see <!doctype html>
04:50:43*xet7 quit (Remote host closed the connection)
04:52:49FromDiscord<odexine> Uh oh
04:53:41FromDiscord<odexine> <@&371760044473319454>
06:35:57*rockcavera quit (Remote host closed the connection)
07:44:26FromDiscord<Phil (he/him)> But have you considered getting banned?
09:33:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
09:33:39FromDiscord<Phil> (edit)
09:33:51FromDiscord<Elegantbeef> You know the type inside your `destroy` proc, how else do you call close
09:34:03FromDiscord<Phil> Yeah because I generate where the user code is
09:34:12FromDiscord<Elegantbeef> I said make a destructor field to store this information
09:34:13FromDiscord<Phil> Because there I know all the types they register with my macro
09:34:28FromDiscord<Elegantbeef> `destructor: proc(_: ChannelHub){.nimcall.})`
09:34:36FromDiscord<Phil> The heck is a destructor field
09:34:46FromDiscord<Elegantbeef> A field named destructor
09:35:07FromDiscord<Elegantbeef> Each channel hub has it's own pointer proc to type erase this madness away
09:35:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
09:36:44FromDiscord<Elegantbeef> Since you use the same type for all your hubs you have to do this
09:36:51FromDiscord<Phil> And what logic is supposed to happen inside of the `destructor` proc?
09:36:59FromDiscord<Elegantbeef> your present `destroy`
09:37:06FromDiscord<Elegantbeef> with `=destroy` on your channels
09:37:36FromDiscord<Phil> ... So can I tell that hook without it being a generic to expect the symbol for that proc in the user-code where it'll be called?
09:37:48FromDiscord<Phil> Basically can I "mixin" that proc-symbol?
09:37:50FromDiscord<Elegantbeef> I just showed you how
09:37:54FromDiscord<Elegantbeef> You use a pointer proc
09:38:26FromDiscord<Elegantbeef> When you init your ChannelHub set the destructor field to that pointer proc
09:39:52FromDiscord<gogolxdong666> Is there any crc16 library in Nim
09:39:52FromDiscord<Elegantbeef> I guess you might need a `seq[proc(_: ChannelHub)]` to handle destruction
09:42:09FromDiscord<Elegantbeef> Maybe it's just cause it's almost 3am but i'm now wondering whether your `ChannelHub` should take in a generic parameter which would be a tuple of the fields it accepts
09:42:25FromDiscord<Elegantbeef> Using them as a variadic generic
09:42:51FromDiscord<Elegantbeef> `ChannelHub[(int, float)]` would only accept `int` and `float`
09:43:08FromDiscord<Phil> I've been down that road, the code it forces you to have is ugly as fuck
09:43:21FromDiscord<Phil> I'd rather have a slightly ugly ChannelHub than the amount of generics that forces on you
09:43:21FromDiscord<Elegantbeef> Why?
09:43:51FromDiscord<Phil> Because the ChannelHub generic will force around a dozen interacting procs to be generic, your handlers that users write to be generic, they'll need to know about the types I generate and more
09:44:14FromDiscord<Elegantbeef> I mean that's the beauty though
09:44:17FromDiscord<Phil> I refactored from that to the pointer approach precisely because it makes user code easier
09:44:18FromDiscord<Elegantbeef> You do not need to know that
09:44:34FromDiscord<maker_of_mischief> is there a way to check if an asynchronous function is finished
09:44:38FromDiscord<maker_of_mischief> (edit) "is there a way to check if an asynchronous function is finished ... " added "without stopping"
09:44:41FromDiscord<Phil> I do if I need to pass ChannelHub everywhere
09:44:42FromDiscord<maker_of_mischief> finished isnt working
09:44:58FromDiscord<Elegantbeef> It's a single generic parameter
09:45:11FromDiscord<maker_of_mischief> ive made a counter to go up while an async function isnt finished https://media.discordapp.net/attachments/371759389889003532/1188779466214879274/170349751054823154.png?ex=659bc427&is=65894f27&hm=945d89ce1aef9d2f763a0d1a8428c9bb6b36815a5bfbe3bbf5608cda8a76ab06&
09:45:20FromDiscord<Phil> With the amount of code that affects that is already too much for me.
09:45:42FromDiscord<Phil> Particularly if the only "bad" thing I might have to eat might possibly not using hooks properly and forcing manual destruction
09:46:02FromDiscord<Phil> In exchange for simpler code in my own space and for users
09:46:06FromDiscord<Elegantbeef> Well you do not lose that cause I've told you how to implement hooks
09:46:22FromDiscord<Elegantbeef> when you add an event to the table add a destructor to a seq
09:46:31FromDiscord<Phil> I'm still trying to fully figure out how to pull that one off because none of these are generics and in my own code I don't know all the types
09:46:51FromDiscord<Elegantbeef> `seq[proc(_: ChannelHub)]`
09:46:53FromDiscord<maker_of_mischief> the counter is waiting until a single websocket request is returned
09:49:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
09:51:10FromDiscord<Elegantbeef> Wait did you use a generic as a varadic generic?
09:51:17FromDiscord<Elegantbeef> Or was the tuple a different thing
09:51:24FromDiscord<Phil> I'd need to know what the heck that is.
09:51:26FromDiscord<Elegantbeef> sorry a tuple as a varadic generic
09:51:31FromDiscord<Phil> I do not use any tuples anywhere
09:51:38FromDiscord<Elegantbeef> did
09:51:49FromDiscord<Elegantbeef> It's a C++ thing that allows you to supply N generic parameters
09:51:55FromDiscord<Elegantbeef> The closest Nim has is a tuple + concept
09:52:29FromDiscord<Elegantbeef> Like it allows `someTemplate<A, B, C, D, E, F>` all the way until the cows go home
09:52:41FromDiscord<Elegantbeef> `someTemplate<A>` would also be valid
09:54:10FromDiscord<Elegantbeef> I'm just curious what you were doing for the generic channelhub
10:06:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:07:03FromDiscord<Elegantbeef> I left out the concept, but anywho
10:07:46FromDiscord<Elegantbeef> \/s/ref/ptr\`
10:12:11FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:13:00FromDiscord<Phil> I mean, it likely works if I define destructorProc in global space but I kinda wanted to minimalize accessibility, seeing as users shouldn't need to know about the proc.
10:13:19FromDiscord<Elegantbeef> What's the error?
10:13:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:14:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:14:20FromDiscord<Elegantbeef> It's an overloaded proc
10:14:38FromDiscord<Elegantbeef> Use `gensym(nskProc, "destroy")`
10:14:44FromDiscord<Elegantbeef> For the name not `ident"destroy"`
10:15:28FromDiscord<Elegantbeef> secondly I hate you 😄
10:15:35FromDiscord<Phil> ... "nskProc"?
10:15:51FromDiscord<Elegantbeef> `genast(destructorProc = genDestroyChannelHubProc(), ...)`
10:16:04FromDiscord<Elegantbeef> You provide the type of symbol you are introducing
10:16:11FromDiscord<Elegantbeef> This matters cause you're making a symbol not an ident
10:16:18FromDiscord<Phil> Yeah but I only know nnk - nimnodekind
10:16:22FromDiscord<Phil> Ohhhh nimsymkind
10:16:50FromDiscord<Elegantbeef> Yep gensym is how so much magic is done
10:17:05FromDiscord<Elegantbeef> Since it's a symbol you can do quite fun things
10:17:23FromDiscord<Elegantbeef> Add it to a table, share it across modules and it still (might) work 😄
10:17:55FromDiscord<Phil> In reply to @Elegantbeef "`genast(destructorProc = genDestroyChannelHubProc()": One refactor after another
10:18:08FromDiscord<Phil> Not all at once, so first get the first approach working, then see about the rest
10:18:56FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:20:34FromDiscord<Elegantbeef> I mean inside your destroy proc
10:20:43FromDiscord<Elegantbeef> instead of doing `ident"destroy"` use the gensym
10:20:52FromDiscord<Elegantbeef> right now you are not assigning the symbol just making it and using it
10:21:20FromDiscord<Elegantbeef> Inside of `genDestroyChannelHubProc` make the `name` be a `genSym(nskProc, "destroy")`
10:21:59FromDiscord<Elegantbeef> Or inside this proc do `destructorProc.name = genSym(...)`
10:22:04FromDiscord<Elegantbeef> But it's better inside the actual code that generates it
10:24:04FromDiscord<Phil> I agree there, okay done that... wth
10:24:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:25:32FromDiscord<Elegantbeef> `result`
10:25:48FromDiscord<Elegantbeef> This is one issue with genast
10:25:51FromDiscord<Phil> But.... that should be valid
10:25:55FromDiscord<Phil> Ah, hm
10:26:05FromDiscord<Elegantbeef> turn that into an expression you neanderthal or inject a `res = ident"result"`
10:26:19FromDiscord<Phil> return works in this case
10:26:29FromDiscord<Phil> Since it really is a short expression
10:26:43FromDiscord<Elegantbeef> Or you know just make it an expression
10:26:45FromDiscord<Phil> No wait , fuck no it doesn't, I'm doing some stuff on the hub after this initial declaration
10:26:58FromDiscord<Elegantbeef> \`res = ident"result"\~
10:27:11FromDiscord<Elegantbeef> `res = ChannelHub(...)`
10:27:34FromDiscord<Phil> Oooooooor
10:27:36FromDiscord<Phil> Hear me out
10:27:38FromDiscord<Phil> quote do
10:27:42FromDiscord<Elegantbeef> Ugh
10:27:48FromDiscord<Elegantbeef> I'm going to find a toaster
10:28:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:34:22FromDiscord<Phil> Fascinatingly std/tables doesn't provide an exported =destroy hook (?)
10:34:44FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:34:57FromDiscord<Elegantbeef> Bug with 2.0
10:35:01FromDiscord<Phil> I guess I... don't need to call that one? I'm confused
10:35:31FromDiscord<maker_of_mischief> is there a method to check if an asyncronous thing is finished without stopping the code and waiting ↵i need to get key input while waiting on a websocket to start doing things
10:35:37FromDiscord<Phil> Given that you shot that off so quickly, is it known or is this something I need to file?
10:35:42FromDiscord<maker_of_mischief> .finished() isnt working :(
10:35:44FromDiscord<Elegantbeef> It's fixed
10:36:33FromDiscord<Elegantbeef> `=destroy(table.addr[])` is a hack
10:36:37FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:36:50FromDiscord<ringabout> (edit)
10:37:12FromDiscord<Phil> In reply to @maker_of_mischief "is there a method": Any async proc will return a future that you can check "finished" for.↵Note that you must either `waitFor` that future or (which will block), or if you're waiting in a loop and do sth else in the loop in the meantime you'd need to call poll yourself (which means you're building your own "async-event-loop" in the faintest of senses).
10:38:23FromDiscord<Phil> The call to poll is necessary because poll is what actually changes a future from finished == false to finished == true once it is acutally complete.↵That value change is a task on the "async-dispatcher" which you can only start working through by calling poll through one way (calling poll yourself) or another (using waitFor or any other derivative)
10:39:18FromDiscord<Phil> (edit) "The call to poll is necessary because poll is ... what" added "(among many other things)"
10:39:59FromDiscord<Phil> In reply to @ringabout "There is a fix": In that case I'm using the hack.↵This is for a library, I do not wish to force users to add mandatory compilation flags
10:40:12FromDiscord<Phil> (edit) "hack.↵This" => "hack and removing that for higher nim versions.↵This"
10:41:18FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:41:29FromDiscord<Phil> (edit)
10:42:28FromDiscord<Phil> with the same error
10:43:53FromDiscord<Phil> Nor do I wish to force them to use devel... again
10:44:49FromDiscord<ringabout> `proc =destroy(hub: var ChannelHub)` still works, though
10:45:03FromDiscord<ringabout> See also https://forum.nim-lang.org/t/10642
10:45:25FromDiscord<pptx704> Hi, I was trying to use threading but am very confused about it. Is there any way to return a value? The `threadpool` docs do not have any `proc`↵One thing I could do is to use side effects but could not find how to send multiple arguments (one of which would be mutable). Any help? Or maybe some library that handles such issue?
10:46:23FromDiscord<Phil> Oh threading also has a taskpool thingy?
10:46:36FromDiscord<Phil> Huh, might add support for that if I can make it work
10:47:24FromDiscord<pptx704> In reply to @isofruit "Oh threading also has": I have no clue. The docs are really vague for me to actually go through (I started learning the lang maybe 2 days ago)
10:48:08FromDiscord<Phil> In reply to @pptx704 "I have no clue.": My current most fruitful experiments were with status/nim-taskpools, but let me take a look at threading's taskpools, I only have optional support for their Channel implementation
10:48:10FromDiscord<Phil> (edit) "In reply to @pptx704 "I have no clue.": My current most fruitful experiments were with status/nim-taskpools, but let me take a look at threading's taskpools, I only have optional support for their Channel implementation ... " added "so far"
10:48:28FromDiscord<Phil> what is the module called that you're looking at?
10:48:32FromDiscord<Phil> or docs to it
10:49:15FromDiscord<Phil> Hmmm can't seem to find a taskpool module
10:49:25FromDiscord<Phil> or threadpool module
10:49:31FromDiscord<pptx704> Was using this- https://nim-lang.org/docs/threadpool.html
10:49:34FromDiscord<odexine> https://nim-lang.org/docs/threadpool.html
10:49:37FromDiscord<Phil> Ohhhhh wait, you were talking about std/threadpool, not https://github.com/nim-lang/threading
10:49:54FromDiscord<pptx704> In reply to @isofruit "Ohhhhh wait, you were": Yeah
10:50:52FromDiscord<Phil> sent a long message, see <!doctype html>
10:51:08FromDiscord<Phil> Depending on what type of parallelism you're looking for malebolgia might be the easiest way to go about it imo
10:54:11FromDiscord<pptx704> In reply to @isofruit "Depending on what type": So basically I want to make a lot of `ExecCmd` calls. Seems like it's I/O bound (as it uses nslookup). But Async doesn’t speed up anything. Not sure if threading would help much
10:55:00FromDiscord<odexine> Threading is unlikely to help
10:55:02FromDiscord<pptx704> But it's interesting that good threading support doesn’t come with the language std itself. Is there a plan for adding one of these libraries to the std later on?
10:57:35FromDiscord<Phil> In reply to @odexine "Threading is unlikely to": Not that I'm hyper knowledgeable here but wouldn't multiple threads help if one thread alone doesn't max out the full write/read spead of the SSD?
10:58:06FromDiscord<odexine> In reply to @isofruit "Not that I'm hyper": If that were the case then async would help as well
10:58:33FromDiscord<Phil> Ah, good point, so basically the limit here is the SSD or whatever piece of hardware is being hit by the I/O
10:58:42FromDiscord<odexine> The network
10:58:52FromDiscord<Phil> is nsloopup network?
10:58:59FromDiscord<Phil> (edit) "nsloopup" => "nslookup"
10:59:00FromDiscord<pptx704> Yeah
10:59:08FromDiscord<pptx704> It checks for some server hostname
10:59:39FromDiscord<Phil> In that case that seems like a... network card hardware limitation (?)
10:59:42FromDiscord<pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:00:22FromDiscord<odexine> Well the problem here is that exec whatever whatever isnt async in the firdt place
11:01:09FromDiscord<pptx704> In reply to @odexine "Well the problem here": One of the reasons I am thinking that threading will help
11:01:36FromDiscord<odexine> In this case it will but you will encounter problems as well
11:01:42FromDiscord<odexine> Might now be worth it
11:02:07FromDiscord<Phil> Is nslookup bindable and callable from nim directly maybe?
11:02:14FromDiscord<Phil> Without having to go through the shell
11:02:16FromDiscord<odexine> Likely is
11:02:29FromDiscord<Phil> I know readLine is thus the association
11:02:47FromDiscord<pptx704> In reply to @isofruit "Is nslookup bindable and": How is that?
11:03:08FromDiscord<odexine> Using the C library, but that still has the problem of not being async
11:03:10FromDiscord<Phil> In reply to @pptx704 "How is that?": Nim transpiles to C and goes through the C toolchain from there to become a binary
11:03:43FromDiscord<pptx704> In reply to @isofruit "Nim transpiles to C": I get that. But how to implement that? Maybe some docs?
11:03:43FromDiscord<odexine> It’s not very fun trying to make a binding async
11:04:11FromDiscord<Phil> And yeah, what Rika stated.↵But you could use threads with a taskpool (or use createThread directly)
11:05:10FromDiscord<Phil> Hmm based on what Rika stated calling the thing from C won't magically make it better if it doesn't have an async version there
11:05:34FromDiscord<pptx704> I did use createThread but could not figure out how to define the type. i.e. `var thread = Thread[???]` as I am sending several arguments
11:05:42FromDiscord<Phil> In that case spawning new threads and having the waiting be done in there seems like the way to go.
11:05:50FromDiscord<Phil> In reply to @pptx704 "I did use createThread": In those cases you make yourself a wrapper type basically
11:05:58FromDiscord<Phil> Or a tuple
11:06:03FromDiscord<pptx704> In reply to @isofruit "Hmm based on what": Probably will try malbolgia and see what happens
11:06:04FromDiscord<odexine> In reply to @isofruit "Hmm based on what": Not really “if it doesn’t have an async version” because even if it does, it’s a different system to Nim async
11:06:22FromDiscord<odexine> Though yes it would be even harder if it didn’t have an async version
11:06:22FromDiscord<Phil> Right, different async-queue
11:06:40FromDiscord<Phil> Or is it even called async-queue?
11:06:46FromDiscord<odexine> Event queue
11:06:48FromDiscord<Phil> We call that thing dispatcher and that confuses the shit out of me
11:06:56FromDiscord<Phil> Check
11:07:12FromDiscord<pptx704> In reply to @isofruit "We call that thing": U mean `asyncdispatch`?
11:07:22FromDiscord<odexine> Technically Nim async ultimately uses C (or more accurately OS) async utilities
11:08:27FromDiscord<pptx704> Although I wonder why the function being called needs to be async. i.e. Is it because my async thread(?) would be blocked until that function returns something?
11:08:35FromDiscord<Phil> In reply to @pptx704 "U mean `asyncdispatch`?": That's where the code is, but sometimes I just get caught up on the specific namings surrounding async, specifically because somehow this line always messes with me: `The dispatcher acts as a kind of event loop. `
11:09:23FromDiscord<pptx704> In reply to @isofruit "That's where the code": apart from some weird things here and there nim is a nice language tbh
11:09:41FromDiscord<odexine> In reply to @pptx704 "Although I wonder why": Async here basically means “I’ll give the control back to a controller manually” where “await” is where the control is given
11:09:57FromDiscord<Phil> In reply to @pptx704 "Although I wonder why": Yes.↵It is a single thread and async just means wherever a hidden call to poll is made is where the call gets executed. When that non-async-shell-call gets executed you're stuck with your thread there
11:10:21FromDiscord<odexine> If you don’t have await then you never give back control so the controller can’t switch tasks, kinda super simplified but oh well
11:10:38FromDiscord<pptx704> In reply to @pptx704 "apart from some weird": Really loving working with it. It will probably replace python for me (still need the huge community support tho)
11:10:46FromDiscord<odexine> Why can’t you await anywhere? Technically you can, it just won’t be where you expect to
11:11:10FromDiscord<odexine> Like you can wait before your ns call but that wouldn’t make sense since you’re waiting for nothing, also same you can do after but also you know what I mean
11:11:14FromDiscord<Phil> In reply to @pptx704 "Really loving working with": Nimpy will help in those cases
11:11:16FromDiscord<odexine> So you have to do it in between
11:11:24FromDiscord<odexine> But you can’t since it’s a function l you didn’t make
11:12:06FromDiscord<pptx704> In reply to @odexine "But you can’t since": Yeah makes sense
11:12:25FromDiscord<pptx704> In reply to @isofruit "Nimpy will help in": Haven't explored it yet
11:13:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:16:24FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:17:34FromDiscord<Phil> taskpool provides flowvars which are kinda like promises, you'll want to read the docs on the taskpool repo for further details.↵Malebolgia does this all without flowvars which is really neat and might be more what you're after, I haven't used it myself though
11:20:52FromDiscord<Phil> @ringabout Can I suppress a warning for just one specific line of code?
11:21:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:24:42FromDiscord<Phil> ElegantBeef:↵Nope I was just being a silly billy and skimming error messages.↵Your workaround works, there just are no destructors for proc fields (and thus none for the `destructor` field) that's what was erroring our.
11:24:48FromDiscord<Phil> (edit) "our." => "out."
11:33:49FromDiscord<Phil> Welp, still breaks because destructor call blows up somehow =/
11:35:15FromDiscord<Phil> Wait wtf, this is dying inside the new call somehow
11:38:00FromDiscord<Phil> I'm about this close to move back to manual destruction, the hell.↵So its calling destructors before anything is ever initialized or sth?
12:30:33FromDiscord<ieltan> In reply to @isofruit "Welp, still breaks because": check for nil ?
12:35:56FromDiscord<Phil> I think this may be a bigger refactor than assumed
12:36:27FromDiscord<Phil> Because each thread has their own instance of ChannelHub, it just doesn't matter (or didn't so far) because the ChannelHub destructor didn't affect the pointers in any way
12:36:55FromDiscord<Phil> So the manual destruction made it easy-peasy.↵Now trying to move to destructors means I have to pass references to ChannelHub between all the threads
13:17:52*lucasta joined #nim
14:35:13*def- quit (Quit: -)
14:35:47*def- joined #nim
15:27:57*lucasta quit (Remote host closed the connection)
16:14:06FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html>
16:21:38FromDiscord<fowl.mouth> sent a code paste, see https://play.nim-lang.org/#ix=html>
16:29:20FromDiscord<sOkam! 🫐> In reply to @fowl.mouth "What are these dots": nvim copy/paste, sorry. didn't notice
16:30:29FromDiscord<sOkam! 🫐> oh you might be on to something. it might have been pasted by accident from a different terminal
16:41:44*cm quit (Quit: Bye.)
16:42:02*cm joined #nim
17:00:17FromDiscord<sOkam! 🫐> In reply to @fowl.mouth "What are these dots": that was it. ty for noticing!
17:02:03FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html>
17:12:58FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html>
17:38:22*lucasta joined #nim
17:52:15*lucasta quit (Quit: Leaving)
18:33:46FromDiscord<9ih> sent a code paste, see https://play.nim-lang.org/#ix=html>
18:35:21FromDiscord<9ih> also; I can't find any documentation on the `owned` keyword that I've seen in the stdlib, what does it mean?
18:35:39FromDiscord<9ih> in relation to returning a ref object
18:35:49FromDiscord<9ih> (edit) "in relation to returning a ref object ... " added "and I see `new(result)` around too"
18:41:33FromDiscord<griffith1deadly> In reply to @9ih "also; I can't find": owned deprecated as i remember
18:41:59FromDiscord<9ih> oh okay interesting
18:42:11FromDiscord<huantian> Yep I don’t think it does anything
19:14:17Amun-Raowned deprecated? at least not in 2.0
19:40:52FromDiscord<bostonboston> I don't think owned is deprecated but it is abandoned and replaced play lent/isolate if I remember
19:41:21FromDiscord<bostonboston> replaced with
20:37:23*derpydoo joined #nim
21:05:57FromDiscord<Elegantbeef> @9ih yes `MilkShake` is a non ref object
21:06:32FromDiscord<Elegantbeef> @Phil wait if each thread had it's own channelhub how did they even communicate to eachother?
21:06:56FromDiscord<Elegantbeef> My understanding was that you allocated the hub on the main thread than passed a `ptr` to it for the other threads
21:07:03FromDiscord<Phil> In reply to @Elegantbeef "<@180601887916163073> wait if each": It's multiple copies of the same objects, all of them have the same pointers
21:07:31FromDiscord<Elegantbeef> Oh... that's odd
21:08:32FromDiscord<Elegantbeef> If you wanted to cheese the destructor in add a `Atomic` `=copy` increments it and `=destroy` decrements it
21:08:48FromDiscord<Elegantbeef> When it reaches `0` you actually do destruction
21:08:59FromDiscord<Elegantbeef> Nvm that will not work
21:09:08FromDiscord<Elegantbeef> It'd need to be a `ptr Atomic[int]`
21:09:20FromDiscord<Phil> Honestly it's not like I planned it that way
21:09:30FromDiscord<Phil> I originally had it as a ref object precisely because of that mental model 😛
21:10:10FromDiscord<Elegantbeef> Well move it towards a `ptr ChannelHub` and use`ref ChannelHub` on the owning thread
21:10:11FromDiscord<Phil> Remember back when it was a ref object and you asked me why it was that way and suggested to just use value object because it'll work out (and it did and got rid of having to deref twice to get to a channel) 😄
21:10:30FromDiscord<Elegantbeef> I also said pass it as `ptr ChannelHub`
21:10:45FromDiscord<Elegantbeef> So you disregarded the important talk 😄
21:11:00FromDiscord<Elegantbeef> Hence 'deref twice'
21:11:07FromDiscord<Elegantbeef> I didnt say "You have to deref it!" 😛
21:12:15FromDiscord<Elegantbeef> Anyway just pointer indirect it once using `ref` or `ptr` then pass that to the other threads as `ptr ChannelHub`
21:12:31FromDiscord<Elegantbeef> Ideally `ref` on the main thread
21:12:46FromDiscord<Elegantbeef> So you do not need to make a `distinct ChannelHub` and ref count
21:13:05FromDiscord<Elegantbeef> Or you can disregard this all and just keep the manual `destroy`
21:13:13FromDiscord<Elegantbeef> Assuming you properly handle `Chan[T]` now
21:13:41FromDiscord<Phil> I do, that one is valid either way regardless of destruction strategy
21:14:06FromDiscord<Phil> Meaning it's always an improvement to add calls to the =destroy hook for the channel/chan instances
21:14:39FromDiscord<Phil> I guess not wanting to deal with stuff like this is also why weave and taskpool do manual calls to destroy a taskpool
21:16:51FromDiscord<Elegantbeef> No clue, I just don't like playing compiler 😄
21:22:40FromDiscord<pptx704> @Phil I was trying malebolgia, but got this error. Can you explain me the issue? https://media.discordapp.net/attachments/371759389889003532/1188954994393743451/image.png?ex=659c67a0&is=6589f2a0&hm=267e24430fe72b306cc9b8dc1878524bc5fb625a09bb9c1ba39a25bc047ed426&
21:22:51FromDiscord<pptx704> (edit) "explain" => "help" | "helpme ... the" added "with"
21:22:58FromDiscord<Phil> In reply to @pptx704 "<@180601887916163073> I was trying": Is that an actual compilation error or just nimsuggest?
21:23:08FromDiscord<pptx704> Actual error
21:23:11FromDiscord<Elegantbeef> We do not do tooling messages here
21:23:19FromDiscord<Elegantbeef> Compile the code and paste the actual error message
21:23:49FromDiscord<pptx704> https://media.discordapp.net/attachments/371759389889003532/1188955281560981596/image.png?ex=659c67e4&is=6589f2e4&hm=c5b30530bfd45fca446a2bc834abfd1dee8391a545ccb0798211d9f876ac29d8&
21:23:51FromDiscord<pptx704> You mean this one?
21:24:04FromDiscord<Elegantbeef> It's not a call
21:24:13FromDiscord<Elegantbeef> `getVHost(...)`
21:24:32FromDiscord<Phil> getVHost doesn't eat a proc, it eats an object
21:24:53FromDiscord<Phil> Actually no, wait
21:25:11FromDiscord<Phil> God damn Araq, this is why we assert our inputs and provide more helpful error messages
21:25:12FromDiscord<pptx704> The example code in the docs, eats an object tho
21:25:24FromDiscord<Phil> (edit) "God damn ... Araq," added "it"
21:25:26FromDiscord<Elegantbeef> Phil it does not even get into the macro
21:25:40FromDiscord<Elegantbeef> It's a macro with a pattern constraint
21:26:00FromDiscord<Elegantbeef> In otherwords `toTask` errors if it gets anything that's not `{nkCall,....}`
21:26:13FromDiscord<Phil> On the one hand, cool.↵On the other, given the error messages it puts out, I'd want to never use it since I don't hate my users
21:26:27FromDiscord<Elegantbeef> Just learn to read 😛
21:26:30FromDiscord<Phil> I'd find it useful internally to tell me the dev that I did a bad
21:26:39FromDiscord<Phil> I'd never want the user to see that
21:26:47FromDiscord<Elegantbeef> It's pretty useful in some cases but this is not a case I'd use it
21:26:51FromDiscord<Phil> Users should not be required to know how macros work
21:27:01FromDiscord<Elegantbeef> This isnt even a macro thing btw
21:27:07FromDiscord<Elegantbeef> You can use that matching on procs aswell
21:27:34FromDiscord<pptx704> I am clueless atp
21:27:36FromDiscord<pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html>
21:27:37FromDiscord<Phil> I'll need to take a look at it since it could get rid of some of my assertKind calls that I do at the start of my procs
21:27:43FromDiscord<Phil> (edit) "I'll need to take a look at it since it could get rid of some of my assertKind calls that I do at the start of my ... procs" added "NimNode"
21:27:47FromDiscord<pptx704> This is the code. What change should I make here?
21:27:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
21:27:52FromDiscord<Elegantbeef> It does not work on Nimnodes Phil
21:28:08FromDiscord<Elegantbeef> It constrains callables to only work on specific AST
21:28:39FromDiscord<Elegantbeef> Notice that it's `nkName` and not `nnkName`
21:28:54FromDiscord<Elegantbeef> `nkName` is the actual PNode kind whereas `nnkName` is the NimNode kind
21:29:28FromDiscord<Elegantbeef> pptx please provide a runnable example with imports
21:29:42FromDiscord<pptx704> Just a min
21:29:48FromDiscord<Elegantbeef> Thank yo
21:30:47FromDiscord<albassort> is there a good tool for moddeling cycles
21:30:53FromDiscord<albassort> like
21:31:01FromDiscord<pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html>
21:31:03FromDiscord<pptx704> This should work
21:31:09FromDiscord<albassort> im programming a game cycle and i gotta fidget with the numbers
21:31:23FromDiscord<pptx704> By work, I mean it will throw error
21:36:45FromDiscord<Elegantbeef> Shouldn't that be `getVHost(i)`?
21:37:12FromDiscord<Elegantbeef> `getVHost` is just a procedure
21:37:47FromDiscord<pptx704> God I am so dumb
21:37:49FromDiscord<pptx704> urghh
21:38:03FromDiscord<Elegantbeef> Hey I said it earlier 😛
21:40:27FromDiscord<pptx704> Thanks
21:40:29FromDiscord<pptx704> Anyways
21:40:35FromDiscord<pptx704> Not this procedure is taking forever
21:40:53FromDiscord<pptx704> I mean the `getVHostTable` proc
21:41:15FromDiscord<Phil> In reply to @Elegantbeef "It does not work": That... hmm then this becomes even more difficult to see how to properly utilize it, since I don't want to force users to know these things. Internal usage only I guess
21:41:56FromDiscord<pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html>
21:42:48FromDiscord<Elegantbeef> It's more meant to be used with pattern matching macros, but it also works generally
21:42:49FromDiscord<Elegantbeef> "taking more than" meaning what
21:43:38FromDiscord<Elegantbeef> @albassort what do you mean for "modelling cycles"?
21:50:16*jmdaemon joined #nim
21:50:19FromDiscord<Phil> In reply to @Elegantbeef ""taking more than" meaning": Likely means "taking longer to compute than"
21:50:30FromDiscord<Phil> or "taking longer to finish executing"
21:52:02FromDiscord<pptx704> Taking more than as in, without any threads, it takes around 10s for the whole program to be complete. But when spawning is on, it doesn't finish at all
21:52:08FromDiscord<pptx704> It just gets stuck
21:52:46FromDiscord<Elegantbeef> Context switching is likely killing your process as it's not a thread blocked program it's a IO blocked program
21:53:13FromDiscord<Elegantbeef> I have no clue how many ips your checking for though
21:53:15FromDiscord<Elegantbeef> I assume it's a fair bit
21:53:49FromDiscord<pptx704> 50 in total
21:54:28FromDiscord<pptx704> In reply to @Elegantbeef "Context switching is likely": apparently, asyncdispatch doesn't work either
21:55:47FromDiscord<pptx704> Now I am really confused on how to speed it up
21:55:58FromDiscord<pptx704> Because for some cases, it might be 100s of ips
21:56:24FromDiscord<pptx704> without some sort of parallelism, the program wouldn't be very effective
21:56:46FromDiscord<Elegantbeef> `getAddrInfo` would be faster
21:57:46FromDiscord<pptx704> from `std/nativesockets`?
21:57:52FromDiscord<Elegantbeef> Yes
21:58:03FromDiscord<Elegantbeef> Why use shell when you can use the actual procedures
21:58:24FromDiscord<pptx704> I didn't know such thing existed until just now
22:00:13FromDiscord<Elegantbeef> If you are shelling out it's generally the 'wrong' thing to do
22:03:09FromDiscord<pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:03:21FromDiscord<pptx704> (edit)
22:07:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:07:49FromDiscord<Elegantbeef> Atleast we're assuming it's `443` as it's https
22:08:51FromDiscord<pptx704> Mhmmm. Let me try that
22:14:53FromDiscord<pptx704> Nope. Not exactly what I want
22:14:55FromDiscord<pptx704> https://media.discordapp.net/attachments/371759389889003532/1188968138797232269/image.png?ex=659c73de&is=6589fede&hm=5edc611ef4a5394104c292a3ac14456cb444be76846d4a9380484d14ab40c95f&
22:14:58FromDiscord<pptx704> This is what I am getting
22:15:16FromDiscord<pptx704> Expecting something like this https://media.discordapp.net/attachments/371759389889003532/1188968230140776448/image.png?ex=659c73f4&is=6589fef4&hm=47a373235c2ce391abde5e3b257b623f35cc1d12c516600485e8741f6a1f46e9&
22:15:17FromDiscord<Elegantbeef> You have what and want what?
22:16:11FromDiscord<pptx704> I want something that works like this- https://www.nslookup.io/a-lookup/
22:17:18FromDiscord<Chronos [She/Her]> https://github.com/jmorganca/ollama/blob/main/docs/api.md hm I wonder if it's worth wrapping Ollama's API...
22:20:45FromDiscord<Elegantbeef> Well if you want A records that requires a request afaik, but I do not know what one needs to request
22:21:57FromDiscord<Elegantbeef> Probably a usable DNS library in the nimble directory
22:23:36FromDiscord<sOkam! 🫐> how does nim implement enum arrays in the c backend? are they maps or hashtables? 🤔
22:23:42FromDiscord<pptx704> In reply to @Elegantbeef "Well if you want": Probably. This is one of the reason I am using `nslookup` via shell
22:23:45FromDiscord<Elegantbeef> They're arrays
22:24:25FromDiscord<Elegantbeef> There is nothing special about enum arrays they're just `T[NumberOfEnumElements]` for contiguous arrays
22:24:59FromDiscord<Elegantbeef> contiguous enums\
22:25:03FromDiscord<sOkam! 🫐> ah true, the size is actually known, didn't cross my mind
22:25:20FromDiscord<Elegantbeef> Since 99% of enums are contiguous and start at 0 there is not much more to them
22:25:57FromDiscord<Elegantbeef> For non zero starting you have to do `ord(ind) - ord(low)` for indexing
22:26:38FromDiscord<Elegantbeef> for `type Bleh = enum a = -1, b, c, d` that makes `myArr[a]` turn into `myArr[-1 - -1` or just `myArr[0]`
22:27:21FromDiscord<sOkam! 🫐> makes sense
22:28:51FromDiscord<Elegantbeef> More likely than not you could always emit the `ind - low` logic and the C compiler will just go "Oh yea that's - 0" and remove it
22:53:03FromDiscord<sOkam! 🫐> is there an equivalent to `python -m http.server` in any of the http servers for nim? 🤔
22:54:01FromDiscord<sOkam! 🫐> idea being to run the command on a folder and the tool opening a local server from its contents
22:55:11FromDiscord<Elegantbeef> httpd
22:55:16FromDiscord<Elegantbeef> nimhttpd i think is it's proper name
23:07:44FromDiscord<pptx704> Is `len(seq)` a O(1) operation? As in, is the length saved in some variable or is it calculated everytime?
23:08:44FromDiscord<jviega> It’s constant time yes
23:08:53FromDiscord<Elegantbeef> Nim seq and strings are pascal collections they store the length
23:20:41FromDiscord<sOkam! 🫐> found it, ty!
23:20:41FromDiscord<sOkam! 🫐> @ringabout do you happen to have a similar thing implemented with httpx laying around somewhere?
23:20:50FromDiscord<albassort> In reply to @Elegantbeef "<@217459674700578816> what do you": so im moddelliing a full system with a lot of complexities and i want to be able to watch it happen
23:21:06FromDiscord<albassort> i can implement it in nim before lua, that'd be easier
23:21:19FromDiscord<albassort> but a visual tool is what im looking for
23:23:15FromDiscord<pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html>
23:25:18FromDiscord<Elegantbeef> What do you even mean
23:25:24FromDiscord<sOkam! 🫐> `a2` or just a better naming convention in general↵that second variable might be based on the first, but it has its own reason to exist. which means it deserves its own identity
23:25:28FromDiscord<Elegantbeef> just do `let a = someOtherFunc(a)`
23:25:37FromDiscord<Elegantbeef> If you want to shadow you shadow
23:25:46FromDiscord<Elegantbeef> If you do not want to shadow just give it a descriptive name
23:26:34FromDiscord<pptx704> makes sense
23:28:24NimEventerNew thread by isaiah: Please who can help me with nim filter, see https://forum.nim-lang.org/t/10802
23:43:48FromDiscord<ieltan> In reply to @NimEventer "New thread by isaiah:": unreadable...
23:49:09FromDiscord<Phil> It's RST, so much for that syntax being supported
23:50:17FromDiscord<Phil> I updated the post, seems to be about source code filters