00:00:10 | * | antranigv quit (Quit: ZNC 1.8.2 - https://znc.in) |
00:00:37 | * | antranigv joined #nim |
00:55:49 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @heysokam "<@380360389377916939> do you have": I think I modded NimGL's imGUI to support nglfw |
00:58:16 | FromDiscord | <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:03 | NimEventer | New 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:06 | FromDiscord | <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:57 | FromDiscord | <BALMZ APP> Hi |
03:58:14 | FromDiscord | <Elegantbeef> Hello |
04:50:08 | FromDiscord | <Pancakeswap> sent a long message, see <!doctype html> |
04:50:43 | * | xet7 quit (Remote host closed the connection) |
04:52:49 | FromDiscord | <odexine> Uh oh |
04:53:41 | FromDiscord | <odexine> <@&371760044473319454> |
06:35:57 | * | rockcavera quit (Remote host closed the connection) |
07:44:26 | FromDiscord | <Phil (he/him)> But have you considered getting banned? |
09:33:25 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:33:39 | FromDiscord | <Phil> (edit) |
09:33:51 | FromDiscord | <Elegantbeef> You know the type inside your `destroy` proc, how else do you call close |
09:34:03 | FromDiscord | <Phil> Yeah because I generate where the user code is |
09:34:12 | FromDiscord | <Elegantbeef> I said make a destructor field to store this information |
09:34:13 | FromDiscord | <Phil> Because there I know all the types they register with my macro |
09:34:28 | FromDiscord | <Elegantbeef> `destructor: proc(_: ChannelHub){.nimcall.})` |
09:34:36 | FromDiscord | <Phil> The heck is a destructor field |
09:34:46 | FromDiscord | <Elegantbeef> A field named destructor |
09:35:07 | FromDiscord | <Elegantbeef> Each channel hub has it's own pointer proc to type erase this madness away |
09:35:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:36:44 | FromDiscord | <Elegantbeef> Since you use the same type for all your hubs you have to do this |
09:36:51 | FromDiscord | <Phil> And what logic is supposed to happen inside of the `destructor` proc? |
09:36:59 | FromDiscord | <Elegantbeef> your present `destroy` |
09:37:06 | FromDiscord | <Elegantbeef> with `=destroy` on your channels |
09:37:36 | FromDiscord | <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:48 | FromDiscord | <Phil> Basically can I "mixin" that proc-symbol? |
09:37:50 | FromDiscord | <Elegantbeef> I just showed you how |
09:37:54 | FromDiscord | <Elegantbeef> You use a pointer proc |
09:38:26 | FromDiscord | <Elegantbeef> When you init your ChannelHub set the destructor field to that pointer proc |
09:39:52 | FromDiscord | <gogolxdong666> Is there any crc16 library in Nim |
09:39:52 | FromDiscord | <Elegantbeef> I guess you might need a `seq[proc(_: ChannelHub)]` to handle destruction |
09:42:09 | FromDiscord | <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:25 | FromDiscord | <Elegantbeef> Using them as a variadic generic |
09:42:51 | FromDiscord | <Elegantbeef> `ChannelHub[(int, float)]` would only accept `int` and `float` |
09:43:08 | FromDiscord | <Phil> I've been down that road, the code it forces you to have is ugly as fuck |
09:43:21 | FromDiscord | <Phil> I'd rather have a slightly ugly ChannelHub than the amount of generics that forces on you |
09:43:21 | FromDiscord | <Elegantbeef> Why? |
09:43:51 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> I mean that's the beauty though |
09:44:17 | FromDiscord | <Phil> I refactored from that to the pointer approach precisely because it makes user code easier |
09:44:18 | FromDiscord | <Elegantbeef> You do not need to know that |
09:44:34 | FromDiscord | <maker_of_mischief> is there a way to check if an asynchronous function is finished |
09:44:38 | FromDiscord | <maker_of_mischief> (edit) "is there a way to check if an asynchronous function is finished ... " added "without stopping" |
09:44:41 | FromDiscord | <Phil> I do if I need to pass ChannelHub everywhere |
09:44:42 | FromDiscord | <maker_of_mischief> finished isnt working |
09:44:58 | FromDiscord | <Elegantbeef> It's a single generic parameter |
09:45:11 | FromDiscord | <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:20 | FromDiscord | <Phil> With the amount of code that affects that is already too much for me. |
09:45:42 | FromDiscord | <Phil> Particularly if the only "bad" thing I might have to eat might possibly not using hooks properly and forcing manual destruction |
09:46:02 | FromDiscord | <Phil> In exchange for simpler code in my own space and for users |
09:46:06 | FromDiscord | <Elegantbeef> Well you do not lose that cause I've told you how to implement hooks |
09:46:22 | FromDiscord | <Elegantbeef> when you add an event to the table add a destructor to a seq |
09:46:31 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> `seq[proc(_: ChannelHub)]` |
09:46:53 | FromDiscord | <maker_of_mischief> the counter is waiting until a single websocket request is returned |
09:49:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:51:10 | FromDiscord | <Elegantbeef> Wait did you use a generic as a varadic generic? |
09:51:17 | FromDiscord | <Elegantbeef> Or was the tuple a different thing |
09:51:24 | FromDiscord | <Phil> I'd need to know what the heck that is. |
09:51:26 | FromDiscord | <Elegantbeef> sorry a tuple as a varadic generic |
09:51:31 | FromDiscord | <Phil> I do not use any tuples anywhere |
09:51:38 | FromDiscord | <Elegantbeef> did |
09:51:49 | FromDiscord | <Elegantbeef> It's a C++ thing that allows you to supply N generic parameters |
09:51:55 | FromDiscord | <Elegantbeef> The closest Nim has is a tuple + concept |
09:52:29 | FromDiscord | <Elegantbeef> Like it allows `someTemplate<A, B, C, D, E, F>` all the way until the cows go home |
09:52:41 | FromDiscord | <Elegantbeef> `someTemplate<A>` would also be valid |
09:54:10 | FromDiscord | <Elegantbeef> I'm just curious what you were doing for the generic channelhub |
10:06:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:07:03 | FromDiscord | <Elegantbeef> I left out the concept, but anywho |
10:07:46 | FromDiscord | <Elegantbeef> \/s/ref/ptr\` |
10:12:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:13:00 | FromDiscord | <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:19 | FromDiscord | <Elegantbeef> What's the error? |
10:13:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:14:19 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:14:20 | FromDiscord | <Elegantbeef> It's an overloaded proc |
10:14:38 | FromDiscord | <Elegantbeef> Use `gensym(nskProc, "destroy")` |
10:14:44 | FromDiscord | <Elegantbeef> For the name not `ident"destroy"` |
10:15:28 | FromDiscord | <Elegantbeef> secondly I hate you 😄 |
10:15:35 | FromDiscord | <Phil> ... "nskProc"? |
10:15:51 | FromDiscord | <Elegantbeef> `genast(destructorProc = genDestroyChannelHubProc(), ...)` |
10:16:04 | FromDiscord | <Elegantbeef> You provide the type of symbol you are introducing |
10:16:11 | FromDiscord | <Elegantbeef> This matters cause you're making a symbol not an ident |
10:16:18 | FromDiscord | <Phil> Yeah but I only know nnk - nimnodekind |
10:16:22 | FromDiscord | <Phil> Ohhhh nimsymkind |
10:16:50 | FromDiscord | <Elegantbeef> Yep gensym is how so much magic is done |
10:17:05 | FromDiscord | <Elegantbeef> Since it's a symbol you can do quite fun things |
10:17:23 | FromDiscord | <Elegantbeef> Add it to a table, share it across modules and it still (might) work 😄 |
10:17:55 | FromDiscord | <Phil> In reply to @Elegantbeef "`genast(destructorProc = genDestroyChannelHubProc()": One refactor after another |
10:18:08 | FromDiscord | <Phil> Not all at once, so first get the first approach working, then see about the rest |
10:18:56 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:20:34 | FromDiscord | <Elegantbeef> I mean inside your destroy proc |
10:20:43 | FromDiscord | <Elegantbeef> instead of doing `ident"destroy"` use the gensym |
10:20:52 | FromDiscord | <Elegantbeef> right now you are not assigning the symbol just making it and using it |
10:21:20 | FromDiscord | <Elegantbeef> Inside of `genDestroyChannelHubProc` make the `name` be a `genSym(nskProc, "destroy")` |
10:21:59 | FromDiscord | <Elegantbeef> Or inside this proc do `destructorProc.name = genSym(...)` |
10:22:04 | FromDiscord | <Elegantbeef> But it's better inside the actual code that generates it |
10:24:04 | FromDiscord | <Phil> I agree there, okay done that... wth |
10:24:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:25:32 | FromDiscord | <Elegantbeef> `result` |
10:25:48 | FromDiscord | <Elegantbeef> This is one issue with genast |
10:25:51 | FromDiscord | <Phil> But.... that should be valid |
10:25:55 | FromDiscord | <Phil> Ah, hm |
10:26:05 | FromDiscord | <Elegantbeef> turn that into an expression you neanderthal or inject a `res = ident"result"` |
10:26:19 | FromDiscord | <Phil> return works in this case |
10:26:29 | FromDiscord | <Phil> Since it really is a short expression |
10:26:43 | FromDiscord | <Elegantbeef> Or you know just make it an expression |
10:26:45 | FromDiscord | <Phil> No wait , fuck no it doesn't, I'm doing some stuff on the hub after this initial declaration |
10:26:58 | FromDiscord | <Elegantbeef> \`res = ident"result"\~ |
10:27:11 | FromDiscord | <Elegantbeef> `res = ChannelHub(...)` |
10:27:34 | FromDiscord | <Phil> Oooooooor |
10:27:36 | FromDiscord | <Phil> Hear me out |
10:27:38 | FromDiscord | <Phil> quote do |
10:27:42 | FromDiscord | <Elegantbeef> Ugh |
10:27:48 | FromDiscord | <Elegantbeef> I'm going to find a toaster |
10:28:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:34:22 | FromDiscord | <Phil> Fascinatingly std/tables doesn't provide an exported =destroy hook (?) |
10:34:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:34:57 | FromDiscord | <Elegantbeef> Bug with 2.0 |
10:35:01 | FromDiscord | <Phil> I guess I... don't need to call that one? I'm confused |
10:35:31 | FromDiscord | <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:37 | FromDiscord | <Phil> Given that you shot that off so quickly, is it known or is this something I need to file? |
10:35:42 | FromDiscord | <maker_of_mischief> .finished() isnt working :( |
10:35:44 | FromDiscord | <Elegantbeef> It's fixed |
10:36:33 | FromDiscord | <Elegantbeef> `=destroy(table.addr[])` is a hack |
10:36:37 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:36:50 | FromDiscord | <ringabout> (edit) |
10:37:12 | FromDiscord | <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:23 | FromDiscord | <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:18 | FromDiscord | <Phil> (edit) "The call to poll is necessary because poll is ... what" added "(among many other things)" |
10:39:59 | FromDiscord | <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:12 | FromDiscord | <Phil> (edit) "hack.↵This" => "hack and removing that for higher nim versions.↵This" |
10:41:18 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:41:29 | FromDiscord | <Phil> (edit) |
10:42:28 | FromDiscord | <Phil> with the same error |
10:43:53 | FromDiscord | <Phil> Nor do I wish to force them to use devel... again |
10:44:49 | FromDiscord | <ringabout> `proc =destroy(hub: var ChannelHub)` still works, though |
10:45:03 | FromDiscord | <ringabout> See also https://forum.nim-lang.org/t/10642 |
10:45:25 | FromDiscord | <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:23 | FromDiscord | <Phil> Oh threading also has a taskpool thingy? |
10:46:36 | FromDiscord | <Phil> Huh, might add support for that if I can make it work |
10:47:24 | FromDiscord | <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:08 | FromDiscord | <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:10 | FromDiscord | <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:28 | FromDiscord | <Phil> what is the module called that you're looking at? |
10:48:32 | FromDiscord | <Phil> or docs to it |
10:49:15 | FromDiscord | <Phil> Hmmm can't seem to find a taskpool module |
10:49:25 | FromDiscord | <Phil> or threadpool module |
10:49:31 | FromDiscord | <pptx704> Was using this- https://nim-lang.org/docs/threadpool.html |
10:49:34 | FromDiscord | <odexine> https://nim-lang.org/docs/threadpool.html |
10:49:37 | FromDiscord | <Phil> Ohhhhh wait, you were talking about std/threadpool, not https://github.com/nim-lang/threading |
10:49:54 | FromDiscord | <pptx704> In reply to @isofruit "Ohhhhh wait, you were": Yeah |
10:50:52 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
10:51:08 | FromDiscord | <Phil> Depending on what type of parallelism you're looking for malebolgia might be the easiest way to go about it imo |
10:54:11 | FromDiscord | <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:00 | FromDiscord | <odexine> Threading is unlikely to help |
10:55:02 | FromDiscord | <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:35 | FromDiscord | <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:06 | FromDiscord | <odexine> In reply to @isofruit "Not that I'm hyper": If that were the case then async would help as well |
10:58:33 | FromDiscord | <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:42 | FromDiscord | <odexine> The network |
10:58:52 | FromDiscord | <Phil> is nsloopup network? |
10:58:59 | FromDiscord | <Phil> (edit) "nsloopup" => "nslookup" |
10:59:00 | FromDiscord | <pptx704> Yeah |
10:59:08 | FromDiscord | <pptx704> It checks for some server hostname |
10:59:39 | FromDiscord | <Phil> In that case that seems like a... network card hardware limitation (?) |
10:59:42 | FromDiscord | <pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:00:22 | FromDiscord | <odexine> Well the problem here is that exec whatever whatever isnt async in the firdt place |
11:01:09 | FromDiscord | <pptx704> In reply to @odexine "Well the problem here": One of the reasons I am thinking that threading will help |
11:01:36 | FromDiscord | <odexine> In this case it will but you will encounter problems as well |
11:01:42 | FromDiscord | <odexine> Might now be worth it |
11:02:07 | FromDiscord | <Phil> Is nslookup bindable and callable from nim directly maybe? |
11:02:14 | FromDiscord | <Phil> Without having to go through the shell |
11:02:16 | FromDiscord | <odexine> Likely is |
11:02:29 | FromDiscord | <Phil> I know readLine is thus the association |
11:02:47 | FromDiscord | <pptx704> In reply to @isofruit "Is nslookup bindable and": How is that? |
11:03:08 | FromDiscord | <odexine> Using the C library, but that still has the problem of not being async |
11:03:10 | FromDiscord | <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:43 | FromDiscord | <pptx704> In reply to @isofruit "Nim transpiles to C": I get that. But how to implement that? Maybe some docs? |
11:03:43 | FromDiscord | <odexine> It’s not very fun trying to make a binding async |
11:04:11 | FromDiscord | <Phil> And yeah, what Rika stated.↵But you could use threads with a taskpool (or use createThread directly) |
11:05:10 | FromDiscord | <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:34 | FromDiscord | <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:42 | FromDiscord | <Phil> In that case spawning new threads and having the waiting be done in there seems like the way to go. |
11:05:50 | FromDiscord | <Phil> In reply to @pptx704 "I did use createThread": In those cases you make yourself a wrapper type basically |
11:05:58 | FromDiscord | <Phil> Or a tuple |
11:06:03 | FromDiscord | <pptx704> In reply to @isofruit "Hmm based on what": Probably will try malbolgia and see what happens |
11:06:04 | FromDiscord | <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:22 | FromDiscord | <odexine> Though yes it would be even harder if it didn’t have an async version |
11:06:22 | FromDiscord | <Phil> Right, different async-queue |
11:06:40 | FromDiscord | <Phil> Or is it even called async-queue? |
11:06:46 | FromDiscord | <odexine> Event queue |
11:06:48 | FromDiscord | <Phil> We call that thing dispatcher and that confuses the shit out of me |
11:06:56 | FromDiscord | <Phil> Check |
11:07:12 | FromDiscord | <pptx704> In reply to @isofruit "We call that thing": U mean `asyncdispatch`? |
11:07:22 | FromDiscord | <odexine> Technically Nim async ultimately uses C (or more accurately OS) async utilities |
11:08:27 | FromDiscord | <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:35 | FromDiscord | <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:23 | FromDiscord | <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:41 | FromDiscord | <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:57 | FromDiscord | <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:21 | FromDiscord | <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:38 | FromDiscord | <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:46 | FromDiscord | <odexine> Why can’t you await anywhere? Technically you can, it just won’t be where you expect to |
11:11:10 | FromDiscord | <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:14 | FromDiscord | <Phil> In reply to @pptx704 "Really loving working with": Nimpy will help in those cases |
11:11:16 | FromDiscord | <odexine> So you have to do it in between |
11:11:24 | FromDiscord | <odexine> But you can’t since it’s a function l you didn’t make |
11:12:06 | FromDiscord | <pptx704> In reply to @odexine "But you can’t since": Yeah makes sense |
11:12:25 | FromDiscord | <pptx704> In reply to @isofruit "Nimpy will help in": Haven't explored it yet |
11:13:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:16:24 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:17:34 | FromDiscord | <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:52 | FromDiscord | <Phil> @ringabout Can I suppress a warning for just one specific line of code? |
11:21:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:24:42 | FromDiscord | <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:48 | FromDiscord | <Phil> (edit) "our." => "out." |
11:33:49 | FromDiscord | <Phil> Welp, still breaks because destructor call blows up somehow =/ |
11:35:15 | FromDiscord | <Phil> Wait wtf, this is dying inside the new call somehow |
11:38:00 | FromDiscord | <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:33 | FromDiscord | <ieltan> In reply to @isofruit "Welp, still breaks because": check for nil ? |
12:35:56 | FromDiscord | <Phil> I think this may be a bigger refactor than assumed |
12:36:27 | FromDiscord | <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:55 | FromDiscord | <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:06 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:21:38 | FromDiscord | <fowl.mouth> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:29:20 | FromDiscord | <sOkam! 🫐> In reply to @fowl.mouth "What are these dots": nvim copy/paste, sorry. didn't notice |
16:30:29 | FromDiscord | <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:17 | FromDiscord | <sOkam! 🫐> In reply to @fowl.mouth "What are these dots": that was it. ty for noticing! |
17:02:03 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:12:58 | FromDiscord | <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:46 | FromDiscord | <9ih> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:35:21 | FromDiscord | <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:39 | FromDiscord | <9ih> in relation to returning a ref object |
18:35:49 | FromDiscord | <9ih> (edit) "in relation to returning a ref object ... " added "and I see `new(result)` around too" |
18:41:33 | FromDiscord | <griffith1deadly> In reply to @9ih "also; I can't find": owned deprecated as i remember |
18:41:59 | FromDiscord | <9ih> oh okay interesting |
18:42:11 | FromDiscord | <huantian> Yep I don’t think it does anything |
19:14:17 | Amun-Ra | owned deprecated? at least not in 2.0 |
19:40:52 | FromDiscord | <bostonboston> I don't think owned is deprecated but it is abandoned and replaced play lent/isolate if I remember |
19:41:21 | FromDiscord | <bostonboston> replaced with |
20:37:23 | * | derpydoo joined #nim |
21:05:57 | FromDiscord | <Elegantbeef> @9ih yes `MilkShake` is a non ref object |
21:06:32 | FromDiscord | <Elegantbeef> @Phil wait if each thread had it's own channelhub how did they even communicate to eachother? |
21:06:56 | FromDiscord | <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:03 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> Oh... that's odd |
21:08:32 | FromDiscord | <Elegantbeef> If you wanted to cheese the destructor in add a `Atomic` `=copy` increments it and `=destroy` decrements it |
21:08:48 | FromDiscord | <Elegantbeef> When it reaches `0` you actually do destruction |
21:08:59 | FromDiscord | <Elegantbeef> Nvm that will not work |
21:09:08 | FromDiscord | <Elegantbeef> It'd need to be a `ptr Atomic[int]` |
21:09:20 | FromDiscord | <Phil> Honestly it's not like I planned it that way |
21:09:30 | FromDiscord | <Phil> I originally had it as a ref object precisely because of that mental model 😛 |
21:10:10 | FromDiscord | <Elegantbeef> Well move it towards a `ptr ChannelHub` and use`ref ChannelHub` on the owning thread |
21:10:11 | FromDiscord | <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:30 | FromDiscord | <Elegantbeef> I also said pass it as `ptr ChannelHub` |
21:10:45 | FromDiscord | <Elegantbeef> So you disregarded the important talk 😄 |
21:11:00 | FromDiscord | <Elegantbeef> Hence 'deref twice' |
21:11:07 | FromDiscord | <Elegantbeef> I didnt say "You have to deref it!" 😛 |
21:12:15 | FromDiscord | <Elegantbeef> Anyway just pointer indirect it once using `ref` or `ptr` then pass that to the other threads as `ptr ChannelHub` |
21:12:31 | FromDiscord | <Elegantbeef> Ideally `ref` on the main thread |
21:12:46 | FromDiscord | <Elegantbeef> So you do not need to make a `distinct ChannelHub` and ref count |
21:13:05 | FromDiscord | <Elegantbeef> Or you can disregard this all and just keep the manual `destroy` |
21:13:13 | FromDiscord | <Elegantbeef> Assuming you properly handle `Chan[T]` now |
21:13:41 | FromDiscord | <Phil> I do, that one is valid either way regardless of destruction strategy |
21:14:06 | FromDiscord | <Phil> Meaning it's always an improvement to add calls to the =destroy hook for the channel/chan instances |
21:14:39 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> No clue, I just don't like playing compiler 😄 |
21:22:40 | FromDiscord | <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:51 | FromDiscord | <pptx704> (edit) "explain" => "help" | "helpme ... the" added "with" |
21:22:58 | FromDiscord | <Phil> In reply to @pptx704 "<@180601887916163073> I was trying": Is that an actual compilation error or just nimsuggest? |
21:23:08 | FromDiscord | <pptx704> Actual error |
21:23:11 | FromDiscord | <Elegantbeef> We do not do tooling messages here |
21:23:19 | FromDiscord | <Elegantbeef> Compile the code and paste the actual error message |
21:23:49 | FromDiscord | <pptx704> https://media.discordapp.net/attachments/371759389889003532/1188955281560981596/image.png?ex=659c67e4&is=6589f2e4&hm=c5b30530bfd45fca446a2bc834abfd1dee8391a545ccb0798211d9f876ac29d8& |
21:23:51 | FromDiscord | <pptx704> You mean this one? |
21:24:04 | FromDiscord | <Elegantbeef> It's not a call |
21:24:13 | FromDiscord | <Elegantbeef> `getVHost(...)` |
21:24:32 | FromDiscord | <Phil> getVHost doesn't eat a proc, it eats an object |
21:24:53 | FromDiscord | <Phil> Actually no, wait |
21:25:11 | FromDiscord | <Phil> God damn Araq, this is why we assert our inputs and provide more helpful error messages |
21:25:12 | FromDiscord | <pptx704> The example code in the docs, eats an object tho |
21:25:24 | FromDiscord | <Phil> (edit) "God damn ... Araq," added "it" |
21:25:26 | FromDiscord | <Elegantbeef> Phil it does not even get into the macro |
21:25:40 | FromDiscord | <Elegantbeef> It's a macro with a pattern constraint |
21:26:00 | FromDiscord | <Elegantbeef> In otherwords `toTask` errors if it gets anything that's not `{nkCall,....}` |
21:26:13 | FromDiscord | <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:27 | FromDiscord | <Elegantbeef> Just learn to read 😛 |
21:26:30 | FromDiscord | <Phil> I'd find it useful internally to tell me the dev that I did a bad |
21:26:39 | FromDiscord | <Phil> I'd never want the user to see that |
21:26:47 | FromDiscord | <Elegantbeef> It's pretty useful in some cases but this is not a case I'd use it |
21:26:51 | FromDiscord | <Phil> Users should not be required to know how macros work |
21:27:01 | FromDiscord | <Elegantbeef> This isnt even a macro thing btw |
21:27:07 | FromDiscord | <Elegantbeef> You can use that matching on procs aswell |
21:27:34 | FromDiscord | <pptx704> I am clueless atp |
21:27:36 | FromDiscord | <pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:27:37 | FromDiscord | <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:43 | FromDiscord | <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:47 | FromDiscord | <pptx704> This is the code. What change should I make here? |
21:27:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:27:52 | FromDiscord | <Elegantbeef> It does not work on Nimnodes Phil |
21:28:08 | FromDiscord | <Elegantbeef> It constrains callables to only work on specific AST |
21:28:39 | FromDiscord | <Elegantbeef> Notice that it's `nkName` and not `nnkName` |
21:28:54 | FromDiscord | <Elegantbeef> `nkName` is the actual PNode kind whereas `nnkName` is the NimNode kind |
21:29:28 | FromDiscord | <Elegantbeef> pptx please provide a runnable example with imports |
21:29:42 | FromDiscord | <pptx704> Just a min |
21:29:48 | FromDiscord | <Elegantbeef> Thank yo |
21:30:47 | FromDiscord | <albassort> is there a good tool for moddeling cycles |
21:30:53 | FromDiscord | <albassort> like |
21:31:01 | FromDiscord | <pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:31:03 | FromDiscord | <pptx704> This should work |
21:31:09 | FromDiscord | <albassort> im programming a game cycle and i gotta fidget with the numbers |
21:31:23 | FromDiscord | <pptx704> By work, I mean it will throw error |
21:36:45 | FromDiscord | <Elegantbeef> Shouldn't that be `getVHost(i)`? |
21:37:12 | FromDiscord | <Elegantbeef> `getVHost` is just a procedure |
21:37:47 | FromDiscord | <pptx704> God I am so dumb |
21:37:49 | FromDiscord | <pptx704> urghh |
21:38:03 | FromDiscord | <Elegantbeef> Hey I said it earlier 😛 |
21:40:27 | FromDiscord | <pptx704> Thanks |
21:40:29 | FromDiscord | <pptx704> Anyways |
21:40:35 | FromDiscord | <pptx704> Not this procedure is taking forever |
21:40:53 | FromDiscord | <pptx704> I mean the `getVHostTable` proc |
21:41:15 | FromDiscord | <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:56 | FromDiscord | <pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:42:48 | FromDiscord | <Elegantbeef> It's more meant to be used with pattern matching macros, but it also works generally |
21:42:49 | FromDiscord | <Elegantbeef> "taking more than" meaning what |
21:43:38 | FromDiscord | <Elegantbeef> @albassort what do you mean for "modelling cycles"? |
21:50:16 | * | jmdaemon joined #nim |
21:50:19 | FromDiscord | <Phil> In reply to @Elegantbeef ""taking more than" meaning": Likely means "taking longer to compute than" |
21:50:30 | FromDiscord | <Phil> or "taking longer to finish executing" |
21:52:02 | FromDiscord | <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:08 | FromDiscord | <pptx704> It just gets stuck |
21:52:46 | FromDiscord | <Elegantbeef> Context switching is likely killing your process as it's not a thread blocked program it's a IO blocked program |
21:53:13 | FromDiscord | <Elegantbeef> I have no clue how many ips your checking for though |
21:53:15 | FromDiscord | <Elegantbeef> I assume it's a fair bit |
21:53:49 | FromDiscord | <pptx704> 50 in total |
21:54:28 | FromDiscord | <pptx704> In reply to @Elegantbeef "Context switching is likely": apparently, asyncdispatch doesn't work either |
21:55:47 | FromDiscord | <pptx704> Now I am really confused on how to speed it up |
21:55:58 | FromDiscord | <pptx704> Because for some cases, it might be 100s of ips |
21:56:24 | FromDiscord | <pptx704> without some sort of parallelism, the program wouldn't be very effective |
21:56:46 | FromDiscord | <Elegantbeef> `getAddrInfo` would be faster |
21:57:46 | FromDiscord | <pptx704> from `std/nativesockets`? |
21:57:52 | FromDiscord | <Elegantbeef> Yes |
21:58:03 | FromDiscord | <Elegantbeef> Why use shell when you can use the actual procedures |
21:58:24 | FromDiscord | <pptx704> I didn't know such thing existed until just now |
22:00:13 | FromDiscord | <Elegantbeef> If you are shelling out it's generally the 'wrong' thing to do |
22:03:09 | FromDiscord | <pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:03:21 | FromDiscord | <pptx704> (edit) |
22:07:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:07:49 | FromDiscord | <Elegantbeef> Atleast we're assuming it's `443` as it's https |
22:08:51 | FromDiscord | <pptx704> Mhmmm. Let me try that |
22:14:53 | FromDiscord | <pptx704> Nope. Not exactly what I want |
22:14:55 | FromDiscord | <pptx704> https://media.discordapp.net/attachments/371759389889003532/1188968138797232269/image.png?ex=659c73de&is=6589fede&hm=5edc611ef4a5394104c292a3ac14456cb444be76846d4a9380484d14ab40c95f& |
22:14:58 | FromDiscord | <pptx704> This is what I am getting |
22:15:16 | FromDiscord | <pptx704> Expecting something like this https://media.discordapp.net/attachments/371759389889003532/1188968230140776448/image.png?ex=659c73f4&is=6589fef4&hm=47a373235c2ce391abde5e3b257b623f35cc1d12c516600485e8741f6a1f46e9& |
22:15:17 | FromDiscord | <Elegantbeef> You have what and want what? |
22:16:11 | FromDiscord | <pptx704> I want something that works like this- https://www.nslookup.io/a-lookup/ |
22:17:18 | FromDiscord | <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:45 | FromDiscord | <Elegantbeef> Well if you want A records that requires a request afaik, but I do not know what one needs to request |
22:21:57 | FromDiscord | <Elegantbeef> Probably a usable DNS library in the nimble directory |
22:23:36 | FromDiscord | <sOkam! 🫐> how does nim implement enum arrays in the c backend? are they maps or hashtables? 🤔 |
22:23:42 | FromDiscord | <pptx704> In reply to @Elegantbeef "Well if you want": Probably. This is one of the reason I am using `nslookup` via shell |
22:23:45 | FromDiscord | <Elegantbeef> They're arrays |
22:24:25 | FromDiscord | <Elegantbeef> There is nothing special about enum arrays they're just `T[NumberOfEnumElements]` for contiguous arrays |
22:24:59 | FromDiscord | <Elegantbeef> contiguous enums\ |
22:25:03 | FromDiscord | <sOkam! 🫐> ah true, the size is actually known, didn't cross my mind |
22:25:20 | FromDiscord | <Elegantbeef> Since 99% of enums are contiguous and start at 0 there is not much more to them |
22:25:57 | FromDiscord | <Elegantbeef> For non zero starting you have to do `ord(ind) - ord(low)` for indexing |
22:26:38 | FromDiscord | <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:21 | FromDiscord | <sOkam! 🫐> makes sense |
22:28:51 | FromDiscord | <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:03 | FromDiscord | <sOkam! 🫐> is there an equivalent to `python -m http.server` in any of the http servers for nim? 🤔 |
22:54:01 | FromDiscord | <sOkam! 🫐> idea being to run the command on a folder and the tool opening a local server from its contents |
22:55:11 | FromDiscord | <Elegantbeef> httpd |
22:55:16 | FromDiscord | <Elegantbeef> nimhttpd i think is it's proper name |
23:07:44 | FromDiscord | <pptx704> Is `len(seq)` a O(1) operation? As in, is the length saved in some variable or is it calculated everytime? |
23:08:44 | FromDiscord | <jviega> It’s constant time yes |
23:08:53 | FromDiscord | <Elegantbeef> Nim seq and strings are pascal collections they store the length |
23:20:41 | FromDiscord | <sOkam! 🫐> found it, ty! |
23:20:41 | FromDiscord | <sOkam! 🫐> @ringabout do you happen to have a similar thing implemented with httpx laying around somewhere? |
23:20:50 | FromDiscord | <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:06 | FromDiscord | <albassort> i can implement it in nim before lua, that'd be easier |
23:21:19 | FromDiscord | <albassort> but a visual tool is what im looking for |
23:23:15 | FromDiscord | <pptx704> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:25:18 | FromDiscord | <Elegantbeef> What do you even mean |
23:25:24 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> just do `let a = someOtherFunc(a)` |
23:25:37 | FromDiscord | <Elegantbeef> If you want to shadow you shadow |
23:25:46 | FromDiscord | <Elegantbeef> If you do not want to shadow just give it a descriptive name |
23:26:34 | FromDiscord | <pptx704> makes sense |
23:28:24 | NimEventer | New thread by isaiah: Please who can help me with nim filter, see https://forum.nim-lang.org/t/10802 |
23:43:48 | FromDiscord | <ieltan> In reply to @NimEventer "New thread by isaiah:": unreadable... |
23:49:09 | FromDiscord | <Phil> It's RST, so much for that syntax being supported |
23:50:17 | FromDiscord | <Phil> I updated the post, seems to be about source code filters |