00:20:14 | FromDiscord | <christofur> @Phil do you have any idea about this: Hint: [Link]↵MachO Flush... error(link): unsupported cpu architecture 0x0↵error: UnsupportedCpuArchitecture |
00:20:30 | FromDiscord | <christofur> has anyone here compiled windows binaries on mac m2? |
00:20:39 | FromDiscord | <christofur> (edit) "has anyone here compiled ... windows" added "x64 or x86" |
01:28:56 | * | krux02 quit (Remote host closed the connection) |
01:37:08 | FromDiscord | <Elegantbeef> Also `zig targets | grep windows` |
01:37:10 | FromDiscord | <Elegantbeef> @christofur `zigcc --version`? |
01:37:56 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:38:07 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:38:12 | FromDiscord | <christofur> hmm.. target lol |
01:38:32 | FromDiscord | <christofur> but i should be able to target x86_64-windows-gnu , right |
01:38:49 | FromDiscord | <Elegantbeef> Right |
01:38:55 | FromDiscord | <Elegantbeef> How are you attempting to target windows? |
01:39:07 | FromDiscord | <christofur> i guess i dont know how |
01:39:21 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:39:23 | FromDiscord | <christofur> this is my compile script |
01:39:25 | FromDiscord | <christofur> let me see if theres a target |
01:39:25 | FromDiscord | <Elegantbeef> I mean what is your Nim command? |
01:39:50 | FromDiscord | <christofur> should cpu flag be the target then? |
01:39:53 | FromDiscord | <Elegantbeef> `--os:windows` should be used |
01:39:55 | FromDiscord | <christofur> ok |
01:40:21 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:40:25 | FromDiscord | <christofur> ok not bad, now im missing the headers |
01:40:28 | FromDiscord | <christofur> so it got further |
01:43:18 | FromDiscord | <Elegantbeef> Ah I got it! |
01:43:27 | FromDiscord | <christofur> ya nice dude |
01:43:38 | FromDiscord | <christofur> now i gotta figure out what to install to get these libs here |
01:43:58 | FromDiscord | <Elegantbeef> `--passC: "-target x86_64-windows" --passL: "-target x86_64-windows" --cpu:amd64 --os:windows` |
01:44:01 | FromDiscord | <Elegantbeef> You do not need anything |
01:44:09 | FromDiscord | <Elegantbeef> You need to tell zig to target windows |
01:44:47 | FromDiscord | <christofur> what is passC and passL |
01:44:48 | FromDiscord | <Elegantbeef> I'd also probably suggest making a `config.nims` |
01:44:58 | FromDiscord | <Elegantbeef> pass to C compiler and pass to Linker |
01:45:03 | FromDiscord | <christofur> ahh |
01:45:13 | FromDiscord | <christofur> Hint: [Link]↵error: UnknownOperatingSystem |
01:45:42 | FromDiscord | <christofur> no way ,i think that worked |
01:45:50 | FromDiscord | <Elegantbeef> should be `x86_64-windows-gnu` sorry 😄 |
01:45:59 | FromDiscord | <christofur> ls↵client client.exe client.nim client.pdb compile.sh |
01:46:11 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:46:12 | FromDiscord | <christofur> amazing. |
01:46:19 | FromDiscord | <christofur> thank you |
01:46:20 | FromDiscord | <christofur> you're a g |
01:47:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:47:10 | FromDiscord | <Elegantbeef> Then you can just do `-d:windows` and build for windows |
01:47:36 | FromDiscord | <Elegantbeef> Do not recall if `--clang.linkerexe: "zigcc"` works |
01:51:00 | FromDiscord | <Elegantbeef> Actually that might not work.... hmmm |
01:52:22 | FromDiscord | <Elegantbeef> The above does work with `--os:windows` assuming you actually add `passL` |
01:53:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:54:53 | FromDiscord | <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:11 | FromDiscord | <christofur> i have crossover |
02:12:00 | FromDiscord | <christofur> weird.. this works in my compile.sh |
02:12:03 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:12:17 | FromDiscord | <christofur> sent a long message, see <!doctype html> |
02:12:25 | FromDiscord | <christofur> (edit) "long message," => "code paste," | "<!doctype html> <html lang=en> <head> <meta charset=utf-8> <title> </title> </head> <style> body { font-family: monospace; margin: 2em; } </style> <body> <p>ix.io is taking a break 🍻</p> <img src="/underconstruction.gif" width="200px"> </body> </html>" => "https://play.nim-lang.org/#ix=html>" |
02:12:27 | FromDiscord | <christofur> but that doesnt work |
02:12:38 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:12:46 | FromDiscord | <christofur> @ElegantBeef any ideas? |
02:12:52 | FromDiscord | <Elegantbeef> `nim c --os:windows ./input.nim` |
02:14:52 | FromDiscord | <christofur> failing to find the headers again. |
02:19:28 | FromDiscord | <christofur> arch -x86_64 /usr/local/Homebrew/bin/nim |
02:19:31 | FromDiscord | <christofur> definitely because of this |
02:19:37 | FromDiscord | <christofur> i had to put the x86 homebrew stuff in a separate path |
02:29:44 | FromDiscord | <Elegantbeef> Why do you have amd64 nim? |
02:30:00 | FromDiscord | <christofur> pardon? |
02:30:26 | FromDiscord | <christofur> i dunno it didnt end up working anyway |
02:30:29 | FromDiscord | <christofur> ill just clone this compile script |
02:30:32 | FromDiscord | <christofur> if i have to |
02:32:50 | FromDiscord | <Elegantbeef> you have x86\_64 nim on a m2 |
02:33:54 | FromDiscord | <christofur> ya i dunno |
02:33:57 | FromDiscord | <christofur> why not |
02:34:03 | FromDiscord | <christofur> i have both actually |
02:34:32 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:34:47 | FromDiscord | <Elegantbeef> So your zig is amd or arm? |
02:35:48 | FromDiscord | <christofur> sent a code paste, see https://play.nim-lang.org/#ix=html> |
02:35:56 | FromDiscord | <christofur> hmm. i guess that settles it then, should just be arm64 across the board |
02:57:58 | FromDiscord | <nasuray> You have to set the --os switch from the command line https://forum.nim-lang.org/t/3939#24571 |
03:04:32 | FromDiscord | <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:56 | FromDiscord | <christofur> hmm seems like even with app:gui the console window is still showing |
03:07:57 | FromDiscord | <christofur> sent a long message, see <!doctype html> |
03:08:08 | FromDiscord | <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:20 | NimEventer | New Nimble package! ccal - calendar with local holidays via ip location, see https://github.com/inv2004/ccal |
05:09:37 | FromDiscord | <MDuardo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
05:16:40 | FromDiscord | <intellij_gamer> sent a code paste, see https://play.nim-lang.org/#ix=html> |
05:19:58 | FromDiscord | <Elegantbeef> Or use `formatFloat` inside `std/strutils` |
05:48:28 | NimEventer | New Nimble package! implot - Nim binding for ImPlot (CImPlot/ImGui/CImGui), see https://github.com/dinau/nim_implot |
06:02:16 | NimEventer | New 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:38 | FromDiscord | <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:56 | FromDiscord | <Phil (he/him)> I want to wrap my head around what makes it so different and something to strive for |
12:58:09 | PMunch | Mostly just that it integrates with the async system so that they can be awaited |
12:58:27 | PMunch | i.e. it's easier to combine |
12:58:32 | FromDiscord | <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:45 | FromDiscord | <michaelb.eth> (edit) "reaponse" => "response" |
12:58:51 | FromDiscord | <Phil (he/him)> Hmm fair.↵↵In threadButler you could do something, but not with as elegant syntax |
12:59:04 | FromDiscord | <Phil (he/him)> Since in ThreadButler you can annotate a handler with async and do asyncsleeps |
12:59:19 | FromDiscord | <Phil (he/him)> Basically while trySend()\: asyncSleep(100) or sth |
12:59:32 | PMunch | Yeah, that adds the small latency hit of 100ms though |
13:00:01 | PMunch | With a true async channel they would use selectors and do proper OS sleep while waiting for the channel |
13:00:11 | FromDiscord | <Phil (he/him)> I mean yeah, but that's just exemplaric, at a low enough level the latency doesn't matter |
13:00:22 | FromDiscord | <Phil (he/him)> Fair |
13:00:59 | FromDiscord | <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:28 | FromDiscord | <xtrayambak> How can I convert an `uint8` into a sequence of bytes? |
15:00:54 | FromDiscord | <bostonboston> A singular uint8? |
15:00:59 | FromDiscord | <xtrayambak> yeah |
15:01:30 | PMunch | That would be a sequence of a single byte.. |
15:01:40 | PMunch | Are you sure you don't have a pointer to a uint_8? |
15:01:45 | FromDiscord | <xtrayambak> wait, ah |
15:01:54 | PMunch | Which is the C way of saying an array |
15:01:58 | FromDiscord | <xtrayambak> are all unsigned primitives just one byte? |
15:02:09 | PMunch | No, all 8-bit values are a single byte |
15:02:21 | FromDiscord | <xtrayambak> ah, I forgot that |
15:02:22 | PMunch | Considering that's the definition of a byte.. |
15:02:33 | FromDiscord | <xtrayambak> So that's good, but what about something like `uint32`? |
15:02:40 | PMunch | That's four bytes |
15:02:59 | PMunch | `cast[array[4, uint8]](myUint32)` |
15:03:07 | FromDiscord | <xtrayambak> alright, thanks |
15:03:16 | PMunch | Or if that fails: `cast[ptr array[4, uint8]](myUint32.addr)[]` |
15:03:42 | PMunch | You can't cast them to a sequence, but you can convert that array to one |
15:04:06 | FromDiscord | <xtrayambak> so, I cast that to an array, then I cast THAT to a sequence? |
15:04:20 | FromDiscord | <odexine> you cannot cast it into a sequence |
15:04:34 | FromDiscord | <xtrayambak> yeah, I guess I gotta fill the sequence manually, then? |
15:04:35 | FromDiscord | <odexine> you will need to copy the bytes into an empty seq if you wanted a sequence |
15:04:55 | PMunch | You cast it into an array, then you convert that into a sequence |
15:05:12 | FromDiscord | <xtrayambak> alright |
15:05:14 | FromDiscord | <odexine> oh yeah |
15:05:17 | FromDiscord | <xtrayambak> thanks |
15:05:18 | FromDiscord | <odexine> @ exists |
15:06:45 | FromDiscord | <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:14 | FromDiscord | <odexine> byte is an alias for uint8 iirc? or similar ot |
15:07:24 | FromDiscord | <xtrayambak> probably, considering they're basically the same thing |
15:07:31 | FromDiscord | <odexine> https://nim-lang.org/docs/system.html#byte |
15:09:27 | FromDiscord | <xtrayambak> so, it's not marked as `distinct`? |
15:14:19 | FromDiscord | <odexine> doesnt seem so no |
15:24:18 | PMunch | Yeah you can put any 8-bit entity in there |
15:24:48 | PMunch | So uint8, char, byte, some enums, tiny objects, tiny tuples, pointers on very strange architectures, etc. |
15:28:09 | PMunch | For example: https://paste.rs/TKl4t.txt |
15:33:36 | FromDiscord | <bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:45:48 | * | PMunch quit (Quit: Leaving) |
16:01:11 | NimEventer | New thread by coneonthefloor: Sitemap Parser, see https://forum.nim-lang.org/t/10790 |
16:06:25 | FromDiscord | <alireza0x0> guys |
16:06:33 | FromDiscord | <alireza0x0> why this segfaults with usemalloc? https://media.discordapp.net/attachments/371759389889003532/1187063500560932884/image.png?ex=65958609&is=65831109&hm=4f4900cc64c3b166d76c5a16bf9f84f942a96399e4ebbe071bbf5898e7b58ea9& |
16:06:57 | FromDiscord | <alireza0x0> am i doing something wrong? |
16:07:35 | FromDiscord | <alireza0x0> btw when i add quit() at the end my self it wont crash... |
16:08:37 | FromDiscord | <alireza0x0> and this crash only happens with usemalloc |
16:16:38 | FromDiscord | <alireza0x0> probably should ask this on internals... |
16:27:29 | FromDiscord | <yohgzcas> 1000000192.jpg https://media.discordapp.net/attachments/371759389889003532/1187068765070958682/1000000192.jpg?ex=65958af0&is=658315f0&hm=4d0115f40f024006177902adfec94a480fa8f774cb30239e72adfbd2d3e6a2fd& |
16:58:18 | FromDiscord | <graveflo> <@&371760044473319454> |
17:04:17 | FromDiscord | <pmunch> Sounds like a bug |
17:16:15 | FromDiscord | <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:21 | FromDiscord | <Clonkk> I think Vindaar uses emacs |
17:42:10 | FromDiscord | <vindaar> I do, but I've never used LSP, so not sure if I can be of any help |
17:49:11 | FromDiscord | <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:09 | FromDiscord | <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:29 | FromDiscord | <graveflo> did you use `nimble init` to start off? |
18:46:55 | FromDiscord | <niontrix (Tobias Heinlein)> Yes I did |
18:47:47 | FromDiscord | <graveflo> maybe try and make sure the CWD of the lsp process is set to the project dir? |
18:48:18 | FromDiscord | <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:23 | FromDiscord | <niontrix (Tobias Heinlein)> How can I check that\`↵(@graveflo) |
18:48:54 | FromDiscord | <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:56 | FromDiscord | <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:54 | FromDiscord | <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:15 | FromDiscord | <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:26 | FromDiscord | <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:35 | FromDiscord | <niontrix (Tobias Heinlein)> but the strange thing is that this same language server works without further configuration when i use vscode |
18:53:37 | FromDiscord | <niontrix (Tobias Heinlein)> in the same project |
18:53:50 | FromDiscord | <niontrix (Tobias Heinlein)> how could i check the CWD that lsp is using to start the server? |
18:54:45 | FromDiscord | <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:34 | FromDiscord | <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:35 | FromDiscord | <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:07 | FromDiscord | <graveflo> also I think the langserver CWD is ruled out as a culprit or fix for this. fyi |
18:57:41 | FromDiscord | <Phil> ... Rika |
18:58:19 | FromDiscord | <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:36 | FromDiscord | <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:46 | FromDiscord | <Phil> (edit) removed "pumping" |
19:01:04 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
19:03:21 | FromDiscord | <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:46 | FromDiscord | <Phil> And given my webdev roots I can't really trust my gutfeeling atm for judging those two approaches |
19:03:56 | FromDiscord | <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:21 | FromDiscord | <Phil (he/him)> This is not a specific architecture, just if it at all can make sense to even provide tooling for |
19:04:25 | FromDiscord | <Phil (he/him)> \application architecture |
19:06:39 | FromDiscord | <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:43 | FromDiscord | <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:31 | FromDiscord | <Phil (he/him)> sent a long message, see <!doctype html> |
19:15:23 | FromDiscord | <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:26 | FromDiscord | <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:36 | FromDiscord | <Phil (he/him)> Aaaaaaand now it just clicked why doing this via inheritance and methods might be more efficient |
19:20:27 | FromDiscord | <Phil (he/him)> If that's possible |
19:20:35 | FromDiscord | <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:25 | FromDiscord | <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:20 | FromDiscord | <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:20 | FromDiscord | <Phil (he/him)> \which likely sends message back |
19:39:23 | FromDiscord | <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:25 | FromDiscord | <Zoom> I say, make a prototype with the dumbest approach available, see where the congestion/under-utilization appears and iterate. |
19:39:25 | FromDiscord | <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:26 | FromDiscord | <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:29 | FromDiscord | <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:31 | FromDiscord | <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:33 | FromDiscord | <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:34 | FromDiscord | <Phil (he/him)> (niontrix, the bridge is dead, your message hasn't reached graveflo who is on discord) |
19:39:36 | FromDiscord | <niontrix (Tobias Heinlein)> How would I know? |
19:39:38 | FromDiscord | <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:38 | FromDiscord | <niontrix (Tobias Heinlein)> And how do you know the bridge is dead? |
19:39:40 | FromDiscord | <Phil (he/him)> Because I have both clients open and the last message is Zoom's to me about the McKenny book |
19:39:42 | FromDiscord | <niontrix (Tobias Heinlein)> 😅 ok, makes sense 😄 |
19:41:16 | FromDiscord | <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:14 | FromDiscord | <Phil (he/him)> sent a long message, see <!doctype html> |
19:47:32 | FromDiscord | <Phil (he/him)> Nevermind, neither do, you're supposed to roll your own via cancellation token parameters, oof |
19:49:54 | FromDiscord | <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:16 | FromDiscord | <Zoom> Something a little bit more approachable than whitepapers |
19:50:59 | FromDiscord | <Zoom> Research materials Mamy collects scare the hell out of my tiny brain |
19:53:08 | FromDiscord | <Phil (he/him)> sent a long message, see <!doctype html> |
19:53:16 | FromDiscord | <Phil (he/him)> That's all I got at this point |
19:55:58 | FromDiscord | <Phil (he/him)> The latter is basically just a JS Single-Page-Application talking to a Webserver in the backend. |
19:57:33 | FromDiscord | <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:22 | FromDiscord | <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:32 | FromDiscord | <Zoom> It the very least you have to deal with unscheduled tasks first if they time out. At the pool level |
20:03:05 | FromDiscord | <Zoom> You don't want killing your gui thread \:D |
20:03:26 | FromDiscord | <Phil (he/him)> I mean yeah but the GUI thread would not be part of the threadpool that would potentially get sniped ^^ |
20:04:15 | FromDiscord | <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:59 | FromDiscord | <Phil (he/him)> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:25:41 | FromDiscord | <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:27 | FromDiscord | <Elegantbeef> FlowVars are futures of the threading world |
20:30:33 | FromDiscord | <Elegantbeef> If you do not want to block you just check if they're ready |
20:35:40 | FromDiscord | <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:40 | FromDiscord | <Elegantbeef> Well it's not exactly a channel, but close enough |
20:39:24 | FromDiscord | <Phil> I guess a seq of object variants containing flowvars would be the equivalent |
20:39:48 | FromDiscord | <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:10 | FromDiscord | <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:42 | FromDiscord | <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:55 | FromDiscord | <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:45 | FromDiscord | <Elegantbeef> What you've described is pretty clean, but it makes more sense to wrap it in channels I think |
20:45:27 | FromDiscord | <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:37 | FromDiscord | <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:42 | FromDiscord | <Elegantbeef> Is this a rare occurance a linked list makes sense?! |
20:46:55 | FromDiscord | <Elegantbeef> You can delete entries when iterating a sequence |
20:47:01 | FromDiscord | <Elegantbeef> assuming you iterate it backwards |
20:48:57 | FromDiscord | <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:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:49:18 | FromDiscord | <Phil> I'm still slightly leaning towards channels, but only because that seems like it does less computation per loop |
20:49:19 | FromDiscord | <Elegantbeef> You should not mutate a collection you're iterating front to back as deletions cause skipping elements |
20:49:20 | FromDiscord | <Elegantbeef> Nim has a check for this and will error when you attempt it |
20:49:34 | FromDiscord | <Phil> (edit) "loop" => "while-loop iteration" |
20:49:44 | FromDiscord | <Elegantbeef> It's a queue that only adds finished elements |
20:49:47 | FromDiscord | <Elegantbeef> So it makes the most sense |
20:55:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:56:09 | FromDiscord | <Phil> I'm trying to figure out which will happen here |
20:58:40 | FromDiscord | <Elegantbeef> It seems that the taskpool uses a deque |
20:59:16 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> Which means it is a growable task list that is probably FIFO |
20:59:59 | FromDiscord | <Elegantbeef> https://github.com/status-im/nim-taskpools/blob/15e23ef1cf0860330dcc32f50fcce5f840031e28/taskpools/chase_lev_deques.nim#L60-L64 |
21:00:41 | FromDiscord | <Elegantbeef> https://github.com/status-im/nim-taskpools/blob/15e23ef1cf0860330dcc32f50fcce5f840031e28/taskpools/taskpools.nim#L191-L195 |
21:00:43 | FromDiscord | <Elegantbeef> Yes |
21:14:09 | FromDiscord | <Phil> Can you share threadpools across threads? |
21:14:18 | FromDiscord | <Phil> Or rather, is that a super terrible idea or not? |
21:14:46 | FromDiscord | <Phil> Architecture was maybe 2 long running threads that share a threadpool for spawning tasks etc. |
21:16:00 | FromDiscord | <Elegantbeef> Don't get why you'd share a thread pool |
21:17:22 | FromDiscord | <Phil> Hm... fair, could just spawn a second threadpool |
21:25:59 | FromDiscord | <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:57 | advesperacit | https://hatebin.com/wdssclhiqw |
21:51:17 | FromDiscord | <Phil> The compiler should move instead of copy, that is the general behaviour afaik |
21:51:35 | FromDiscord | <Phil> Only accessing the variable afterwards is what implicitly changes that |
21:51:48 | FromDiscord | <Elegantbeef> Don't ask people ask the compiler with `--expandArc:two` |
21:51:58 | FromDiscord | <Phil> Move is better though imo because more explicit |
21:52:37 | FromDiscord | <Elegantbeef> Nah explicit move semantics is awful imo |
21:52:52 | FromDiscord | <Phil> Depends on how much you care about performance |
21:53:03 | FromDiscord | <Phil> I don't, so unless I need it for guaranteeing sth I don't care |
21:53:04 | FromDiscord | <Elegantbeef> I care about performance a fair bit |
21:53:11 | FromDiscord | <Elegantbeef> Being explicit does not make it faster |
21:53:31 | FromDiscord | <Elegantbeef> If I want to ensure move semantics I make a new type that disables hooks I dislike |
21:53:32 | FromDiscord | <Phil> Being explicit gives you guarantees though, so prevents you from accidentally making things worse somewhere |
21:53:40 | FromDiscord | <Phil> Fair |
21:53:42 | FromDiscord | <Elegantbeef> Right you can use `ensuremove` |
21:53:56 | FromDiscord | <Elegantbeef> But that's still pretty meh |
21:55:33 | * | xet7 joined #nim |
21:57:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:57:24 | FromDiscord | <Elegantbeef> Use after move is possible with `move` and it is not statically wrong |
21:57:57 | FromDiscord | <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:08 | FromDiscord | <Elegantbeef> `--nimblePath:....` |
21:58:16 | FromDiscord | <Elegantbeef> Refer to atlas to see one way of doing it |
21:58:38 | FromDiscord | <Elegantbeef> It generates a `config.nims` with `--noNimblePath` followed by `--nimblePath:your/package/path` |
21:58:46 | FromDiscord | <Phil> Man, making things look legible in mermaid can be a pain |
21:59:10 | FromDiscord | <Phil> I mean come on https://media.discordapp.net/attachments/371759389889003532/1187152236443357214/image.png?ex=6595d8ad&is=658363ad&hm=bd534457755d153e491c47ba44310bb90d6477538b34714d7515f77c8aff532c& |
21:59:27 | advesperacit | thanks beef and phil |
21:59:59 | FromDiscord | <9ih> In reply to @Elegantbeef "It generates a `config.nims`": ty |
22:06:02 | FromDiscord | <albassort> In reply to @isofruit "I mean come on": do you know about Drawio integration into vscode |
22:06:22 | FromDiscord | <Phil> In reply to @albassort "do you know about": Oh I'm aware, mermaid is just faster |
22:06:36 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1187154108227002428/image.png?ex=6595da6b&is=6583656b&hm=49c0e111741c188fc90a6abc5e32b2541df0bf4fdfbdc7645a7576c445cf6454& |
22:06:40 | FromDiscord | <albassort> o |
22:06:44 | FromDiscord | <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:04 | FromDiscord | <albassort> probably with drawio is it gets out of date and im too lazy to fix it |
22:07:17 | FromDiscord | <albassort> (edit) "probably" => "problem" |
22:11:04 | FromDiscord | <ntsekees> Hi; is there a standard type for multisets? |
22:11:34 | FromDiscord | <Elegantbeef> What's a multiset? |
22:12:29 | FromDiscord | <albassort> https://en.wikipedia.org/wiki/Multiset |
22:12:32 | FromDiscord | <albassort> ...an array? |
22:12:54 | FromDiscord | <ntsekees> A data type similar to a set, but with each element being paired with a count number |
22:12:55 | FromDiscord | <albassort> countTable |
22:13:47 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:14:20 | FromDiscord | <ntsekees> neat, thanks |
22:14:23 | FromDiscord | <albassort> although i do think they are a bit redundent, are they optimized at all compared to a normal table beef |
22:15:07 | FromDiscord | <albassort> Table[type, int] |
22:19:09 | FromDiscord | <Elegantbeef> You could use a `Table`, but why would you want to |
22:21:15 | FromDiscord | <albassort> why would you implement a specific table with a dedicated value |
22:21:56 | FromDiscord | <Elegantbeef> Cause it has a specific api |
22:22:02 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:22:22 | FromDiscord | <albassort> (edit) |
22:22:25 | FromDiscord | <Elegantbeef> You do not want to `table[] = ...` you want to generally `inc` and `dec` |
22:22:45 | FromDiscord | <Elegantbeef> It could be a `distinct OrderedTable` but regardless it has a reason to exist |
22:46:10 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> Try wrapping it in `()` |
22:47:02 | FromDiscord | <ntsekees> ah, thanks |
22:57:51 | * | advesperacit quit () |
23:26:54 | * | casaca joined #nim |
23:43:03 | FromDiscord | <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:10 | FromDiscord | <ntsekees> (edit) "yields" => "yield" |
23:44:35 | FromDiscord | <ElegantBeef> Are you sure that's what it's saying |
23:46:54 | FromDiscord | <ntsekees> sent a long message, see <!doctype html> |
23:47:09 | FromDiscord | <ntsekees> and yet `h1: string` |
23:47:09 | FromDiscord | <ElegantBeef> `hi` is likely `seq[string]` |
23:47:56 | FromDiscord | <ElegantBeef> Also what version is that Nim seems old |
23:48:19 | FromDiscord | <ntsekees> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:48:38 | FromDiscord | <ntsekees> (edit) |
23:48:52 | FromDiscord | <ElegantBeef> `[0..h1.len]`? |
23:49:25 | FromDiscord | <ElegantBeef> That does yields a `slice` |
23:49:28 | FromDiscord | <ElegantBeef> not a n int |
23:49:37 | FromDiscord | <ElegantBeef> so yes `h1[i]` will be a string as you're slicing |
23:49:39 | FromDiscord | <ntsekees> ah damn |
23:49:42 | FromDiscord | <ntsekees> okay |
23:49:51 | FromDiscord | <ElegantBeef> Ps you can do `for i, x in h1` |
23:50:29 | FromDiscord | <ntsekees> I didn't expect `i` could be a slice there |
23:51:12 | FromDiscord | <ntsekees> Thanks. |
23:51:28 | FromDiscord | <ElegantBeef> Well you're making an array of slices with a single element |
23:59:16 | * | henrytill left #nim (#nim) |