<< 20-12-2023 >>

00:20:14FromDiscord<christofur> @Phil do you have any idea about this: Hint: [Link]↵MachO Flush... error(link): unsupported cpu architecture 0x0↵error: UnsupportedCpuArchitecture
00:20:30FromDiscord<christofur> has anyone here compiled windows binaries on mac m2?
00:20:39FromDiscord<christofur> (edit) "has anyone here compiled ... windows" added "x64 or x86"
01:28:56*krux02 quit (Remote host closed the connection)
01:37:08FromDiscord<Elegantbeef> Also `zig targets | grep windows`
01:37:10FromDiscord<Elegantbeef> @christofur `zigcc --version`?
01:37:56FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
01:38:07FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
01:38:12FromDiscord<christofur> hmm.. target lol
01:38:32FromDiscord<christofur> but i should be able to target x86_64-windows-gnu , right
01:38:49FromDiscord<Elegantbeef> Right
01:38:55FromDiscord<Elegantbeef> How are you attempting to target windows?
01:39:07FromDiscord<christofur> i guess i dont know how
01:39:21FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
01:39:23FromDiscord<christofur> this is my compile script
01:39:25FromDiscord<christofur> let me see if theres a target
01:39:25FromDiscord<Elegantbeef> I mean what is your Nim command?
01:39:50FromDiscord<christofur> should cpu flag be the target then?
01:39:53FromDiscord<Elegantbeef> `--os:windows` should be used
01:39:55FromDiscord<christofur> ok
01:40:21FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
01:40:25FromDiscord<christofur> ok not bad, now im missing the headers
01:40:28FromDiscord<christofur> so it got further
01:43:18FromDiscord<Elegantbeef> Ah I got it!
01:43:27FromDiscord<christofur> ya nice dude
01:43:38FromDiscord<christofur> now i gotta figure out what to install to get these libs here
01:43:58FromDiscord<Elegantbeef> `--passC: "-target x86_64-windows" --passL: "-target x86_64-windows" --cpu:amd64 --os:windows`
01:44:01FromDiscord<Elegantbeef> You do not need anything
01:44:09FromDiscord<Elegantbeef> You need to tell zig to target windows
01:44:47FromDiscord<christofur> what is passC and passL
01:44:48FromDiscord<Elegantbeef> I'd also probably suggest making a `config.nims`
01:44:58FromDiscord<Elegantbeef> pass to C compiler and pass to Linker
01:45:03FromDiscord<christofur> ahh
01:45:13FromDiscord<christofur> Hint: [Link]↵error: UnknownOperatingSystem
01:45:42FromDiscord<christofur> no way ,i think that worked
01:45:50FromDiscord<Elegantbeef> should be `x86_64-windows-gnu` sorry 😄
01:45:59FromDiscord<christofur> ls↵client client.exe client.nim client.pdb compile.sh
01:46:11FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
01:46:12FromDiscord<christofur> amazing.
01:46:19FromDiscord<christofur> thank you
01:46:20FromDiscord<christofur> you're a g
01:47:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
01:47:10FromDiscord<Elegantbeef> Then you can just do `-d:windows` and build for windows
01:47:36FromDiscord<Elegantbeef> Do not recall if `--clang.linkerexe: "zigcc"` works
01:51:00FromDiscord<Elegantbeef> Actually that might not work.... hmmm
01:52:22FromDiscord<Elegantbeef> The above does work with `--os:windows` assuming you actually add `passL`
01:53:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
01:54:53FromDiscord<Elegantbeef> The real trick is to have wine installed so you can test your programs `nim c --os:windows -r ./input.nim` just works 😄
02:06:11FromDiscord<christofur> i have crossover
02:12:00FromDiscord<christofur> weird.. this works in my compile.sh
02:12:03FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
02:12:17FromDiscord<christofur> sent a long message, see <!doctype html>
02:12:25FromDiscord<christofur> (edit) "long message," => "code paste," | "<!doctype html> <html lang=en> <head> <meta charset=utf-8> <title>&nbsp;</title> </head> <style> body { font-family: monospace; margin: 2em; } </style> <body> <p>ix.io is taking a break &#127867;</p> <img src="/underconstruction.gif" width="200px"> </body> </html>" => "https://play.nim-lang.org/#ix=html>"
02:12:27FromDiscord<christofur> but that doesnt work
02:12:38FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
02:12:46FromDiscord<christofur> @ElegantBeef any ideas?
02:12:52FromDiscord<Elegantbeef> `nim c --os:windows ./input.nim`
02:14:52FromDiscord<christofur> failing to find the headers again.
02:19:28FromDiscord<christofur> arch -x86_64 /usr/local/Homebrew/bin/nim
02:19:31FromDiscord<christofur> definitely because of this
02:19:37FromDiscord<christofur> i had to put the x86 homebrew stuff in a separate path
02:29:44FromDiscord<Elegantbeef> Why do you have amd64 nim?
02:30:00FromDiscord<christofur> pardon?
02:30:26FromDiscord<christofur> i dunno it didnt end up working anyway
02:30:29FromDiscord<christofur> ill just clone this compile script
02:30:32FromDiscord<christofur> if i have to
02:32:50FromDiscord<Elegantbeef> you have x86\_64 nim on a m2
02:33:54FromDiscord<christofur> ya i dunno
02:33:57FromDiscord<christofur> why not
02:34:03FromDiscord<christofur> i have both actually
02:34:32FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
02:34:47FromDiscord<Elegantbeef> So your zig is amd or arm?
02:35:48FromDiscord<christofur> sent a code paste, see https://play.nim-lang.org/#ix=html>
02:35:56FromDiscord<christofur> hmm. i guess that settles it then, should just be arm64 across the board
02:57:58FromDiscord<nasuray> You have to set the --os switch from the command line https://forum.nim-lang.org/t/3939#24571
03:04:32FromDiscord<nasuray> Not to shill my own software too hard but did you try with `forge` it should set these extra flags for you making the command simply `forge cc --target=x86_64-windows-gnu -- client.nim` plus whatever other flags you want to pass on to `nim c`.
03:07:56FromDiscord<christofur> hmm seems like even with app:gui the console window is still showing
03:07:57FromDiscord<christofur> sent a long message, see <!doctype html>
03:08:08FromDiscord<christofur> In reply to @nasuray "Not to shill my": havent tried
03:16:00*azimut joined #nim
03:41:25*edr quit (Quit: Leaving)
04:07:31*derpydoo quit (Ping timeout: 255 seconds)
04:38:20NimEventerNew Nimble package! ccal - calendar with local holidays via ip location, see https://github.com/inv2004/ccal
05:09:37FromDiscord<MDuardo> sent a code paste, see https://play.nim-lang.org/#ix=html>
05:16:40FromDiscord<intellij_gamer> sent a code paste, see https://play.nim-lang.org/#ix=html>
05:19:58FromDiscord<Elegantbeef> Or use `formatFloat` inside `std/strutils`
05:48:28NimEventerNew Nimble package! implot - Nim binding for ImPlot (CImPlot/ImGui/CImGui), see https://github.com/dinau/nim_implot
06:02:16NimEventerNew thread by JiyaHana: Enhancing Nim vtable implementation vs subtype checking, see https://forum.nim-lang.org/t/10787
07:00:20*advesperacit joined #nim
08:16:56*PMunch joined #nim
09:36:38*hapisnake joined #nim
09:43:40*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
09:44:10*antranigv joined #nim
09:57:11*hapisnake quit (Quit: Client closed)
09:57:22*hapisnake joined #nim
09:58:44*hapisnake quit (Client Quit)
10:02:36*PMunch quit (Read error: Connection reset by peer)
10:02:37*PMunch_ joined #nim
10:06:00*FromDiscord quit (Ping timeout: 252 seconds)
10:06:17*FromDiscord joined #nim
10:35:33*koltrast quit (Quit: ZNC - http://znc.in)
11:43:47*krux02 joined #nim
11:58:33*krux02 quit (Remote host closed the connection)
12:09:39*jmdaemon joined #nim
12:12:36*PMunch_ is now known as PMunch
12:52:38FromDiscord<Phil (he/him)> Question, what is the concept behind an AsyncChannel that isn't already performed by trySend and tryRecv on normal channels?
12:52:56FromDiscord<Phil (he/him)> I want to wrap my head around what makes it so different and something to strive for
12:58:09PMunchMostly just that it integrates with the async system so that they can be awaited
12:58:27PMunchi.e. it's easier to combine
12:58:32FromDiscord<michaelb.eth> await parks on recv , so you can concurrently wait on the next message to arrive while you also process e.g. the chunks of an http reaponse
12:58:45FromDiscord<michaelb.eth> (edit) "reaponse" => "response"
12:58:51FromDiscord<Phil (he/him)> Hmm fair.↵↵In threadButler you could do something, but not with as elegant syntax
12:59:04FromDiscord<Phil (he/him)> Since in ThreadButler you can annotate a handler with async and do asyncsleeps
12:59:19FromDiscord<Phil (he/him)> Basically while trySend()\: asyncSleep(100) or sth
12:59:32PMunchYeah, that adds the small latency hit of 100ms though
13:00:01PMunchWith a true async channel they would use selectors and do proper OS sleep while waiting for the channel
13:00:11FromDiscord<Phil (he/him)> I mean yeah, but that's just exemplaric, at a low enough level the latency doesn't matter
13:00:22FromDiscord<Phil (he/him)> Fair
13:00:59FromDiscord<Phil (he/him)> So it would be 1) more elegant syntax (since you can just await trySend()) and 2) more efficient since that part of the code consumes less energy than if it were in a while-loop
13:38:13*derpydoo joined #nim
14:58:28FromDiscord<xtrayambak> How can I convert an `uint8` into a sequence of bytes?
15:00:54FromDiscord<bostonboston> A singular uint8?
15:00:59FromDiscord<xtrayambak> yeah
15:01:30PMunchThat would be a sequence of a single byte..
15:01:40PMunchAre you sure you don't have a pointer to a uint_8?
15:01:45FromDiscord<xtrayambak> wait, ah
15:01:54PMunchWhich is the C way of saying an array
15:01:58FromDiscord<xtrayambak> are all unsigned primitives just one byte?
15:02:09PMunchNo, all 8-bit values are a single byte
15:02:21FromDiscord<xtrayambak> ah, I forgot that
15:02:22PMunchConsidering that's the definition of a byte..
15:02:33FromDiscord<xtrayambak> So that's good, but what about something like `uint32`?
15:02:40PMunchThat's four bytes
15:02:59PMunch`cast[array[4, uint8]](myUint32)`
15:03:07FromDiscord<xtrayambak> alright, thanks
15:03:16PMunchOr if that fails: `cast[ptr array[4, uint8]](myUint32.addr)[]`
15:03:42PMunchYou can't cast them to a sequence, but you can convert that array to one
15:04:06FromDiscord<xtrayambak> so, I cast that to an array, then I cast THAT to a sequence?
15:04:20FromDiscord<odexine> you cannot cast it into a sequence
15:04:34FromDiscord<xtrayambak> yeah, I guess I gotta fill the sequence manually, then?
15:04:35FromDiscord<odexine> you will need to copy the bytes into an empty seq if you wanted a sequence
15:04:55PMunchYou cast it into an array, then you convert that into a sequence
15:05:12FromDiscord<xtrayambak> alright
15:05:14FromDiscord<odexine> oh yeah
15:05:17FromDiscord<xtrayambak> thanks
15:05:18FromDiscord<odexine> @ exists
15:06:45FromDiscord<xtrayambak> In reply to @PMunch "`cast[array[4, uint8]](myUint32)`": wait, so it gets turned into a `uint8` first. Is it okay if I just put in `byte` instead of that?
15:07:14FromDiscord<odexine> byte is an alias for uint8 iirc? or similar ot
15:07:24FromDiscord<xtrayambak> probably, considering they're basically the same thing
15:07:31FromDiscord<odexine> https://nim-lang.org/docs/system.html#byte
15:09:27FromDiscord<xtrayambak> so, it's not marked as `distinct`?
15:14:19FromDiscord<odexine> doesnt seem so no
15:24:18PMunchYeah you can put any 8-bit entity in there
15:24:48PMunchSo uint8, char, byte, some enums, tiny objects, tiny tuples, pointers on very strange architectures, etc.
15:28:09PMunchFor example: https://paste.rs/TKl4t.txt
15:33:36FromDiscord<bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=html>
15:45:48*PMunch quit (Quit: Leaving)
16:01:11NimEventerNew thread by coneonthefloor: Sitemap Parser, see https://forum.nim-lang.org/t/10790
16:06:25FromDiscord<alireza0x0> guys
16:06:33FromDiscord<alireza0x0> why this segfaults with usemalloc? https://media.discordapp.net/attachments/371759389889003532/1187063500560932884/image.png?ex=65958609&is=65831109&hm=4f4900cc64c3b166d76c5a16bf9f84f942a96399e4ebbe071bbf5898e7b58ea9&
16:06:57FromDiscord<alireza0x0> am i doing something wrong?
16:07:35FromDiscord<alireza0x0> btw when i add quit() at the end my self it wont crash...
16:08:37FromDiscord<alireza0x0> and this crash only happens with usemalloc
16:16:38FromDiscord<alireza0x0> probably should ask this on internals...
16:27:29FromDiscord<yohgzcas> 1000000192.jpg https://media.discordapp.net/attachments/371759389889003532/1187068765070958682/1000000192.jpg?ex=65958af0&is=658315f0&hm=4d0115f40f024006177902adfec94a480fa8f774cb30239e72adfbd2d3e6a2fd&
16:58:18FromDiscord<graveflo> <@&371760044473319454>
17:04:17FromDiscord<pmunch> Sounds like a bug
17:16:15FromDiscord<niontrix (Tobias Heinlein)> Hi folks! Is someone here using nimlangserver with Emacs-LSP who could help me getting .dir-locals.el to work for the nim.projectMapping setting?
17:31:08*junaid_ joined #nim
17:35:21FromDiscord<Clonkk> I think Vindaar uses emacs
17:42:10FromDiscord<vindaar> I do, but I've never used LSP, so not sure if I can be of any help
17:49:11FromDiscord<niontrix (Tobias Heinlein)> The problem seems to be that LSP mode defines a `lsp-nim-project-mapping` variable that is sent to nimlangserver for configuration. This variable is globally defines as []. Now, when I set this variable in .dir-locals.el it gets loaded, but it seems to be overwritten by the globally empty value. So, .dir-locals.el is kinda useless if it can just define buffer local variables.
18:26:09FromDiscord<niontrix (Tobias Heinlein)> Also I don't get how the nimlangserver configuration works. Even if I set `lsp-nim-project-mapping` globally and verify that it is sent correctly to the language server, I always get the error message that nim.projectMapping needs to be configured or the file I am editing needs to be imported to be recognized.
18:37:43*azimut quit (Ping timeout: 240 seconds)
18:46:29FromDiscord<graveflo> did you use `nimble init` to start off?
18:46:55FromDiscord<niontrix (Tobias Heinlein)> Yes I did
18:47:47FromDiscord<graveflo> maybe try and make sure the CWD of the lsp process is set to the project dir?
18:48:18FromDiscord<niontrix (Tobias Heinlein)> I create a module with the name of the package and in there nimlangserver works. But then I created another module that I have not imported in the first one and nimlangserver always complains about the configuration and does not provide any completions.
18:48:23FromDiscord<niontrix (Tobias Heinlein)> How can I check that\`↵(@graveflo)
18:48:54FromDiscord<niontrix (Tobias Heinlein)> I think that might be the problem, because I tried the configuration using an absolute path and it seemed to work.
18:48:56FromDiscord<graveflo> oh also make sure that the file you are editing is imported by the main module of the proejct. I had that issue too a while ago
18:51:54FromDiscord<Phil> I think it just clicked about the entire threadpool thing.↵I mean, I still don't have the syntax, but the way to look at it.↵My hangup was regarding the thread as this static entity as opposed to regarding the channel as the static entity that whatever amount of threads just fetch work from
18:52:15FromDiscord<graveflo> In reply to @niontrix (Tobias Heinlein) "I create a module": right, yea I remember having that issue when I was using the lang server. I think that is just a limitation of the lang server setup. I don't see why it must be this way but I guess no one has decided to try and fix it. I think you are just going to have to import them
18:53:26FromDiscord<niontrix (Tobias Heinlein)> yes that is what it complains about. but those two modules are separate. i don't want to import it just to get lsp to work
18:53:35FromDiscord<niontrix (Tobias Heinlein)> but the strange thing is that this same language server works without further configuration when i use vscode
18:53:37FromDiscord<niontrix (Tobias Heinlein)> in the same project
18:53:50FromDiscord<niontrix (Tobias Heinlein)> how could i check the CWD that lsp is using to start the server?
18:54:45FromDiscord<Phil> Zoom : Doesn't a threadpool run the risk of message overflow into the channel to the threadpool as opposed to the model of "Spawn a thread for a task and then forget about it?"↵Well... I guess that also runs into the risk of message overflow but for the return message ...
18:56:06*junaid_ quit (Remote host closed the connection)
18:56:34FromDiscord<Phil> Hmmm I guess I should change my design to be not "1 Thread per ThreadName" and more "1 Threadpool per ThreadName".↵Or just define 1 Server as a Threadpool, you can define routes to a "server" and everything in the end is just a task-queue going into the threadpool dealing with stuff
18:56:35FromDiscord<graveflo> In reply to @niontrix (Tobias Heinlein) "how could i check": it would prob be in the lang server settings of emacs or whatever editor you are using. I don't have issues like that in vscode using nimsuggest (not the lsp). Purhaps you are trying to edit two different nimble packages on the same instance of the lsp? It may be that you need to adjust your nimble config requirements if there is a dependency, or run seperate instances of the
18:57:07FromDiscord<graveflo> also I think the langserver CWD is ruled out as a culprit or fix for this. fyi
18:57:41FromDiscord<Phil> ... Rika
18:58:19FromDiscord<Zoom> Well, it's just a matter of who's keeping the data at any given moment. When you spawn lot's of threads, but you introduce more overhead from context switching and overall system load. If you just saturate you channel you don't, but you may block the sender thread. As far as I understand, it's you job to fine-tune the threadpool parameters for the expected load↵(@Phil)
18:58:36FromDiscord<Phil> Is Erlang basically a function accepting a message from a channel, doing its thing, then pumping when doing a function call its actually just pumping a message into the next channel and the language just hides the channels from you?
18:58:46FromDiscord<Phil> (edit) removed "pumping"
19:01:04FromDiscord<Phil> sent a long message, see <!doctype html>
19:03:21FromDiscord<Phil> To note, literally the only reason why my mind first went towards tools to facilitate the second approach was because that's the native equivalent to microservice architecture in webdev so I naturally thought in that direction.
19:03:46FromDiscord<Phil> And given my webdev roots I can't really trust my gutfeeling atm for judging those two approaches
19:03:56FromDiscord<Zoom> It depends on lots of tings. The problem domain, the expected load, the memory budget, how busy the channels are going to be.
19:04:21FromDiscord<Phil (he/him)> This is not a specific architecture, just if it at all can make sense to even provide tooling for
19:04:25FromDiscord<Phil (he/him)> \application architecture
19:06:39FromDiscord<Zoom> Channels are all just shared memory under the hood, so if you have lots of threads just peeking inside the channel trying to find some job to do between the messages that aren't even meant for them - means wasted cycles. But less threads and channels probably utilize the resources better if the message traffic is low enough.
19:07:43FromDiscord<Zoom> But I'm talking just theoretically, without any evidence to support it. Again, how big of a load we're talking about? If it's not much, I'd go for what's more convenient from the code structuring PoV.
19:11:31FromDiscord<Phil (he/him)> sent a long message, see <!doctype html>
19:15:23FromDiscord<Phil (he/him)> I guess using multiple channels can be benficial when you start using really large amounts of threads and waiting for the lock on the one channel that feeds all of them can become a bottleneck.But I feel like at that point you're writing code for some insane kind of task
19:18:26FromDiscord<Phil (he/him)> If my statement about switch case is confusing, I'm operating with the idea that I don't use pointers and type-cast somehow, but rather have one object-variant (generated) that covers all kinds messages and you deal with the various different kinds of messages via a (generated) routing proc containing a massive switch-case statement that calls a different proc based on the object-variants "kind"
19:19:36FromDiscord<Phil (he/him)> Aaaaaaand now it just clicked why doing this via inheritance and methods might be more efficient
19:20:27FromDiscord<Phil (he/him)> If that's possible
19:20:35FromDiscord<Zoom> I'd use object variants or some other means for tagging the tasks as a tool for finer granularity to keep the number of threads down. But decide on number of specific tasks you want to dedicate threads too and look at them asking yourself, how much do you gain/lose from a higher parallelization.
19:23:25FromDiscord<Zoom> It looks like you're trying to devise a smarter threadpool and at this point I can only recommend you start studying the literature and collecting cases. I'm not even half-through the McKenney book, this higher-overview stuff about orchestration is way over my head.
19:39:20FromDiscord<Phil (he/him)> I really just went at it with the designs used for parallelization in webdev and it was surprisingly easy to code down.As for dumber approaches - Because they don't (well, maybe "didn't", I'd need to re-examine that) seem dumber, but abstract enough to not make any sense to me.
19:39:20FromDiscord<Phil (he/him)> \which likely sends message back
19:39:23FromDiscord<Phil (he/him)> I'll need to think this through and then re-examine weave.↵Really what I just want is non-blocking message passing.↵The vast majority of the usecases likely can just be "Pump message to channel, let threadpool eat message from channel and do thing"
19:39:25FromDiscord<Zoom> I say, make a prototype with the dumbest approach available, see where the congestion/under-utilization appears and iterate.
19:39:25FromDiscord<Phil (he/him)> I just want a mechanism of task-routing. Where I can explicitly define "These are the kinds of tasks available (represented by the kinds of messages you can send) for the threadpool. These are the kinds of tasks available (represented by the kind of messages you can send) for the single lonesome GUI-Thread. Now with that specifically defined, go ham you two"
19:39:26FromDiscord<niontrix (Tobias Heinlein)> @graveflo\: I think it might be a bug in nimlangserver, because I can see that the server failes to parse the configuration. And there is already a new issue on the github issue tracker. So let's see if it will be fixed.
19:39:29FromDiscord<Phil (he/him)> I already have examples for the previous approach and everything in fact, that one is just not with the idea of a threadpool. Instead it's just a single thread per channel
19:39:31FromDiscord<Phil (he/him)> And given that I feel like I'm treading very generalized multithread waters now as I'm starting to understand the ideas and approaches more, I'm now more wandering if instead of having my own single threads I can somehow just use this as an abstraction over weave or nim-taskpools.↵↵I'd need to understand how the hell they work first and if they even support this I guess
19:39:33FromDiscord<Phil (he/him)> And given that I feel like I'm treading very generalized multithread waters now as I'm starting to understand the ideas and approaches more, I'm now more wandering if instead of having my own single threads I can somehow turn this more into an abstraction over weave or nim-taskpools.↵↵I'd need to understand how the hell they work first and if they even support this I guess
19:39:34FromDiscord<Phil (he/him)> (niontrix, the bridge is dead, your message hasn't reached graveflo who is on discord)
19:39:36FromDiscord<niontrix (Tobias Heinlein)> How would I know?
19:39:38FromDiscord<Phil (he/him)> That he's on discord? You pretty much can't.↵I do because I primarily use discord... though the gtk matrix client fractal has started winning me over for general chatting...
19:39:38FromDiscord<niontrix (Tobias Heinlein)> And how do you know the bridge is dead?
19:39:40FromDiscord<Phil (he/him)> Because I have both clients open and the last message is Zoom's to me about the McKenny book
19:39:42FromDiscord<niontrix (Tobias Heinlein)> 😅 ok, makes sense 😄
19:41:16FromDiscord<Zoom> If we're talking about a GUI thread, and thus about MPSC configuration, I'd worry about other things. The GUI thread will block sooner or later, and you don't want to keep sending tasks into the overloaded channel by that point. Problems of task cancellation and timeouts are much more upfront, I think.
19:45:14FromDiscord<Phil (he/him)> sent a long message, see <!doctype html>
19:47:32FromDiscord<Phil (he/him)> Nevermind, neither do, you're supposed to roll your own via cancellation token parameters, oof
19:49:54FromDiscord<Zoom> BTW, if you find any books/serious reading material on the topic, do tell me. I'd like some overview of different approaches to scheduling, thread/task orchestration an such. But most of the literature I find is on slightly different topics (async, hpc, scalability, etc.).
19:50:16FromDiscord<Zoom> Something a little bit more approachable than whitepapers
19:50:59FromDiscord<Zoom> Research materials Mamy collects scare the hell out of my tiny brain
19:53:08FromDiscord<Phil (he/him)> sent a long message, see <!doctype html>
19:53:16FromDiscord<Phil (he/him)> That's all I got at this point
19:55:58FromDiscord<Phil (he/him)> The latter is basically just a JS Single-Page-Application talking to a Webserver in the backend.
19:57:33FromDiscord<Phil (he/him)> And looking at it right now it really feels like you can club to death most problems by at some point spawning a Channel that you pump messages into from your "Main-Thread" and putting a threadpool behind it that works through that.
20:00:22FromDiscord<Phil (he/him)> Regarding thread cancellation, I keep thinking about it and I'm stuck with that I really don't think you can unless you implement a ping-pong protocol to monitor your own threadpool that autokills if a ping does not receive a pong after x ms.↵Assuming you can kill a thread you spawned somehow
20:02:32FromDiscord<Zoom> It the very least you have to deal with unscheduled tasks first if they time out. At the pool level
20:03:05FromDiscord<Zoom> You don't want killing your gui thread \:D
20:03:26FromDiscord<Phil (he/him)> I mean yeah but the GUI thread would not be part of the threadpool that would potentially get sniped ^^
20:04:15FromDiscord<Phil (he/him)> At least I'm not thinking in those terms yet, that may be incorrect.↵Right now I'm more thinking on "1 dedicated thread only for GUI loop + a Threadpool for everything the GUI thread decides to outsource"
20:24:59FromDiscord<Phil (he/him)> sent a code paste, see https://play.nim-lang.org/#ix=html>
20:25:41FromDiscord<Phil (he/him)> And if I can wrap my head enough around flowvars for my purposes without blocking that while-loop then maybe even ditching CHannels
20:30:27FromDiscord<Elegantbeef> FlowVars are futures of the threading world
20:30:33FromDiscord<Elegantbeef> If you do not want to block you just check if they're ready
20:35:40FromDiscord<Phil> Yeah, it's more a matter of me wanting to keep the while loop running and the next iteration of the while-loop I might not have the variables of the flowvars around or sth.↵Or rather I'd need to store them in a queue that survives throughout while-loop iterations.↵At which point I feel like I'm back at channels
20:38:40FromDiscord<Elegantbeef> Well it's not exactly a channel, but close enough
20:39:24FromDiscord<Phil> I guess a seq of object variants containing flowvars would be the equivalent
20:39:48FromDiscord<Elegantbeef> A channel has you communicating both ways with threads, flowvars turns thread procs into returnable elements and communication is only done at the start
20:41:10FromDiscord<Phil> So say I collect a bunch of flowvars into a seq... well I guess it'd make sense every iteration of my while-loop to iterate over all flowvars, if they're ready I remove them from the seq, "await" them and trigger whatever response to the return of the flowvar is required
20:41:42FromDiscord<Phil> The question is more how to do that cleanly I guess...↵Or I just don't use Flowvars and stick with every proc "returning" a channel message
20:41:55FromDiscord<Phil> (edit) "The question is more how to do that cleanly I guess...↵Or I just don't use Flowvars and stick with every proc "returning" a channel message ... " added "which I also read from in my while-loop"
20:44:45FromDiscord<Elegantbeef> What you've described is pretty clean, but it makes more sense to wrap it in channels I think
20:45:27FromDiscord<Phil> In reply to @Elegantbeef "What you've described is": It sounds that way until you need to think how you get those flowvars out of the seq again
20:46:37FromDiscord<Phil> Because you'd want to iterate over the seq but then you'd also want to delete all entries that are ready and that you just finished off.↵But you can't (or shouldn't I think) delete entries while you're iterating over the seq.↵So you'd likely make yourself a list of indices for entries to delete from a seq after you iterated over it
20:46:42FromDiscord<Elegantbeef> Is this a rare occurance a linked list makes sense?!
20:46:55FromDiscord<Elegantbeef> You can delete entries when iterating a sequence
20:47:01FromDiscord<Elegantbeef> assuming you iterate it backwards
20:48:57FromDiscord<Phil> Hmmmmmmm↵So either checking a channel for a message once per loop or iterating over an infinitely growable seq of flowvars that you check for readiness every loop, trigger responses for those that are finished and then delete them from the seq
20:49:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
20:49:18FromDiscord<Phil> I'm still slightly leaning towards channels, but only because that seems like it does less computation per loop
20:49:19FromDiscord<Elegantbeef> You should not mutate a collection you're iterating front to back as deletions cause skipping elements
20:49:20FromDiscord<Elegantbeef> Nim has a check for this and will error when you attempt it
20:49:34FromDiscord<Phil> (edit) "loop" => "while-loop iteration"
20:49:44FromDiscord<Elegantbeef> It's a queue that only adds finished elements
20:49:47FromDiscord<Elegantbeef> So it makes the most sense
20:55:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
20:56:09FromDiscord<Phil> I'm trying to figure out which will happen here
20:58:40FromDiscord<Elegantbeef> It seems that the taskpool uses a deque
20:59:16FromDiscord<Phil> I'm running the code, I know the while-loop doesn't block because when I insert an echo in there that echo blots out the entire terminal.↵... hmmm not sure why I couldn't see it before but memory usage is growing, I assume the queue for scheduling "spawn" tasks is just growing
20:59:56FromDiscord<Elegantbeef> Which means it is a growable task list that is probably FIFO
20:59:59FromDiscord<Elegantbeef> https://github.com/status-im/nim-taskpools/blob/15e23ef1cf0860330dcc32f50fcce5f840031e28/taskpools/chase_lev_deques.nim#L60-L64
21:00:41FromDiscord<Elegantbeef> https://github.com/status-im/nim-taskpools/blob/15e23ef1cf0860330dcc32f50fcce5f840031e28/taskpools/taskpools.nim#L191-L195
21:00:43FromDiscord<Elegantbeef> Yes
21:14:09FromDiscord<Phil> Can you share threadpools across threads?
21:14:18FromDiscord<Phil> Or rather, is that a super terrible idea or not?
21:14:46FromDiscord<Phil> Architecture was maybe 2 long running threads that share a threadpool for spawning tasks etc.
21:16:00FromDiscord<Elegantbeef> Don't get why you'd share a thread pool
21:17:22FromDiscord<Phil> Hm... fair, could just spawn a second threadpool
21:25:59FromDiscord<Phil> Okay I still haven't fully digested that sudden moment where it all clicked, but it feels really nice to suddenly be able to make sense of stuff
21:30:01*khazakar joined #nim
21:42:57advesperacithttps://hatebin.com/wdssclhiqw
21:51:17FromDiscord<Phil> The compiler should move instead of copy, that is the general behaviour afaik
21:51:35FromDiscord<Phil> Only accessing the variable afterwards is what implicitly changes that
21:51:48FromDiscord<Elegantbeef> Don't ask people ask the compiler with `--expandArc:two`
21:51:58FromDiscord<Phil> Move is better though imo because more explicit
21:52:37FromDiscord<Elegantbeef> Nah explicit move semantics is awful imo
21:52:52FromDiscord<Phil> Depends on how much you care about performance
21:53:03FromDiscord<Phil> I don't, so unless I need it for guaranteeing sth I don't care
21:53:04FromDiscord<Elegantbeef> I care about performance a fair bit
21:53:11FromDiscord<Elegantbeef> Being explicit does not make it faster
21:53:31FromDiscord<Elegantbeef> If I want to ensure move semantics I make a new type that disables hooks I dislike
21:53:32FromDiscord<Phil> Being explicit gives you guarantees though, so prevents you from accidentally making things worse somewhere
21:53:40FromDiscord<Phil> Fair
21:53:42FromDiscord<Elegantbeef> Right you can use `ensuremove`
21:53:56FromDiscord<Elegantbeef> But that's still pretty meh
21:55:33*xet7 joined #nim
21:57:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
21:57:24FromDiscord<Elegantbeef> Use after move is possible with `move` and it is not statically wrong
21:57:57FromDiscord<9ih> how does Nimble add custom import resolutions to nim when I use `nimble c` as opposed to `nim c`? thinking about writing my own package manager
21:58:08FromDiscord<Elegantbeef> `--nimblePath:....`
21:58:16FromDiscord<Elegantbeef> Refer to atlas to see one way of doing it
21:58:38FromDiscord<Elegantbeef> It generates a `config.nims` with `--noNimblePath` followed by `--nimblePath:your/package/path`
21:58:46FromDiscord<Phil> Man, making things look legible in mermaid can be a pain
21:59:10FromDiscord<Phil> I mean come on https://media.discordapp.net/attachments/371759389889003532/1187152236443357214/image.png?ex=6595d8ad&is=658363ad&hm=bd534457755d153e491c47ba44310bb90d6477538b34714d7515f77c8aff532c&
21:59:27advesperacitthanks beef and phil
21:59:59FromDiscord<9ih> In reply to @Elegantbeef "It generates a `config.nims`": ty
22:06:02FromDiscord<albassort> In reply to @isofruit "I mean come on": do you know about Drawio integration into vscode
22:06:22FromDiscord<Phil> In reply to @albassort "do you know about": Oh I'm aware, mermaid is just faster
22:06:36FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1187154108227002428/image.png?ex=6595da6b&is=6583656b&hm=49c0e111741c188fc90a6abc5e32b2541df0bf4fdfbdc7645a7576c445cf6454&
22:06:40FromDiscord<albassort> o
22:06:44FromDiscord<Phil> Which is why I tend to prefer it, but once it gets more complex like this I also kinda fall back on drawio
22:07:04FromDiscord<albassort> probably with drawio is it gets out of date and im too lazy to fix it
22:07:17FromDiscord<albassort> (edit) "probably" => "problem"
22:11:04FromDiscord<ntsekees> Hi; is there a standard type for multisets?
22:11:34FromDiscord<Elegantbeef> What's a multiset?
22:12:29FromDiscord<albassort> https://en.wikipedia.org/wiki/Multiset
22:12:32FromDiscord<albassort> ...an array?
22:12:54FromDiscord<ntsekees> A data type similar to a set, but with each element being paired with a count number
22:12:55FromDiscord<albassort> countTable
22:13:47FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:14:20FromDiscord<ntsekees> neat, thanks
22:14:23FromDiscord<albassort> although i do think they are a bit redundent, are they optimized at all compared to a normal table beef
22:15:07FromDiscord<albassort> Table[type, int]
22:19:09FromDiscord<Elegantbeef> You could use a `Table`, but why would you want to
22:21:15FromDiscord<albassort> why would you implement a specific table with a dedicated value
22:21:56FromDiscord<Elegantbeef> Cause it has a specific api
22:22:02FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:22:22FromDiscord<albassort> (edit)
22:22:25FromDiscord<Elegantbeef> You do not want to `table[] = ...` you want to generally `inc` and `dec`
22:22:45FromDiscord<Elegantbeef> It could be a `distinct OrderedTable` but regardless it has a reason to exist
22:46:10FromDiscord<ntsekees> It seems if-expressions cannot be used in lambda sugar expressions?↵`((a: uint, b: uint) => if a > b: 1 else: -1)` gives the error ⟪expression expected, but found 'keyword if'⟫.
22:46:28FromDiscord<Elegantbeef> Try wrapping it in `()`
22:47:02FromDiscord<ntsekees> ah, thanks
22:57:51*advesperacit quit ()
23:26:54*casaca joined #nim
23:43:03FromDiscord<ntsekees> if `s` is a string, does `s[n]` yields a char or a string? I seem to understand it should be a char, but the compiler seems to tell me otherwise
23:43:10FromDiscord<ntsekees> (edit) "yields" => "yield"
23:44:35FromDiscord<ElegantBeef> Are you sure that's what it's saying
23:46:54FromDiscord<ntsekees> sent a long message, see <!doctype html>
23:47:09FromDiscord<ntsekees> and yet `h1: string`
23:47:09FromDiscord<ElegantBeef> `hi` is likely `seq[string]`
23:47:56FromDiscord<ElegantBeef> Also what version is that Nim seems old
23:48:19FromDiscord<ntsekees> sent a code paste, see https://play.nim-lang.org/#ix=html>
23:48:38FromDiscord<ntsekees> (edit)
23:48:52FromDiscord<ElegantBeef> `[0..h1.len]`?
23:49:25FromDiscord<ElegantBeef> That does yields a `slice`
23:49:28FromDiscord<ElegantBeef> not a n int
23:49:37FromDiscord<ElegantBeef> so yes `h1[i]` will be a string as you're slicing
23:49:39FromDiscord<ntsekees> ah damn
23:49:42FromDiscord<ntsekees> okay
23:49:51FromDiscord<ElegantBeef> Ps you can do `for i, x in h1`
23:50:29FromDiscord<ntsekees> I didn't expect `i` could be a slice there
23:51:12FromDiscord<ntsekees> Thanks.
23:51:28FromDiscord<ElegantBeef> Well you're making an array of slices with a single element
23:59:16*henrytill left #nim (#nim)