00:03:37 | * | mahlon joined #nim |
00:32:19 | * | xet7 joined #nim |
00:54:11 | * | azimut quit (Remote host closed the connection) |
00:54:33 | * | azimut joined #nim |
01:36:24 | * | sagax quit (Quit: Konversation terminated!) |
01:51:09 | * | Jjp137 quit (Remote host closed the connection) |
01:54:28 | * | Jjp137 joined #nim |
03:07:59 | * | xet7 quit (Ping timeout: 256 seconds) |
03:47:45 | * | edr quit (Quit: Leaving) |
04:19:00 | FromDiscord | <ringabout> Nim intern strings plan is postponed because it cannot work with `cstring` without breaking everything |
06:56:16 | * | cnx quit (Remote host closed the connection) |
06:57:07 | * | cnx joined #nim |
07:08:58 | * | advesperacit joined #nim |
07:50:40 | * | PMunch joined #nim |
08:13:41 | FromDiscord | <alireza0x0> guys |
08:13:55 | FromDiscord | <alireza0x0> anyone knows why this code conusems 86% of my pc cpu? |
08:13:57 | FromDiscord | <alireza0x0> https://media.discordapp.net/attachments/371759389889003532/1185132628769243245/image.png?ex=658e7fc5&is=657c0ac5&hm=1205393e2c2b069e98f256a78dcd6d6a3d1cc3669766adcc1322dd87a7276f80& |
08:14:07 | FromDiscord | <alireza0x0> (edit) "conusems" => "consumes" |
08:14:30 | FromDiscord | <alireza0x0> cpuRelax is from std/atomics which are used also in ticketlocks and otherplaces so i just copied from there... |
08:18:41 | FromDiscord | <nnsee> cpuRelax simply tells the compiler to not clobber memory, ie if you're reading some value in the while loop |
08:18:51 | FromDiscord | <nnsee> you're still running a `while true` loop |
08:19:08 | FromDiscord | <alireza0x0> hmm... |
08:19:29 | FromDiscord | <alireza0x0> i tut there is a function that i can run inside my while loop and that stops cosuming cpu ... |
08:19:42 | FromDiscord | <alireza0x0> probably no such fuction exist (non blocking) |
08:19:52 | FromDiscord | <alireza0x0> (edit) "fuction" => "function" |
08:20:00 | PMunch | As long as you're spinning you're consuming CPU |
08:20:11 | PMunch | That's just the nature of spinning |
08:20:14 | FromDiscord | <Elegantbeef> Yea you need to wait for something |
08:20:29 | FromDiscord | <alireza0x0> hmm |
08:20:35 | FromDiscord | <Elegantbeef> Generally with threads you're waiting on IO or channels |
08:20:45 | FromDiscord | <alireza0x0> yea... |
08:20:55 | FromDiscord | <alireza0x0> i wanted to mix a channel with async await |
08:21:11 | FromDiscord | <alireza0x0> channel only has wait or tryrecv |
08:21:23 | FromDiscord | <alireza0x0> 1 of them blocks the event loop compeletly |
08:21:32 | FromDiscord | <alireza0x0> other one needs to be run on a loop or eventloop |
08:21:33 | FromDiscord | <Elegantbeef> Of course it does |
08:21:47 | FromDiscord | <alireza0x0> the poll() function |
08:21:53 | FromDiscord | <alireza0x0> inside runforever |
08:21:56 | FromDiscord | <alireza0x0> is in a while |
08:21:59 | FromDiscord | <alireza0x0> but interestingly |
08:22:02 | FromDiscord | <alireza0x0> its not consuming cpu |
08:22:07 | FromDiscord | <alireza0x0> and i ran it and test it |
08:22:15 | FromDiscord | <alireza0x0> it blocks (puts thread to sleep or something) |
08:22:26 | PMunch | poll has a default timeout of 500ms I believe |
08:22:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:22:36 | FromDiscord | <alireza0x0> that is also very weird... i was hoping i can put my tryrecv inside poll ... |
08:22:45 | PMunch | So it will sleep on a selector for that amount of time |
08:23:03 | FromDiscord | <alireza0x0> oh... |
08:23:14 | FromDiscord | <Elegantbeef> You need to wrap `tryRecv` with async to get that to work |
08:23:19 | FromDiscord | <Elegantbeef> Good luck there |
08:23:30 | FromDiscord | <alireza0x0> i think i have to somehow |
08:23:36 | FromDiscord | <alireza0x0> register that to the selector right? |
08:23:38 | FromDiscord | <alireza0x0> how...? |
08:23:48 | FromDiscord | <alireza0x0> well i think |
08:24:00 | FromDiscord | <alireza0x0> there is conditions and chronos has kinda asynccontions... |
08:24:18 | FromDiscord | <alireza0x0> they also provided a compelx test , i need to read that probably that can solve this... |
08:24:28 | FromDiscord | <alireza0x0> (edit) "asynccontions..." => "asyncconditions..." |
08:29:36 | PMunch | What exactly are you trying to do? |
08:29:41 | PMunch | I've mixed threads and async in the past |
08:30:01 | FromDiscord | <Phil> Not writing a threadServer that's for sure, because for that one you wouldn't want/need async ^^ |
08:30:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:30:40 | FromDiscord | <Elegantbeef> Whoops forgot a `await sleep(x)` at the end |
08:30:45 | FromDiscord | <alireza0x0> i want to write a multithreaded server with async/await features inside each thread |
08:30:51 | FromDiscord | <alireza0x0> not really a server but a tunnel |
08:31:02 | PMunch | That's not really specific though |
08:31:06 | FromDiscord | <alireza0x0> one threads receives and after some process puts the result on the channel |
08:31:15 | FromDiscord | <Phil> In reply to @Elegantbeef "The dumbest way is": Throw away the async and you mostly have how I'm implementing my threadserver |
08:31:19 | FromDiscord | <alireza0x0> the seccond thread porcess further then writes to other socket |
08:32:22 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:32:34 | FromDiscord | <Phil> (edit) |
08:33:21 | PMunch | With the little information you have given you can just set up a bog-standard async server, and on every message write them to a channel |
08:33:41 | FromDiscord | <Phil> Every thread has its own dispatcher, right? |
08:33:44 | PMunch | alireza0x0§ * |
08:33:50 | FromDiscord | <alireza0x0> yes |
08:33:54 | FromDiscord | <Phil> Or do threads share dispatchers/queues ? |
08:33:54 | PMunch | Yes, the dispatcher is a threadvar |
08:33:57 | FromDiscord | <alireza0x0> every thread has a eventloop |
08:34:12 | FromDiscord | <alireza0x0> the thing i want is |
08:34:26 | FromDiscord | <alireza0x0> receive some tcp bytse from socket |
08:34:29 | FromDiscord | <alireza0x0> put it on a channel |
08:34:31 | FromDiscord | <Phil> So you couldn't execute the tasks in the queue of thread A from thread B |
08:34:33 | FromDiscord | <Phil> (edit) "B" => "B?" |
08:34:37 | FromDiscord | <alireza0x0> otherthread gets notified and reads that bytse |
08:34:40 | FromDiscord | <alireza0x0> (edit) "bytse" => "bytes" |
08:34:45 | FromDiscord | <alireza0x0> but also asyncrounsly |
08:35:10 | FromDiscord | <alireza0x0> im not using thread poll |
08:35:13 | FromDiscord | <alireza0x0> (edit) "poll" => "pool" |
08:35:23 | FromDiscord | <alireza0x0> il create 2 threads at least to start |
08:35:39 | FromDiscord | <alireza0x0> each thread is worknig with a different scoket, they listen on different ports |
08:35:45 | FromDiscord | <Phil> I mean except for the async part that sounds very much like what I'm doing |
08:36:08 | FromDiscord | <Phil> I guess I could add a call to poll() in my threadButler loop to enable async code execution within a handler |
08:36:47 | FromDiscord | <alireza0x0> i guses i should create a different channel type for this usecase |
08:37:45 | FromDiscord | <Phil> Ohhhhh using poll() instead of sleep() to break up the while-loop execution to not have it go 100% all the time is actually way better |
08:37:55 | FromDiscord | <Phil> (edit) "Ohhhhh using poll() instead of sleep() to break up the while-loop execution to not have it go 100% ... all" added "CPU usage" |
08:38:15 | FromDiscord | <alireza0x0> poll blocks also for 1 sec or half |
08:38:21 | FromDiscord | <Elegantbeef> Oh phil I got bored, just finished my first pass of a mocking api that works for generics 😜 |
08:38:23 | FromDiscord | <Phil> 500ms and you can set that timeout |
08:38:34 | FromDiscord | <Phil> In reply to @Elegantbeef "Oh phil I got": Angel choirs |
08:38:42 | FromDiscord | <Phil> Is that a halo appearing over your head? |
08:38:42 | FromDiscord | <alireza0x0> if you set it lower that will consume more cpu |
08:38:43 | FromDiscord | <Elegantbeef> It took like 20 minutes |
08:38:45 | FromDiscord | <Elegantbeef> Maybe 40 |
08:38:54 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/rickles.nim#L105-L123 |
08:39:30 | FromDiscord | <Phil> I'll look at it later, sick leave is over so back at work |
08:39:30 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1185139057391587369/image.png?ex=658e85c2&is=657c10c2&hm=a0aa5c0e03de02ec89b18f68e2800081606d2afeccc7cf14fe2704ff9be07274& |
08:39:32 | FromDiscord | <Elegantbeef> Shit i lied |
08:39:37 | FromDiscord | <Elegantbeef> It took less than an hour |
08:40:07 | FromDiscord | <Elegantbeef> Hey it's 10 lines of code that's really improtant Phil |
08:40:10 | FromDiscord | <Elegantbeef> important even |
08:41:26 | PMunch | alireza0x0, I'm still not sure why you think you need async channels for this? |
08:41:39 | PMunch | The sender just puts thing into the channel, no async required there |
08:42:01 | PMunch | The receiver only reacts to channel messages, so it could just sleep on that read |
08:42:04 | FromDiscord | <alireza0x0> yes but for receiving from channel |
08:42:22 | FromDiscord | <alireza0x0> my threads are running the event loop, they are not allowed to |
08:42:29 | FromDiscord | <alireza0x0> wait on the cannel and stop the event loop |
08:42:49 | PMunch | Ah, so you have some other work running in the second thread as well? |
08:42:57 | FromDiscord | <alireza0x0> yes ofcourse |
08:43:37 | FromDiscord | <alireza0x0> (edit) "cannel" => "channel" |
08:45:12 | PMunch | It's not off-course for us since you haven't told us this very significant detail.. |
08:47:53 | FromDiscord | <Elegantbeef> Off course are we playing golf today pmunch?! |
08:48:54 | FromDiscord | <alireza0x0> hmm i don't konw... |
08:49:13 | FromDiscord | <alireza0x0> i should just keep thinking and reading more async stuff |
08:49:22 | FromDiscord | <alireza0x0> probably i will find a way |
08:50:23 | FromDiscord | <alireza0x0> but i will finally (try to) reach to this code forexample... https://media.discordapp.net/attachments/371759389889003532/1185141772616220722/image.png?ex=658e8849&is=657c1349&hm=56e9d359b8b736f293c044a22364d1f3907b412233a45e19e58f2be358d67585& |
08:52:09 | PMunch | Of course you shouldn't play golf off course Elegantbeef |
08:52:55 | PMunch | Well you could implement a async-ish way with tryRecv and asyncSleep |
08:53:13 | FromDiscord | <alireza0x0> what im thinking right now is... |
08:53:21 | PMunch | Of course you'd get the latency, but the alternative is to have a file descriptor you can select on, and I don't think channels provide that |
08:53:23 | FromDiscord | <alireza0x0> using threadsignal (async signals) |
08:53:29 | FromDiscord | <alireza0x0> chronos provides this |
08:53:48 | FromDiscord | <alireza0x0> https://media.discordapp.net/attachments/371759389889003532/1185142655240380457/image.png?ex=658e891b&is=657c141b&hm=fe6a1d0c8f8912ed9ec7073889b3b1ff19fb88c79588af2e489cc7759419d5ef& |
08:54:05 | FromDiscord | <alireza0x0> and it has a wait function that is async |
08:54:12 | FromDiscord | <alireza0x0> and a waitsync which is not async ofcourse |
08:54:37 | FromDiscord | <alireza0x0> https://media.discordapp.net/attachments/371759389889003532/1185142861612728370/image.png?ex=658e894d&is=657c144d&hm=51a11aefae3a211216901cc5a21fa39ad566a24489a32ebd7754a4db054a30d9& |
08:55:05 | FromDiscord | <alireza0x0> in their tests, they used this between threads |
08:55:39 | PMunch | Yeah that's what I described in the "alternative" above |
08:55:55 | PMunch | Didn't know Chronos provided this |
08:56:14 | FromDiscord | <alireza0x0> 👍 |
08:56:36 | PMunch | Basically what you can do then is use a channel and one of these ThreadSignals |
08:57:01 | PMunch | Then wrap your send/recv in calls that signals and awaits the ThreadSignal |
08:57:02 | FromDiscord | <alireza0x0> yes, there are two ways in my mind |
08:57:15 | FromDiscord | <alireza0x0> one way is modify channel and using these instead of its thread conditions |
08:57:38 | FromDiscord | <alireza0x0> other way is add it as a bonus channel option and create a new field inside the chanenl |
08:57:41 | FromDiscord | <alireza0x0> (edit) "chanenl" => "channel" |
08:57:52 | FromDiscord | <alireza0x0> In reply to @PMunch "Then wrap your send/recv": yes exactly |
09:08:33 | PMunch | You don't have to change channels though |
09:08:37 | PMunch | You could just wrap it |
10:06:18 | * | PMunch quit (Remote host closed the connection) |
10:25:07 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:26:51 | FromDiscord | <gyatsoyt> anyone? |
10:28:00 | FromDiscord | <Clonkk> From the code you're showing it seems both X & Y are increasing so it can't be a line |
10:28:12 | FromDiscord | <Clonkk> A straight line would be only X or only Y increasing |
10:28:50 | FromDiscord | <Clonkk> unless by line you mean diagonal ofc |
10:29:06 | FromDiscord | <gyatsoyt> In reply to @Clonkk "unless by line you": no not diagonal |
10:29:19 | FromDiscord | <gyatsoyt> i want it to be vertical or horizontal |
10:29:30 | FromDiscord | <gyatsoyt> which is a straight line after all |
10:29:30 | FromDiscord | <Clonkk> Yes, so only X or only Y should change |
10:29:44 | FromDiscord | <Clonkk> You are changing both |
10:30:39 | FromDiscord | <gyatsoyt> In reply to @Clonkk "You are changing both": what should i change then |
10:32:33 | FromDiscord | <Clonkk> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:33:29 | FromDiscord | <Clonkk> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:34:04 | FromDiscord | <Clonkk> Why do you need to loop over x if you already know what `toX` is ? |
11:08:08 | * | PMunch joined #nim |
11:18:17 | FromDiscord | <gyatsoyt> fixed nvm |
11:23:44 | FromDiscord | <inv2004> Hello, any nimiSlide specific chat? How is it possible to make table in it ? |
11:23:53 | FromDiscord | <inv2004> (edit) "nimiSlide" => "nimiSlides" |
11:30:05 | * | krux02 joined #nim |
11:39:05 | FromDiscord | <Phil> Nothing nimislides specific.↵This would be the correct chat for it I'd say and likely requires asking the creator (which I think is active here @hugogranstrom ) |
11:39:34 | FromDiscord | <Phil> Or anyone else you can find with nimiSlides knowledge ^^ |
11:41:11 | FromDiscord | <Phil> In reply to @inv2004 "Hello, any nimiSlides specific": Worst case scenario you just write raw HTML tables |
11:41:14 | FromDiscord | <Phil> https://hugogranstrom.com/nimiSlides/tutorials/inline_html.html |
11:45:20 | FromDiscord | <hugogranstrom> In reply to @inv2004 "Hello, any nimiSlides specific": @Phil correct, I'm lurking here but I easily miss stuff so if I don't answer here, open an issue in the repo with the question 😄 I don't think we have anything for tables currently but I would recommend using the markdown syntax for tables in a `nbText` |
11:45:35 | FromDiscord | <Phil> In reply to @hugogranstrom "<@180601887916163073> correct, I'm lurking": You could just open up the discussions section on your project 😛 |
11:46:36 | FromDiscord | <Phil> https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/enabling-or-disabling-github-discussions-for-a-repository↵This should be the docs for it 😄 |
11:48:48 | FromDiscord | <hugogranstrom> In reply to @isofruit "You could just open": Good point 👍 this should be applicable to nimib in general as well (tables) |
11:49:36 | FromDiscord | <Phil> Pretty much. Imo any project that actually garners a userbase would benefit there.↵I mostly don't have it on my stuff because none of it has an actual userbase 😄 |
11:49:54 | FromDiscord | <Phil> At least none that I know of, one dude recently revealed themselves as using my lib for easy password hashing |
11:50:33 | FromDiscord | <Phil> First learned of its existence from owlkettle which uses it quite nicely |
11:51:55 | FromDiscord | <hugogranstrom> Discussions are open (I think)! |
11:52:22 | FromDiscord | <hugogranstrom> Haha yes it's always a suprise when I find out people are using my crappy code 😂 |
11:59:57 | FromDiscord | <inv2004> In reply to @hugogranstrom "<@180601887916163073> correct, I'm lurking": hm, html is pretty ugly, and I would like some kind of fragmented table. I think that table could be just preformatted text |
12:12:46 | FromDiscord | <hugogranstrom> The style of HTML tables is ugly? |
12:12:53 | FromDiscord | <hugogranstrom> And what's a fragmented table? |
12:20:36 | FromDiscord | <Phil> In reply to @hugogranstrom "And what's a fragmented": They might mean what you describe as fragments in nimislides |
12:20:50 | FromDiscord | <Phil> @inv2004 would that be a correct assumption? |
12:21:34 | FromDiscord | <Phil> And by HTML you mean writing HTML or you mean the default way HTML tables look 😛 ? |
12:21:57 | FromDiscord | <inv2004> Yep, I think that I would like to make some kind of fragmented table (like we have fragmented list already) and maybe separated fragments too |
12:22:05 | FromDiscord | <Phil> The first would be a feature request to provide "table" blocks in nimislides, the second would be learning CSS 😄 |
12:22:28 | FromDiscord | <inv2004> I am not sure - I see a lot of perfect presentation on youtube with it, and I even cannot find how to do it in in marp |
12:22:42 | FromDiscord | <inv2004> but I would like to use nimiSlides for it too 🙂 |
12:22:44 | FromDiscord | <Phil> Okay, so by fragments you mean nimislide-fragments |
12:23:52 | FromDiscord | <Phil> In that case you could open an issue for a feature request for a table-block, though that might need to go to nimib, @hugogranstrom knows the internals there better than I do |
12:25:20 | FromDiscord | <Phil> (edit) "In that case you could open an issue for a feature request for a table-block, though that might need to go to nimib, @hugogranstrom knows the internals there ... better" added "far" |
12:45:08 | FromDiscord | <hugogranstrom> Hmm an animated table could be possible, I would have to try it out. I'm not convinced it's possible to do here though |
12:45:32 | FromDiscord | <Phil> It would be sick to be able to animate individual rows to the table |
12:45:32 | FromDiscord | <hugogranstrom> But please open an issue and link to existing presentations/videos with the effect |
12:46:01 | FromDiscord | <hugogranstrom> Yeah, it all depends on if you are allowed to wrap rows in a table in `div` or not |
12:46:03 | FromDiscord | <Phil> New row added => slide-in down/left animation for now row onto the table |
12:46:10 | FromDiscord | <Phil> (edit) "now" => "new" |
12:54:38 | FromDiscord | <hugogranstrom> Yes that would be sick |
12:55:11 | FromDiscord | <hugogranstrom> I did a very quick test in some bad online editor and it looks like it should be possible |
12:55:42 | FromDiscord | <hugogranstrom> I will give it a go in the evening 😄 |
13:22:28 | * | krux02 quit (Remote host closed the connection) |
13:36:36 | FromDiscord | <inv2004> In reply to @isofruit "And by HTML you": > default way HTML tables look↵I think that both HTML or markdown tables are ok |
13:36:53 | FromDiscord | <inv2004> In reply to @isofruit "Okay, so by fragments": I have to find what is it 🙂 |
13:37:18 | FromDiscord | <inv2004> the discord chat is so complicate to use. telegram is much easier |
13:39:36 | FromDiscord | <inv2004> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:39:58 | FromDiscord | <inv2004> (edit) |
13:40:54 | FromDiscord | <inv2004> also, it would be even better if you have two tables, and can switch something like: fragment table1, then table2, then table1 again - for more complicate demonstration of the data filling |
13:45:49 | FromDiscord | <inv2004> discord eats 3% cpu constantly - WTF |
13:46:10 | FromDiscord | <inv2004> (edit) "3%" => "2-3%" |
13:48:04 | FromDiscord | <Chronos [She/Her]> It used to be worse :P |
13:48:42 | FromDiscord | <Chronos [She/Her]> But it's electron, and web devs don't typically think of most stuff like memory usage, since in a browser it's not necessary to think about it if the app gets unloaded quickly anyway |
13:55:18 | FromDiscord | <inv2004> it was not the same before last update for me. vscode and discord were +- ok |
14:03:11 | FromDiscord | <Chronos [She/Her]> No idea then |
14:10:50 | FromDiscord | <hugogranstrom> In reply to @inv2004 "I would like to": The syntax would probably be on a single slide (using fragments, will send link to docs). Animating two tables at the same time though will probably not be possible unless you want to write the html yourself |
14:11:53 | FromDiscord | <hugogranstrom> https://hugogranstrom.com/nimiSlides/tutorials/fragments/basics.html |
14:28:19 | FromDiscord | <inv2004> Yep, I saw it. But not sure how to combine it with tables |
14:28:40 | FromDiscord | <inv2004> ... and if tables exist at all |
14:35:06 | FromDiscord | <hugogranstrom> I will implement it all so it isn't decided yet |
14:35:18 | FromDiscord | <hugogranstrom> But I image an API something like this: |
14:36:49 | FromDiscord | <hugogranstrom> sent a code paste, see https://play.nim-lang.org/#ix=html> |
14:37:21 | FromDiscord | <hugogranstrom> Or something like that |
14:37:41 | FromDiscord | <hugogranstrom> So it isn't currently possible yet |
14:43:35 | FromDiscord | <gcao> sent a code paste, see https://play.nim-lang.org/#ix=html> |
14:44:15 | FromDiscord | <gcao> (edit) |
14:55:02 | * | edr joined #nim |
15:06:55 | * | PMunch quit (Quit: Leaving) |
15:09:53 | FromDiscord | <michaelb.eth> In reply to @alireza0x0 "using threadsignal (async signals)": that feature was extracted from a PR for a prototype `AsyncChannel` that wasn’t merged: https://github.com/status-im/nim-chronos/pull/45↵↵might be interesting to understand better what the problems were |
15:10:30 | FromDiscord | <alireza0x0> In reply to @michaelb.eth "that feature was extracted": ahhh |
15:10:38 | FromDiscord | <alireza0x0> im wrting and teasting asyncchannel for 6 hours |
15:10:56 | FromDiscord | <alireza0x0> damn wish you told me that earieer 😭 |
15:11:08 | FromDiscord | <alireza0x0> (edit) "earieer" => "earlier" |
15:24:31 | * | azimut quit (Ping timeout: 240 seconds) |
15:27:50 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:28:16 | FromDiscord | <gyatsoyt> i have been on this problem for hours and cant find any solution online as nim is underrated |
15:29:15 | FromDiscord | <nnsee> what problem are you having |
15:29:30 | FromDiscord | <gyatsoyt> In reply to @nnsee "what problem are you": i cannot take en passant |
15:29:40 | FromDiscord | <gyatsoyt> en passant is a special pawn move |
15:29:48 | FromDiscord | <gyatsoyt> it has some conditions to play |
15:29:52 | FromDiscord | <nnsee> your problem isn't nim related? |
15:30:01 | FromDiscord | <gyatsoyt> which i cannot understand how should i add it |
15:30:31 | FromDiscord | <gyatsoyt> In reply to @nnsee "your problem isn't nim": its probably about how should i build the logic for en passant |
15:30:52 | FromDiscord | <michaelb.eth> maybe ask in #gamedev? |
15:31:06 | FromDiscord | <gyatsoyt> In reply to @michaelb.eth "maybe ask in <#706542664643772436>?": ugh ohk |
15:35:22 | FromDiscord | <michaelb.eth> In reply to @alireza0x0 "damn wish you told": sorry, didn't see your chat earlier, I'm in US Central tz so not usually awake at that time you were chatting↵↵if you do try / try to adapt the code in closed PR 45, keep in mind it wasn't written to support gc'd types, i.e. as it was written you needed to use it with e.g. `int` or a pointer to memory in the non-gc'd shared heap, else when sending across an `AsyncChannel` to another |
15:36:33 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:38:11 | FromDiscord | <michaelb.eth> In reply to @gyatsoyt "anyone can help me": someone may see your message later today and reply; I don't know enough about chess rules to help; in the meantime maybe search web / StackOverflow / ask ChatGPT? you might need to look at a solution in a language other than Nim and then adapt what you learn to Nim |
15:38:45 | NimEventer | New thread by aiac: SIGSEGV: Illegal storage access. (Attempt to read from nil?) in coroutines, see https://forum.nim-lang.org/t/10768 |
15:39:40 | FromDiscord | <gyatsoyt> In reply to @michaelb.eth "someone may see your": well chatgpt is no good as it doesnot know that nim 2.0 exists and i couldnot find any good code on github for en passant which i coulod translate in nim |
15:40:22 | FromDiscord | <michaelb.eth> I'm sure someone will be able to help, just maybe not right away / now |
15:40:42 | FromDiscord | <gyatsoyt> In reply to @michaelb.eth "I'm sure someone will": yea i'll wait |
15:43:47 | NimEventer | New thread by gcao: How to force inline?, see https://forum.nim-lang.org/t/10769 |
16:06:32 | * | xet7 joined #nim |
16:09:44 | * | xet7 quit (Remote host closed the connection) |
16:12:19 | FromDiscord | <Phil> The last time I had to do async has been a while, did I always have to import std/asyncdispatch to use the async pragma? |
16:18:35 | FromDiscord | <Phil> I wonder what the easiest way is to figure out if a procDef is for async or not |
16:21:22 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:28:04 | * | azimut joined #nim |
16:32:21 | FromDiscord | <alireza0x0> In reply to @michaelb.eth "sorry, didn't see your": yes, im aware of that↵Ill be using pointers to my own threadsafe object.↵Thanks alot🙏 |
16:59:18 | * | mhcat joined #nim |
16:59:33 | FromDiscord | <arnetheduck> In reply to @alireza0x0 "": example of integrating chronos thread primitives with taskpools (https://github.com/status-im/nim-taskpools): https://github.com/status-im/nimbus-eth2/blob/0b9c632b6957167da7347385c1fcdfa112dd92e0/beacon_chain/gossip_processing/batch_validation.nim#L238 |
17:01:29 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:06:00 | FromDiscord | <piqueiras> lmao .del() did me dirty... |
17:09:28 | NimEventer | New thread by goldsteinq: Why is `enumerate()` a macro?, see https://forum.nim-lang.org/t/10770 |
17:17:22 | FromDiscord | <9ih> is there a nim sequence method for finding item in a sequence by predicate? |
17:17:29 | FromDiscord | <9ih> (edit) removed "nim" |
17:17:37 | FromDiscord | <9ih> I can only find .find which finds by element |
17:19:25 | FromDiscord | <9ih> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:21:27 | FromDiscord | <gyatsoyt> In reply to @graveflo "prob gunna need more": By compiling and running and then checking if it works or not |
17:22:13 | FromDiscord | <graveflo> yea its the "checking if it works" bit that I was talking about. elaborate |
17:26:33 | FromDiscord | <hugogranstrom> @Phil @inv2004 I tried to implement the tables, but it will require a rework of the fragments parts of nimiSlides (which would be needed either way). But it doesn't look too great imo. The table lines are visible all the time. So if you have 10 row, it will show all the lines all the time and just fill in the contents of the rows each step. |
17:27:07 | FromDiscord | <Phil> It's all HTML under the hood right? |
17:27:11 | FromDiscord | <Phil> If so is this a CSS issue? |
17:27:11 | FromDiscord | <hugogranstrom> Yep |
17:27:26 | FromDiscord | <Phil> Want some CSS help? |
17:27:31 | FromDiscord | <hugogranstrom> It can be solved in multiple ways I guess |
17:27:53 | FromDiscord | <hugogranstrom> It has to play nicely with Reveal.js's functionality as well |
17:27:57 | FromDiscord | <Phil> Basically if this is because some element that implicitly gets given borders by whatever renderer is used I'm 100% certain you can have CSS rules that disable that border |
17:28:29 | FromDiscord | <hugogranstrom> I'm not sure I follow |
17:29:20 | FromDiscord | <Phil> I don't know what causes the border as I don't see the HTML/CSS that gets created. I'm wondering if one can set a CSS rule so that the border doesn't exist.↵Keep in mind I know nothing of how well one can set those CSS rules or not etc. |
17:31:41 | FromDiscord | <hugogranstrom> The code isn't terribly long if you want to play around with it https://media.discordapp.net/attachments/371759389889003532/1185272984479473766/message.txt?ex=658f027c&is=657c8d7c&hm=87312bf2dd025618ec54d85f6a6a846539a492b04406cde4d54be5f294239402& |
17:31:52 | FromDiscord | <inv2004> In reply to @hugogranstrom "<@180601887916163073> <@145220624334323712> I tried": hm |
17:31:55 | * | jkl quit (Quit: Gone.) |
17:32:13 | om3ga | [Warning] executables are still not equal <- does it means compiler not built with errors? |
17:32:25 | FromDiscord | <inv2004> (edit) "hm" => "hm, but it is not too bad. I would say it is probably even better" |
17:33:49 | FromDiscord | <hugogranstrom> In reply to @isofruit "I don't know what": It seems like it sets `border-bottom` on all but the last row of the table |
17:34:07 | * | jkl joined #nim |
17:34:24 | FromDiscord | <Phil> Let me check how to get rid of it and I will 😄 |
17:35:09 | FromDiscord | <hugogranstrom> The problem is that the html is always there, it is just invisible. So I don't think the CSS can know which ones are visible and which are not |
17:35:35 | FromDiscord | <Phil> Could you make a video?↵I'm not seeing border bottoms, neither on brave nor FF |
17:35:57 | FromDiscord | <hugogranstrom> Huh, it didn't show on FF for me either but in Brave it showed |
17:36:11 | FromDiscord | <hugogranstrom> Must run it in a webserver I think |
17:36:19 | FromDiscord | <Phil> Ahhh wait there it is |
17:36:22 | FromDiscord | <Phil> Nah, wrong window for me |
17:37:17 | FromDiscord | <Phil> Okay so its a rule from black.min.css, interesting |
17:37:23 | FromDiscord | <9ih> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:37:49 | FromDiscord | <Phil> Can you add a simple `style="border:unset;"`? |
17:37:58 | FromDiscord | <Phil> To the tr elements |
17:38:04 | FromDiscord | <hugogranstrom> In reply to @isofruit "Can you add a": Oh, you want to just remove the borders? |
17:38:34 | FromDiscord | <Phil> Yeah, wont have any effect and tables without border seem alright.↵If you want to give the option you can let the user provide a bool that toggles the border on or off |
17:38:58 | FromDiscord | <Phil> Ahh wait you want to show borders, but only once the element is animated in |
17:39:07 | FromDiscord | <hugogranstrom> Okay, yes that's an option. I think borderless tables are kinda ugly though 😅 |
17:39:13 | FromDiscord | <hugogranstrom> In reply to @isofruit "Ahh wait you want": exactly |
17:39:15 | FromDiscord | <hugogranstrom> ideally |
17:39:38 | FromDiscord | <hugogranstrom> but that would probably involve some javascript-amgic changing the style programatically |
17:39:51 | FromDiscord | <Phil> Now that's a curious one, in a JS framework I'd just set a timeout to apply a corresponding rule |
17:40:39 | FromDiscord | <hugogranstrom> There are callbacks that are called every time an animation is run so it is possible |
17:41:29 | FromDiscord | <hugogranstrom> It's more of a question for me if it's worth the effort at the moment or not 😛 |
17:42:10 | FromDiscord | <Phil> The quick and hacky version:↵Add a style block and a CSS rule that removes the border.↵When you trigger the Animation trigger also a setTimeout function which adds a css class "border" to your element which adds a border back in.↵The css rule should be `tr.border{ border-bottom: 1px solid initial }` |
17:42:15 | FromDiscord | <Phil> Ah, fair |
17:42:48 | FromDiscord | <inventormatt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:44:27 | FromDiscord | <9ih> works, thanks |
17:44:28 | FromDiscord | <9ih> is that safe? |
17:44:37 | FromDiscord | <hugogranstrom> In reply to @isofruit "The quick and hacky": That's helpful, I'll remember that for when I eventually pick this up again 😄 Now the fun part, you can go both forward, but also backwards in the slides and animations 😉 |
18:04:20 | FromDiscord | <inventormatt> In reply to @9ih "is that safe?": I'm not certain but it's probably a bit safer than just grabbing a pointer to the array |
18:10:31 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:11:19 | * | azimut quit (Ping timeout: 240 seconds) |
18:15:01 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:15:47 | FromDiscord | <Phil> In reply to @griffith1deadly "why not just check": Because I'm in macro land where I am generating code and I need as part of the general code generation pipeline I need to add a discard statement for the future an async proc might return 😄 |
18:16:00 | FromDiscord | <Phil> (edit) "In reply to @griffith1deadly "why not just check": Because I'm in macro land where I am generating code and I need ... as" added "this" |
18:16:08 | FromDiscord | <Phil> (edit) removed "I need this" |
18:21:12 | FromDiscord | <michaelb.eth> In reply to @isofruit "Because I'm in macro": discard or asyncCheck?↵https://nim-lang.org/docs/asyncdispatch.html#discarding-futures |
18:21:52 | FromDiscord | <Phil> Good point, asyncCheck it is |
18:24:17 | FromDiscord | <michaelb.eth> chronos has some interesting notes re: asyncCheck / asyncSpawn:↵https://github.com/status-im/nim-chronos/blob/master/chronos/internal/asyncfutures.nim#L644-L690↵not sure if or to what extent the logic there applies to std/asyncdispatch, but may be worth consideration |
18:25:14 | FromDiscord | <Phil> Fascinatingly, it appears just running poll is not that good of a move |
18:25:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:26:18 | FromDiscord | <Phil> Ah, should've caught that, argh |
18:26:41 | FromDiscord | <Phil> ... is there a version of poll that doesn't raise exceptions?↵That seems like an expensive thing to have happen once a loop |
18:32:00 | FromDiscord | <Phil> I guess I could hide async behind a compiler flag so that users that don't want to use async in their procs don't have to live with the performance penalty |
18:35:32 | FromDiscord | <michaelb.eth> could it just be documented that if you opt-in to using async you shouldn't call `run()` until you've registered one/more handlers? |
18:39:58 | FromDiscord | <Phil> I don't think so, I don't see anything related to it at least |
18:40:15 | FromDiscord | <Phil> And it's not like runforever does either, that just does while true: poll |
18:43:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:50:06 | * | krux02 joined #nim |
18:52:21 | FromDiscord | <michaelb.eth> can you use an `await asyncSleep …` approach in the loop? |
18:56:03 | FromDiscord | <Chronos [She/Her]> Is `func visitIdentifier[T; V: Visitor[T]](v: V, node: Identifier) = v.visitIdentifier(node)` any different from `func visitIdentifier[V: Visitor](v: V, node: Identifier) = v.visitIdentifier(node)`? |
18:56:37 | FromDiscord | <Chronos [She/Her]> Like, I need to access `T` to use as a return type, but not sure if I can just do `v.T` |
18:57:10 | FromDiscord | <Chronos [She/Her]> I can do v.T :D |
18:58:14 | FromDiscord | <Chronos [She/Her]> Usable as a return type too :) |
19:00:13 | FromDiscord | <Phil> asyncSleep? |
19:00:22 | FromDiscord | <Phil> In reply to @michaelb.eth "can you use an": asyncsleep? |
19:01:33 | FromDiscord | <michaelb.eth> was trying to think of a lightweight way to register something with std/asyncdispatch’s dispatcher |
19:02:10 | FromDiscord | <Phil> So make routeMessage async so I can await inside it, then add "await asyncSleep" at the end? |
19:02:25 | FromDiscord | <Phil> And then asyncCheck the return of routeMessage? |
19:02:36 | FromDiscord | <michaelb.eth> hmm, not quite what i had in mind |
19:03:41 | FromDiscord | <Phil> Also you sure asyncsleep isn't chronos specific? |
19:03:48 | FromDiscord | <michaelb.eth> more like, before you get to the part where you poll if you kick off an async task that loops on asyncsleep in the thread that is polling |
19:04:37 | FromDiscord | <michaelb.eth> https://nim-lang.org/docs/asyncdispatch.html#sleepAsync |
19:05:07 | FromDiscord | <Phil> Oh hey, hasPendingOperations |
19:05:26 | FromDiscord | <michaelb.eth> sorry, sleepasync not asyncsleep |
19:05:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:05:52 | FromDiscord | <Phil> The if check shouldn't be tooooo bad, even if it happens once a loop |
19:06:00 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Also you *sure* asyncsleep": `sleepAsync` in Nim iirc |
19:06:38 | FromDiscord | <michaelb.eth> In reply to @isofruit "The if check shouldn't": won’t you hot spin if there’s nothing pending? |
19:06:59 | FromDiscord | <Phil> Let me check |
19:07:16 | FromDiscord | <Phil> It didn't prior because sleep and I kinda assumed poll would do the same.... oh I see what you mean |
19:07:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:08:26 | FromDiscord | <michaelb.eth> won’t that sleep block the thread from doing other stuff? |
19:08:43 | FromDiscord | <michaelb.eth> making it stutter |
19:08:49 | FromDiscord | <Phil> Yes but prevents hotspin, pretty unavoidable generally |
19:09:25 | FromDiscord | <michaelb.eth> what’s the best branch to try |
19:09:44 | FromDiscord | <Phil> From what I've seen anyway. Though I guess it should have a different config value than the value for poll |
19:10:07 | FromDiscord | <Phil> main, I don't think I'm doing anything actively on anything else |
19:10:20 | FromDiscord | <Phil> I created one for adding async support but that's only local so far as I haven't comitted anything |
19:14:00 | FromDiscord | <Phil> Like 0ms already eviscerates hotspin, 1ms drops CPU usage while idle by 99% or so |
19:14:05 | FromDiscord | <Phil> (edit) "Like 0ms ... already" added "sleep" |
19:14:19 | FromDiscord | <Phil> (edit) "Like 0ms sleep already eviscerates hotspin, 1ms drops CPU usage while idle by 99% or so ... " added "from having no sleep" |
19:15:13 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:15:41 | FromDiscord | <michaelb.eth> then you shouldn't need, `else: sleep(data.sleepMs)`, at least that's my theory |
19:15:56 | FromDiscord | <michaelb.eth> (edit) |
19:17:00 | FromDiscord | <michaelb.eth> changed it from `100` to `1000`, shouldn't matter if it doesn't run very often (relatively speaking) just so long as there's a timer registered so `poll` doesn't raise ValueError |
19:17:14 | FromDiscord | <michaelb.eth> note: I may misunderstand the problem, for sure |
19:19:52 | FromDiscord | <Phil> I... don't claim to understand how this works.↵Does this essentially introduce latency to work on async-tasks because when idle the poll() just works on sleeping= |
19:19:54 | FromDiscord | <Phil> (edit) "sleeping=" => "sleeping?" |
19:20:06 | FromDiscord | <michaelb.eth> it should not introduce latency, no |
19:20:30 | FromDiscord | <Phil> But yeah, my issue was solely that poll was erroring, this works btw. |
19:21:21 | FromDiscord | <michaelb.eth> now, what if you remove the `data.sleepMs` argument, so just `poll()` |
19:21:51 | FromDiscord | <michaelb.eth> more as a thought exercise |
19:22:05 | FromDiscord | <Phil> It's what I'm currently doing |
19:22:17 | FromDiscord | <Phil> I'm currently on a different "problem"↵I'm flabbergasted over order of execution atm |
19:22:23 | FromDiscord | <michaelb.eth> I'm guessing that then slows the rate of checking for messages to whatever the ms vaue in sleeper is |
19:22:53 | FromDiscord | <Phil> It actually does not, server remains responsive |
19:23:03 | FromDiscord | <Phil> That's why I assumed it would affect async task execution |
19:23:16 | FromDiscord | <Phil> Because that has to make the thread sleep somewhere |
19:23:27 | FromDiscord | <michaelb.eth> no, it doesn't make it sleep 🙂 |
19:23:29 | FromDiscord | <michaelb.eth> it's just a timer |
19:23:47 | FromDiscord | <Phil> Huh |
19:23:59 | FromDiscord | <Phil> So I guess we're buying into the light overhead of having a timer reset on us ever n seconds |
19:24:13 | FromDiscord | <Phil> Seems less than doing an if check 10.000x per second |
19:24:31 | FromDiscord | <michaelb.eth> sure, just so that there's something registered with the Dispatcher instance |
19:24:41 | FromDiscord | <michaelb.eth> try changing it to something large like `10.seconds` |
19:24:46 | FromDiscord | <michaelb.eth> shouldn't matter |
19:27:35 | FromDiscord | <michaelb.eth> In reply to @isofruit "I'm currently on a": I know that historically chronos made a point of scheduling callbacks in forward order while asyncdispatch scheduled them in reverse order |
19:27:43 | FromDiscord | <michaelb.eth> not sure if that's still the case |
19:27:57 | FromDiscord | <michaelb.eth> https://github.com/nim-lang/Nim/issues/7197 |
19:27:59 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:29:24 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
19:29:45 | FromDiscord | <Phil> Yeah no shit the client isn't reacting to the message, I forgot that readLine is blocking the client Thread so of course that isn't reading the response |
19:29:55 | FromDiscord | <Phil> (edit) "Yeah no shit the client isn't reacting to the ... message," added "response" |
19:30:35 | FromDiscord | <Phil> ... I want a version of readLine that timeouts and lets a loop run or sth |
19:31:59 | FromDiscord | <michaelb.eth> I think you have to do readLine in another thread and connect with a stream... I've seen that before |
19:32:21 | FromDiscord | <Phil> Yeah but that's so super complicated for a minimal async example |
19:33:07 | FromDiscord | <Phil> Well actually that should be way less complicated with threadButler, just a message sending from input-reading-thread to main-thread which then sends a message to server thread and receives the response |
19:33:24 | FromDiscord | <Phil> Still not sure I like it for a minimal example |
19:33:31 | FromDiscord | <michaelb.eth> yeah, I get you |
19:36:11 | FromDiscord | <guttural666> gottem 🤣 https://media.discordapp.net/attachments/371759389889003532/1185304315871629363/image.png?ex=658f1faa&is=657caaaa&hm=1da60e1c61382977671277caeb1f68cd9075e3915a8e6cda7cc0802d7d0263cd& |
19:36:20 | FromDiscord | <Phil> Hmm couldn't I just... do the reading from within an async proc that sleeps afterwards.... |
19:36:33 | FromDiscord | <Phil> That would allow demonstrating doubly asyncness - on the client AND on the server thread |
19:37:17 | FromDiscord | <michaelb.eth> async proc that does blocking readLine will block all async progress in the thread in which it's called |
19:37:54 | FromDiscord | <guttural666> async and threads? excellent |
19:38:29 | FromDiscord | <michaelb.eth> but maybe works with the client/server architecture you've got, the terminology confuses me a bit |
19:39:12 | FromDiscord | <michaelb.eth> I guess in this case you have a client doing readLine (so its own thread), and a client that (on its own seperate thread) will process the other client's message, and the server is like an event bus between them? |
19:41:04 | FromDiscord | <Phil> In reply to @guttural666 "async and threads? excellent": Async and threads seems doable, it's the "trying to be a minimal example" and "readingFromTerminal will block your shit" that is the problem 😅 |
19:41:26 | FromDiscord | <Phil> In reply to @michaelb.eth "I guess in this": Kinda, I mean that still goes into triple thread setups I wanted to avoid for complexity |
19:41:30 | FromDiscord | <Phil> Was trying something way dumber |
19:41:36 | FromDiscord | <guttural666> yeet into another thread 😛 |
19:41:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:41:57 | FromDiscord | <Phil> (edit) |
19:42:26 | FromDiscord | <pleiad_> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:42:33 | FromDiscord | <pleiad_> (edit) |
19:42:48 | FromDiscord | <pleiad_> (edit) |
19:43:43 | FromDiscord | <pleiad_> i want to check if every assets of filesSelected's last few characters (so file extension) matches those i allowed |
19:43:57 | FromDiscord | <pleiad_> (edit) |
19:44:29 | FromDiscord | <pleiad_> so... anyone has an idea on how to check for file extensions or atleast convert it to a sequence and read the last few characters? |
19:44:47 | FromDiscord | <michaelb.eth> > compare the last 3-4 characters↵↵you might run into a problem depending on the encoding |
19:45:08 | FromDiscord | <pleiad_> i'll only use it on my pc so Windows |
19:45:16 | FromDiscord | <michaelb.eth> `char` is effectively one byte, but Nim strings are multibyte, e.g. can be UTF-8 |
19:45:23 | FromDiscord | <michaelb.eth> In reply to @pleiad_ "i'll only use it": exactly |
19:45:41 | FromDiscord | <jviega> "encryption tool" == "ransomware"? 🙂 |
19:45:47 | FromDiscord | <michaelb.eth> probaably |
19:45:54 | FromDiscord | <pleiad_> no |
19:46:51 | FromDiscord | <pleiad_> crime bad 😠 |
19:47:12 | FromDiscord | <jviega> "These aren't the droids you're looking for" |
19:47:22 | FromDiscord | <Phil> In reply to @jviega ""These aren't the droids": No, that's beef |
19:47:38 | FromDiscord | <jviega> Heh |
19:48:22 | FromDiscord | <pleiad_> help 🙏 |
19:52:23 | FromDiscord | <Phil> Aaaand bridge dead, wanted to write through the matrix client and then nothing =/ |
19:53:20 | FromDiscord | <Phil> In reply to @michaelb.eth "but maybe works with": Nailed the first async example btw. User just got to compile with the threadButler logging flag to enable debug logging.↵Then BAM, you can enter stuff, send it to the server and see it arrive and being processed - But you only get responses 5s later |
19:54:26 | FromDiscord | <michaelb.eth> In reply to @pleiad_ "help 🙏": maybe try experimenting with https://nim-lang.org/docs/system.html#toOpenArrayByte%2Cstring%2Cint%2Cint |
19:54:28 | FromDiscord | <michaelb.eth> for starters |
19:55:33 | FromDiscord | <michaelb.eth> In reply to @isofruit "Nailed the first async": why 5s? |
19:55:58 | FromDiscord | <pleiad_> In reply to @michaelb.eth "maybe try experimenting with": found this on stackoverflow;↵cast[seq[char]]("string") |
19:56:06 | FromDiscord | <pleiad_> they both effectively do the same thing, right |
19:56:27 | FromDiscord | <pleiad_> (edit) "right" => "right?" |
19:56:34 | FromDiscord | <Phil> Because I added sleepAsync 5000 to the handler, the idea was demonstrating async working by allowing the user to send multiple messages (whose sending and arrival gets logged, proving that the first arriving does not block the others) before getting replies |
19:56:39 | FromDiscord | <jviega> No that doesn't work |
19:56:54 | FromDiscord | <Phil> I can't do anything with the replies on the client thread since that gets blocked by readLine but at least I can show logs |
19:57:18 | FromDiscord | <Phil> That did however raise the thought in me that async is kinda dangerous with channels |
19:57:39 | FromDiscord | <michaelb.eth> right, because reading from the channel...blocks |
19:57:51 | FromDiscord | <Phil> Because if the thread ever gets blocked by something that will immediately cause backpressure on the queue |
19:58:05 | FromDiscord | <Phil> And right now that eventually leads to dropped messages |
19:58:18 | FromDiscord | <Phil (he/him)> That actually makes me realize that async is pretty dangerous regarding messages and them potentially dropping |
19:58:26 | FromDiscord | <Phil> Bridge no longer dead |
19:58:27 | FromDiscord | <Phil (he/him)> Btw. I think I got the first async example going!↵If only by forcing the user to compile with the flag enabling threadButlers debug logging so they can see the logs stating that messages are being sent to the client↵(@michaelb.eth) |
19:59:16 | FromDiscord | <Phil> I'm not sure what one could do to avoid the backpressure problem, that seems like one of the fundamentals as I have encountered it before in microservice backends |
20:00:34 | FromDiscord | <jviega> I mean, backpressure is there for a reason |
20:00:43 | FromDiscord | <michaelb.eth> In reply to @isofruit "Because if the thread": this is why I wrote that "wish-list" thing in internals that I sent you the link to the other day, i.e. async is attractive because you don't want to worry about gumming up producer/consumer with blocking calls, but then you really need pervasive async support for that |
20:01:54 | FromDiscord | <michaelb.eth> maybe Alireza will have some luck resurrecting `AsyncChannel` |
20:02:23 | FromDiscord | <guttural666> we got two Phils here, things are getting serious |
20:02:55 | FromDiscord | <jviega> I really think async is more harmful than the goto. "blocking calls"... generally shouldn't be an issue to block on writes, it's waiting for reads from a remote that people worry about, and dispatchers that epoll() or even select() can manage it all just fine either way |
20:02:55 | FromDiscord | <michaelb.eth> there can be only one |
20:03:48 | FromDiscord | <Phil> I guess I'll call it a day with where I'm at?↵As a library developer I really can't give users of my library more than "I won't screw you over if you wanna do async" |
20:04:05 | FromDiscord | <Phil> Given I can't solve the backpressure problem that is on them I guess |
20:04:17 | FromDiscord | <michaelb.eth> In reply to @jviega "I really think async": yuck, so in a GUI we just sprinkle little sleeps everywhere? |
20:04:35 | FromDiscord | <jviega> Why sleep??? |
20:04:35 | FromDiscord | <Phil> Also michaelb - send recv doesn't block though, or am I missing something? |
20:04:52 | FromDiscord | <Phil> Or rather the way I do it doesn't because I use trySend, tryRecv |
20:04:56 | FromDiscord | <jviega> Thread pools. |
20:06:11 | FromDiscord | <michaelb.eth> In reply to @jviega "Why sleep???": sure, needs more context...↵what we're looking for here is a way to have uncoordinated tasks running concurrently in different threads and we need a way to communicate back-and-forth between the threads |
20:06:35 | FromDiscord | <michaelb.eth> but we don't want to block in any of the threads while waiting for messages |
20:06:47 | FromDiscord | <michaelb.eth> async provides a paradigm for that |
20:06:56 | FromDiscord | <michaelb.eth> otherwise you have to poll..sleep..poll |
20:07:00 | FromDiscord | <Phil> which we currently do not either way |
20:07:38 | FromDiscord | <jviega> Yes, and async leads to incredibly hard to follow execution flow, that can be perfectly deterministic until you make a change in a completely unrelated component that changes the scheduling order, tickling a bug somewhere else! |
20:07:40 | FromDiscord | <Phil> At least I don't think we do, tryRecv will just return if no message is there, the only thing that blocks with it is the lock acquisition on the channel |
20:07:43 | FromDiscord | <jviega> So much worse than just using threads |
20:08:02 | FromDiscord | <jviega> You do not have to poll, sleep, poll, that's silly. |
20:08:30 | FromDiscord | <Phil> Don't you have sleep at least a little bit in a while-loop to avoid it 100%ing the CPU? |
20:08:35 | FromDiscord | <michaelb.eth> exactly |
20:08:36 | FromDiscord | <Phil> (edit) "Don't you have ... sleep" added "to" |
20:08:51 | FromDiscord | <Phil> Like 1ms already will do the trick but that's still there |
20:09:24 | FromDiscord | <michaelb.eth> eh, anyway, concurrency is complex, inherently I think |
20:09:39 | FromDiscord | <jviega> No. In a generic thread pool, there's one thread that is monitoring a shitton of fds via epoll() or kqueue(), and when one fires, it effectively fires off a worker thread |
20:10:32 | FromDiscord | <Phil> I... don't understand the mental model |
20:11:16 | FromDiscord | <jviega> And frankly, if you're not waiting for an indeterminate amount of time (like for an accept) or dealing w/ things at massive volume (like 10k connections), blocking I/O is probably for the best for most things. Keep your UI on a separate thread. |
20:11:19 | FromDiscord | <Phil> I guess that's also my problem with malebolgia, I don't "get" what to use it for other than parallelizing working through a queue of tasks |
20:11:53 | FromDiscord | <jviega> For most client-sever apps, you have a server thread that listens for connections, then when you get a connection, create a thread to handle the connection. |
20:14:06 | FromDiscord | <michaelb.eth> the context here, for what Phil what got Phil working on thread butler, is a GUI that has an online chess client running, ideally, in a background thread |
20:14:23 | FromDiscord | <michaelb.eth> and there may be other task/worker threads hanging off the main GUI thread |
20:14:30 | FromDiscord | <michaelb.eth> (edit) "Phil" => "" |
20:14:36 | FromDiscord | <michaelb.eth> (edit) removed "what " |
20:15:37 | FromDiscord | <michaelb.eth> those are long-running threads, i.e. they don't simply run a task (like "compute this expensive thing") and then shut down |
20:15:41 | FromDiscord | <Phil> Yeah you might do stuff like fetch data from a leaderboard or whatnot (as an example of an async task you may do).↵Though that one I'd likely either solve with async on the server or a "GTask" on the client |
20:16:12 | FromDiscord | <Chronos [She/Her]> I have gotten SIGILL for some reason ._. |
20:16:15 | FromDiscord | <Phil> (edit) "do).↵Though" => "do in addition to the chess engine stuff).↵Though" |
20:16:41 | FromDiscord | <jviega> Sure, and while concurrency in any form is a lot more difficult, threads still are still far less error prone than async in my experience |
20:17:15 | FromDiscord | <michaelb.eth> so the threads are listening for messages from each other, and listening to input (or for response) from e.g. the network |
20:17:22 | FromDiscord | <Phil> I am prone to agree, but I think a little bit is okay |
20:17:29 | FromDiscord | <michaelb.eth> it's not at all clear how to wire it up simply |
20:17:30 | FromDiscord | <jviega> "We're so afraid of threads, we're going to re-create them except with unfair scheduling and other problems" |
20:17:51 | FromDiscord | <michaelb.eth> well in this case, I'm talking about using them together, not one or the other |
20:18:10 | FromDiscord | <michaelb.eth> Phil may not share my enthusiasm for that combo |
20:18:32 | FromDiscord | <Phil> In reply to @jviega ""We're so afraid of": I think the idea is mostly:↵If the thread with the chess-engine on is sending an http request, do I want that to introduce latency to responses from the chess-engine (for example) |
20:18:58 | FromDiscord | <Phil> In reply to @michaelb.eth "Phil may not share": I'm of the opinion I should at least enable it.↵As a library author I should try to not limit my users choices where inappropriate |
20:19:09 | FromDiscord | <Phil> If somebody wants to footgun themselves with async - They should have the choices |
20:19:10 | FromDiscord | <Phil> (edit) "choices" => "choice" |
20:19:16 | FromDiscord | <michaelb.eth> lol |
20:19:17 | FromDiscord | <Phil> That's why I swapped from sleep to poll |
20:19:19 | FromDiscord | <jviega> What's the advantage of using both other than, there's a library I want to use that uses the one I'm not using? |
20:21:41 | FromDiscord | <michaelb.eth> let GUI be in main Thread A, with chess client running in child Thread B↵A needs to listen for user input, send messages to B, and receive messages from B↵B nees to listen for messages from the network, sends messages to A, and receive messages from A |
20:22:31 | FromDiscord | <michaelb.eth> sorry for the typos, resisting temptation to fix all of them because I now it sucks for the IRC people |
20:22:53 | FromDiscord | <Phil> I know that pain and given up for lack of self control 😅 |
20:23:10 | FromDiscord | <michaelb.eth> my laptop keyboard is dying, which makes it worse of late |
20:24:12 | FromDiscord | <jviega> That's not how I'd structure any of it. But again, you can do that where, if A has no work to do, it's just epoll()ing on the fd for its remote partner, and, for instance, a pipe to communicate w the GUI thread. The GUI thread can do the same thing w/ a very short timeout if it needs to do crap if idle |
20:24:15 | FromDiscord | <Phil> I think jtvs suggestion is more:↵It's fine to have 2 long running threads that keep ping ponging, why not just create a third thread that does a blocking task (like IO) and pings a message back when done that you do stuff with then |
20:24:50 | FromDiscord | <Phil> Is my current understanding because the mental model with the monitoring thread firing up worker threads everywhere I don't understand at all |
20:24:57 | FromDiscord | <jviega> Yeah, that's more traditional, it's perfectly reasonable to more discretely break up IO tasks and have them on short-lived worker threads |
20:25:13 | FromDiscord | <jviega> You generally keep a 'pool' of available threads you can wake up whenever there's work |
20:25:23 | FromDiscord | <jviega> In the thread pooling model |
20:25:37 | FromDiscord | <Phil> Yeah, that one I can wrap my head around, basically a connection pool like for db connections (I do webdev, please forgive me 😄 ) |
20:26:23 | FromDiscord | <Phil> But how to fit that into "I need to have a long running thread interact with the chess engine and keeping the state around" in a manner that doesn't suck seems difficult to me |
20:27:17 | FromDiscord | <Phil> I guess though that ideally there's also support for easy ways to do work in another thread, threadButler currently only supports setting up threads in a multiple long-running thread scenario |
20:27:29 | FromDiscord | <Phil> (edit) "I guess though that ideally there's also support for easy ways to do work in another ... thread," added "short lived" |
20:28:43 | FromDiscord | <jviega> So file descriptors are just integers that index into a list of files (sockets and everything else are all treated mostly uniformly as files). If you have something you want to write, and there might be stuff to read, you can use a call to ask the system, "which of these are available for me to use?" For writing, can they accept a message. For reading, is there data ready to read. You can also phrase it to say, "wake me up when ANY of thes |
20:28:47 | FromDiscord | <jviega> And that's just in one thread. |
20:29:16 | FromDiscord | <Phil> I guess I could provide helpers to spawn a short-lived task-thread and hand that worker-thread a pointer to the ChannelHub I have (with channels to all long-running threads) so it can message those threads with whatever |
20:30:05 | FromDiscord | <jviega> So, even w/o switching to non-blocking IO, you can quite handily in a single thread multiplex a bunch of file descriptors without ever blocking unless there's literally nothing to do |
20:31:46 | FromDiscord | <jviega> There are some minor asterisks, like when the system says, "okay, this fd is ready for write", you can only write so many bites (PIPE_BUF) before it might block, so you have to limit your write then go again. But in general, you can easily have one thread handle it's network connection and a GUI connection without spreading the connection's across extra threads, and without risking hanging the gui |
20:32:11 | FromDiscord | <jviega> And none of that requires async. |
20:37:57 | FromDiscord | <michaelb.eth> any examples of a multi-threaded desktop GUI built in that fashion? not necessarily in Nim, of course↵↵I try to keep an open mind about this kind of thing and be willing to consider different approaches; but I'm having trouble imagining what the implementation looks like |
20:38:46 | FromDiscord | <michaelb.eth> Qt has its signals/slots implementation, maybe it uses something like you're describing under the hood |
20:39:18 | FromDiscord | <jviega> I mean, they all used to be that way until fairly recently, yes. |
20:39:25 | FromDiscord | <Phil> I mean, same, mostly because webdev has drilled the entire paradigm of 2+ long running threads communicating with one another (client - server) paradigm so hard into my head that alternatives become hard to imagine |
20:39:57 | FromDiscord | <Elegantbeef> Are we at the selectors portion of this IO conversation? 😄 |
20:40:01 | FromDiscord | <michaelb.eth> In reply to @isofruit "I mean, same, mostly": sure, makes sense, and for my part I'm thinking about web workers interacting with each other |
20:40:12 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "Are we at the": prolly soon |
20:41:07 | FromDiscord | <Phil> Not with me, I'm busy implementing a helper to easily spawn threads so they can do the blocking work so you can use that instead of async if you want... that is on top of async support since that wasn't so hard to provide |
20:42:37 | FromDiscord | <Elegantbeef> So did you look at the mocking code phil?! |
20:42:44 | FromDiscord | <Elegantbeef> It's been like 10 hours, you ought to have by now |
20:42:55 | FromDiscord | <Phil> Fuck no I didn't, I jumped from work straight into an idea for async |
20:42:56 | FromDiscord | <Phil> Ahhhhhh |
20:43:09 | FromDiscord | <Elegantbeef> I even named it rickles, cmon that's genius |
20:43:11 | FromDiscord | <Phil> Wait, correct punctuation is:↵Fuck. No, I didn't |
20:46:13 | FromDiscord | <Phil> Give me just a bit to think on how much I can or should limit tasks |
20:47:35 | FromDiscord | <jviega> Man, I have a task that taks < 1s w/ debug off, but 18.5 secs when debug is on. Wow. |
20:48:15 | FromDiscord | <Elegantbeef> Coincidentally I realise now this mocking API is a perfect way of exposing generic procedures as a library |
20:49:14 | FromDiscord | <Elegantbeef> Since it emits a global pointer proc it gives us something we can export, and it's automated |
20:49:52 | FromDiscord | <Phil> Hmm so you spawn a 1-off worker thread that's only going to live for like 5s for doing an HTTP call then sending a message to the main thread with the response.↵Should, or should it not, have access to the entire ChannelHub to send messages to whatever thread it pleases with however many messages, or should I limit that so I only let it fire a single message once |
20:50:53 | FromDiscord | <Phil> I guess artificially limiting options doesn't really make sense when the amount of effort for somebody to spawn their own task with such access is like 3 lines of code |
20:52:07 | FromDiscord | <graveflo> huh? Do whatever is easier or if it is a requirement that there shall only be one request and you cannot control how someone will use the single dispatch then consider adding the restriction. Otherwise why bother? |
20:52:09 | FromDiscord | <guttural666> is this de way, or is it on the same column? nimpretty doesn't even care: https://media.discordapp.net/attachments/371759389889003532/1185323434260037632/image.png?ex=658f3178&is=657cbc78&hm=06de45f0d0f786d962d60052e8098313946cc8e05bd6b83ee5ba3f15e4ab5fc2& |
20:52:30 | FromDiscord | <michaelb.eth> In reply to @guttural666 "is this de way,": you can even drop the `:` after `idx`, it's optional |
20:52:52 | FromDiscord | <Phil> No it isn't, ont with me in your code review! |
20:52:57 | FromDiscord | <Phil> (edit) "ont" => "not" |
20:52:58 | FromDiscord | <michaelb.eth> you need the `:` after the `of 0`, though |
20:53:18 | FromDiscord | <Elegantbeef> I put the case on the same column as `of` |
20:53:26 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "I put the case": the one true way |
20:53:29 | FromDiscord | <Elegantbeef> Some prefer it indented I do not see the benefit, you do you |
20:53:32 | FromDiscord | <Phil> Same |
20:53:36 | FromDiscord | <guttural666> I realized that, yeah |
20:54:07 | FromDiscord | <Phil> The main reason I do it not because of preference but because the compiler does it |
20:54:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:54:29 | FromDiscord | <Phil> fuck |
20:54:56 | FromDiscord | <guttural666> kinda feel that things subordinate to some higher thing should be indented, dunno |
20:55:26 | FromDiscord | <Phil> I am proceeding to switch sides so I can declare the compiler generated case statements as wrong and bad and nobody should write it that way |
20:56:56 | FromDiscord | <graveflo> if `of` was a keyword that only had any relation to `case` statements there would be no reason to indent. Still isn't really a reason. Makes it a little weird tho |
20:57:26 | FromDiscord | <Phil> In reply to @Elegantbeef "https://github.com/beef331/nimtrest/blob/master/ric": Okay if that fully works thats nuts |
20:57:32 | FromDiscord | <guttural666> nitting hard, but I think style and reasoning about it is important, I work in a code base where everything looks like dysentery written by a hooligan and nobody cares |
20:58:10 | FromDiscord | <graveflo> that would really annoy me |
20:58:51 | FromDiscord | <michaelb.eth> In reply to @guttural666 "nitting hard, but I": lol, what lang? |
20:58:53 | FromDiscord | <guttural666> In reply to @graveflo "that would really annoy": you have your fingers on CTRL+ALT+DEL every time you look into "legacy" or BearingPoint code I swear to god |
20:59:41 | FromDiscord | <guttural666> In reply to @michaelb.eth "lol, what lang?": ABAP, it's an absolutely wild cesspool of mediocrity and carelessness |
21:00:16 | FromDiscord | <Phil> In reply to @guttural666 "ABAP, it's an absolutely": Given what I heard about ABAP, I envy your paycheck, my condolences to your mental strain |
21:00:45 | FromDiscord | <michaelb.eth> yuck |
21:01:02 | FromDiscord | <guttural666> In reply to @isofruit "Given what I heard": paycheck isn't what it used to be, but good standard SE money, but the attitude, quality control etc. in those circles is wild |
21:01:22 | FromDiscord | <guttural666> (imo) |
21:01:31 | FromDiscord | <graveflo> I stumble across these things and can't believe they exist. Even now. So corporate. Such a mistake. ugh |
21:01:42 | FromDiscord | <Phil> Doesn't it got 6 figures rather quickly? |
21:01:46 | FromDiscord | <Phil> go |
21:02:28 | FromDiscord | <Phil> That was my last info on the topic: Get good at ABAP and have fun in your sparetime because you won't at work |
21:02:33 | FromDiscord | <guttural666> nah, not in Europe at least, US is another topic, but that's capitalist dystopia where cost of living is obscene |
21:02:36 | FromDiscord | <Phil> (edit) "work" => "work, but enjoy the money" |
21:03:07 | FromDiscord | <michaelb.eth> In reply to @guttural666 "nah, not in Europe": depends a lot on where you live in the US, of course |
21:03:23 | FromDiscord | <michaelb.eth> though inflation has hit everyone/where of late, for sure |
21:03:55 | FromDiscord | <guttural666> ABAP is honestly great and I enjoy it immensly, it's a great language and very suitable for the job, pleasant to write, but the "scene" is terrible |
21:04:45 | FromDiscord | <michaelb.eth> do you work as a consultant or an internal team? |
21:05:26 | FromDiscord | <guttural666> In reply to @michaelb.eth "depends a lot on": yeah, just overgeneralizing, Europe, it's up to 70-90k € if you're 5 years in, maybe around 100-110k in some places and with seniority etc. |
21:05:33 | FromDiscord | <guttural666> internal |
21:05:58 | FromDiscord | <michaelb.eth> related question, since you mentioned a consulting firm, is it their attitute/practices re: code quality that have rubbed off on everyone else, or why is it so bad? |
21:06:52 | FromDiscord | <guttural666> sometimes it's like you presenting your consulting findings to a customer in comic sans, that's how bad even the style of the code is from third parties |
21:07:14 | FromDiscord | <Phil> What happens if I spawn a thread that eventually finishes and I just never call joinThread(that thread) ? |
21:07:25 | FromDiscord | <Phil> My own thread will definitely outlive that other thread |
21:07:37 | FromDiscord | <guttural666> style, cleanlyness etc. is the tip of the iceberg, not even talking about performance, bad practices, just bad design etc. |
21:07:48 | FromDiscord | <jviega> Sheesh, 25 years ago I made more than 90K € less than 12 months out of college, on the east coast. West coast could have done even better. Europe really doesn't pay people fairly |
21:08:35 | FromDiscord | <michaelb.eth> the worst thing I ever encountered was when I agreed to help (pro bono) a friend who had decided to go to grad school and was struggling with programming related to the lab work he and the other grad students were responsible for↵↵turned out they (and the lab director) passed all the code around in Word documents, with change tracking |
21:08:40 | FromDiscord | <guttural666> In reply to @jviega "Sheesh, 25 years ago": cost of living is way lower than say Cal, I'm considered a well paid engineer with 80k or whatever I get here |
21:08:51 | FromDiscord | <jviega> I'm talking about rural east coast. |
21:08:59 | FromDiscord | <jviega> I was not in california. |
21:09:21 | FromDiscord | <guttural666> yeah, but factor in social servives. health care, 35 hour work week |
21:09:34 | FromDiscord | <jviega> And I had no problems finding 80K starting salaries 25 years ago. Don't think a classmate did less than 60k |
21:09:51 | FromDiscord | <jviega> Factor in inflation. |
21:09:55 | FromDiscord | <michaelb.eth> what % of your income goes to taxes, or is that number after taxes |
21:10:03 | FromDiscord | <michaelb.eth> for @guttural666 |
21:10:21 | FromDiscord | <Phil> Them's just bonkers numbers |
21:10:24 | FromDiscord | <jviega> I have had plenty of employees in Europe, the comp is a LOT lower than what they'd be worth in the US. Which makes it easy when I hire europeans... I pay them what they'd make in the US. |
21:11:13 | FromDiscord | <Phil> Of course I'm not in embedded, just webdev, but what I could find if I went back to 40h or so is ~70k, or at least was around the time the inflation wave hits |
21:11:16 | FromDiscord | <Phil> (edit) "hits" => "hit" |
21:11:23 | FromDiscord | <guttural666> 42% taxes, when I was living in the city of my work I was paying like 20% of my net wage for my appartment something like that |
21:11:34 | FromDiscord | <guttural666> (edit) "42% taxes, when I was living in the city of my work I was paying like 20% of my net wage ... for" added "(after taxes)" |
21:12:11 | FromDiscord | <jviega> Right and in the US the employer bears most of the the healthcare cost so net out of paycheck is generally only about 40%. |
21:13:28 | FromDiscord | <guttural666> yeah, it's a bit difficult to compare, I'd get 2800 and pay 650 for rent with 5 years on the job |
21:13:47 | FromDiscord | <guttural666> (edit) "yeah, it's a bit difficult to compare, I'd get 2800 ... and" added "(net)" |
21:13:59 | FromDiscord | <michaelb.eth> it's such a huge gulf in the US if you have to pay for your own health insurance vs. a decent plan offered by an employer; but that will start drifting into offtopic subject |
21:14:06 | FromDiscord | <guttural666> (edit) "(net)" => "(net, health and social incl.)" |
21:14:23 | FromDiscord | <guttural666> (edit) "incl.)" => "already subtracted)" |
21:14:54 | FromDiscord | <jviega> My point is you lot in europe are mainly underpaid, no need to argue against your own economic best interests there 🙂 |
21:14:57 | FromDiscord | <guttural666> (edit) "yeah, it's a bit difficult to compare, I'd get 2800 (net, health and social ... already" added "incl. unemployment insurance" |
21:15:29 | FromDiscord | <graveflo> idk it sounds like the figures guttural gave would be pretty normal here in the states |
21:15:33 | FromDiscord | <Phil> I won't disagree, I just can't claim to find better, which may of course have to do with my area though I hope not with my skillset |
21:15:44 | FromDiscord | <graveflo> it would be normal to pay double that for rent and also have medial copays too |
21:15:45 | FromDiscord | <guttural666> not sure, most SE in the US don't have 35 hour work weeks and health + unemployment + other stuff included |
21:15:57 | FromDiscord | <guttural666> we just pay the state more to take care of social security |
21:16:02 | FromDiscord | <jviega> Depends on where you live. |
21:16:34 | FromDiscord | <jviega> And health is generally limited to some very small amount in tech jobs. Unemployment is a social service here. |
21:16:52 | FromDiscord | <graveflo> of course, but I'm just saying that's quite normal around where I live at least. You can get a much higher paying job but its not an out of the ordinary split |
21:17:38 | FromDiscord | <jviega> Where do you live? |
21:17:55 | FromDiscord | <graveflo> east coast near NYC, DC and Philly |
21:18:22 | FromDiscord | <guttural666> we may be way offtopic 😛 |
21:18:28 | FromDiscord | <guttural666> interesting discussion tho |
21:20:00 | FromDiscord | <jviega> So I'm in NYC and grew up near DC. Last time I was hiring devs out of university, they were all getting offers of $100-$120K pretty much anywhere. Lowest I've seen in years is prob $85K. And most places you can just live in Poukeepsie if you want cheap rent 🙂 |
21:20:41 | FromDiscord | <graveflo> yep thats quite typical too |
21:22:52 | FromDiscord | <guttural666> dunno, just a lot of factors to consider, I'd love to go to the US again to work there for a couple years, but not really keen on live there permanently |
21:24:01 | FromDiscord | <michaelb.eth> maybe wait a few years, see if we melt down into civil war and total chaos |
21:25:01 | FromDiscord | <guttural666> yeah, either a civil war, or I can apply to managing the IT in US atomic vaults 😛 |
21:25:42 | FromDiscord | <guttural666> Kobol for the systems of a fallout vault anybody? 😛 |
21:26:07 | FromDiscord | <guttural666> (edit) "Kobol" => "Cobol" |
21:27:11 | FromDiscord | <graveflo> we are really going to make that mistake again huh? |
21:27:18 | FromDiscord | <michaelb.eth> http://www.coboloncogs.org/HOME.HTM |
21:29:50 | FromDiscord | <guttural666> hahaha 😄 |
21:32:43 | * | azimut joined #nim |
21:33:38 | FromDiscord | <farklenaut> quick question if I have a char what is the best/fastest way to get a string? |
21:33:56 | FromDiscord | <graveflo> `$` |
21:34:23 | FromDiscord | <farklenaut> so if I have `mystring[^1]` and I want that as a string, adding that in front will work? |
21:34:31 | FromDiscord | <graveflo> yes |
21:35:27 | FromDiscord | <farklenaut> I'm trying to parse the char as an int and I'm getting type mismatch |
21:35:36 | FromDiscord | <farklenaut> even with the $ |
21:35:44 | FromDiscord | <graveflo> but you could prob also do `mystring[^1..^1]` |
21:36:07 | FromDiscord | <Elegantbeef> Ugh `{.global.}` does not make it so you can access a symbol outside of a procedure |
21:36:30 | FromDiscord | <guttural666> myint pls = mychar.parseInt() maybe? |
21:36:42 | FromDiscord | <guttural666> (edit) removed "pls" |
21:36:49 | FromDiscord | <guttural666> (edit) |
21:37:01 | FromDiscord | <graveflo> In reply to @farklenaut "I'm trying to parse": `($mystring[^1]).parseInt` |
21:37:31 | FromDiscord | <farklenaut> In reply to @guttural666 "let myint = mychar.parseInt()": type mismatch, expects string |
21:38:08 | FromDiscord | <guttural666> yeah, convert to string with $, see https://nim-lang.org/docs/strutils.html#parseInt%2Cstring |
21:38:09 | FromDiscord | <graveflo> In reply to @graveflo "`($mystring[^1]).parseInt`": `mystring[^1..^1].parseInt`↵both of these work |
21:38:19 | FromDiscord | <jviega> Well, `$s[^1]` returns a string if `s` is a string, don't know what to tell you. |
21:38:35 | FromDiscord | <graveflo> its order of operations |
21:38:49 | FromDiscord | <nixfreak> Thats is interesting↵(@michaelb.eth) |
21:39:10 | FromDiscord | <graveflo> `$mystring[^1].parseInt` -> `$(mystring[^1].parseInt)` |
21:39:12 | FromDiscord | <Elegantbeef> If it's a char you just do `(myChr.ord - '0'.ord)` |
21:39:43 | FromDiscord | <graveflo> yea that's the typical way to do it.. as in do that one LOL |
21:40:40 | FromDiscord | <michaelb.eth> In reply to @nixfreak "Thats is interesting (<@383034029135364096>)": I think that one is a joke, but it inspired a real one: COBOL on Wheelchair |
21:42:24 | FromDiscord | <michaelb.eth> https://github.com/azac/cobol-on-wheelchair/tree/master↵↵https://raw.githubusercontent.com/azac/cobol-on-wheelchair/master/images/logo.png |
21:44:43 | FromDiscord | <michaelb.eth> also, fun fact, the GnuCOBOL is one of the longest web pages you can find: https://gnucobol.sourceforge.io/faq/ |
21:45:01 | FromDiscord | <michaelb.eth> (edit) "also, fun fact, the GnuCOBOL ... is" added "FAQ" |
21:47:17 | FromDiscord | <nixfreak> A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup or mustard. |
21:48:01 | FromDiscord | <graveflo> I didn't know ketchup and mustard were the ingredients in the worlds most efficient cakes |
21:48:18 | nmz | what's wrong with fortran |
21:48:31 | FromDiscord | <nixfreak> Ruby on Rails? Don’t forget COBOL ON COGS. |
21:48:56 | FromDiscord | <guttural666> In reply to @Elegantbeef "If it's a char": chad version |
21:48:58 | nmz | I've seen fortran code in rosetta code and so on and it looks better than C |
21:49:25 | nmz | except when its SCREAMING CAPS code |
21:49:28 | FromDiscord | <nixfreak> Fortran is better than C |
21:51:17 | FromDiscord | <Elegantbeef> C really can go to hell |
21:51:28 | FromDiscord | <Elegantbeef> How the hell does one declare a pointer procedure based off the type of another procedure |
21:51:50 | FromDiscord | <Elegantbeef> `typeof(...) name = default;` fails cause C says "No" |
21:54:57 | FromDiscord | <Elegantbeef> Oh shit finally 😄 |
21:55:14 | FromDiscord | <Elegantbeef> `typeof(proc) name = default;` |
21:56:17 | FromDiscord | <Elegantbeef> There we go Phil now rickles works everywhere |
21:56:43 | FromDiscord | <Elegantbeef> Just need a `emitAllPointerProcs` in your code to actually emit symbols before procs are declared |
21:59:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:00:25 | FromDiscord | <Phil> Aww man, that sucks, I can't just make a thread for an off-hand task without running joinThread somewhere |
22:00:34 | FromDiscord | <Phil> Which will block my current thread |
22:00:36 | FromDiscord | <Phil> Dangit |
22:01:02 | FromDiscord | <Elegantbeef> I mean you can |
22:01:11 | FromDiscord | <Phil> Not without segfaults I can't |
22:01:34 | FromDiscord | <Elegantbeef> Don't let your thread outlive the data it works with |
22:02:37 | FromDiscord | <Phil> Wait it... oh right that would get collected the second the handler-proc spawning the task returns |
22:03:01 | FromDiscord | <Elegantbeef> Well if you have `ptr Container` your thread cannot outlive that scope |
22:03:08 | FromDiscord | <Elegantbeef> If so UB happens |
22:03:13 | FromDiscord | <Phil> Nah, entirely unrelated |
22:03:26 | FromDiscord | <Elegantbeef> Well I'm just assuming what you're doing forgive me |
22:03:29 | FromDiscord | <Phil> Actually, not entirely, still same project, but what's blowing up on me isn't the hub |
22:03:34 | FromDiscord | <graveflo> it's extra effort but I've never gotten away with doing anything thread related without a container that holds active threads and a message queue for the threads to at least say "hey im dying now". That way cleaning up is easier |
22:03:56 | FromDiscord | <Elegantbeef> Hey RCU doesn't need any of that! 😛 |
22:04:02 | FromDiscord | <Phil> RCU? |
22:04:19 | FromDiscord | <graveflo> is that like daemon mode or something? |
22:04:30 | FromDiscord | <Elegantbeef> It's a lockfree data structure that allows mutations, but it's not very useful as it's not accurate |
22:04:52 | FromDiscord | <Phil> hmmmmmmmmmm can I just copy the data to the thread so it doesn't segfault is the question |
22:05:06 | FromDiscord | <jviega> It's not a data structure, it's a generational memory management approach for lock-free data structures |
22:05:12 | FromDiscord | <Elegantbeef> It allows multiple threads to iterate a list and thanks to the fact replacing pointers is atomic it ignores race conditions by allowing threads to operate on incorrect data |
22:05:16 | FromDiscord | <graveflo> lol pretty sure if there is no segfault to be had a segfault will not occur |
22:05:40 | FromDiscord | <Phil> Actually nevermind, it blows up even without accessing any of the data |
22:05:46 | FromDiscord | <Elegantbeef> Eh everything is a data structure to my uneducated mind |
22:06:31 | FromDiscord | <jviega> "not accurate" depends on how you build on top if it, and your idea of what accuracy means. Linearizability is the typical gold standard, and that's supportable via RCU and similar schemes |
22:08:00 | FromDiscord | <Elegantbeef> Well I'd argue that RCU explicitly implies a lack of 'accuracy' since no thread is guaranteed to iterate the fully mutated list |
22:08:08 | FromDiscord | <Elegantbeef> But sure it's up to the reader |
22:08:52 | FromDiscord | <Elegantbeef> Not saying it's not a useful thing, but it's more useful for things like process managers |
22:10:13 | FromDiscord | <Elegantbeef> Phil what are you doing now? |
22:14:13 | FromDiscord | <jviega> False |
22:14:28 | FromDiscord | <jviega> You can absolutely use schemes like that to provide 100% consistent views |
22:14:44 | FromDiscord | <graveflo> beef you say its a lock free data structure, allows mutations and "replacing pointers is atomic" but why is that special in any way? That just sounds like any other threading-unaware data structure |
22:15:01 | FromDiscord | <Phil> In reply to @Elegantbeef "Phil what are you": Trying to do async without async.↵Basically the idea is do a one-off thread that I does a thing and dies and I don't have to wait for it on my current thread to complete |
22:15:03 | FromDiscord | <Elegantbeef> It's important cause it allows you to replace next without any race conditions |
22:15:05 | FromDiscord | <jviega> I have been doing it for years, and will point you to my lock free data structures that I've pointed you to before, where you've shown no interest 🙂 |
22:15:34 | FromDiscord | <Elegantbeef> I mean I do not do multi threading |
22:15:38 | FromDiscord | <graveflo> oh so its link list based and there isn't anything special about it, its just the atomic op that is exploited |
22:15:43 | FromDiscord | <jviega> No |
22:15:55 | FromDiscord | <Elegantbeef> You do not free the data that the next points to until all readers are done |
22:16:13 | FromDiscord | <Phil> Basically inspired by what jtv talked earlier about doing multitasking without async, avoiding it by just spawning it thread, letting it to the async stuff and you can remain doing your stuff |
22:16:24 | FromDiscord | <Phil> a thread |
22:16:26 | FromDiscord | <jviega> That's all the memory management schemes aim to do. You can build all sorts of lock-free data structures |
22:17:00 | FromDiscord | <Phil> Argh, not letting it do the async stuff, I mean letting it do the blocking stuff |
22:17:03 | FromDiscord | <Elegantbeef> A primitive RCU implementation is just a linked list that when you `delete` stores that into a list to be removed after the `reader`s all finish reading |
22:17:06 | FromDiscord | <graveflo> okay I think I get the idea. Pretty neat |
22:17:09 | FromDiscord | <Phil> I really should concentrate more on what I write |
22:17:20 | FromDiscord | <jviega> I've got a dictionary, set, seq / list, stack, flex-array, and ring buffer IIRC |
22:17:58 | FromDiscord | <Elegantbeef> With modern PCs it probably makes more sense to use a sequence of ints + sequence of data |
22:18:24 | FromDiscord | <jviega> Most memory allocation implementations heavily relies on linked lists for managing a free list. That's nothing unusual about rcu |
22:18:38 | FromDiscord | <graveflo> I was originally thinking of a round buffer but that just felt too boring |
22:19:06 | FromDiscord | <graveflo> too boring for a thing with a fancy name |
22:19:18 | FromDiscord | <jviega> No, I have done a lot of timing vs well optimized locking alternatives, and for those things, the lock free implementation is faster in most scenarios, primarily because there's no case where progress stalls due to something holding a lock getting context-switched out. |
22:21:52 | FromDiscord | <Elegantbeef> Now I wonder if there is any merit in auto exporting any instantiations of a generic procedure across a library.... |
22:22:04 | FromDiscord | <Elegantbeef> Or if a `let x {.exportc, dynlib.} = someProc[T]` is smarter 😄 |
22:24:46 | FromDiscord | <guttural666> is when used for compile time execution only, or conditional compilation of a block as well, chatGPT confused me |
22:25:04 | FromDiscord | <guttural666> trying to use when defined(prod) for conditional compilation |
22:25:07 | FromDiscord | <Elegantbeef> It's compilation dependent blocks |
22:25:20 | FromDiscord | <Elegantbeef> `when defined(...): ...` only checks the body when `defined(...)` is true |
22:25:33 | FromDiscord | <jviega> You can def think of it as a compile-time if-statement that decides what code to use |
22:25:40 | FromDiscord | <jviega> You can use 'else' and 'elif' with it |
22:25:46 | FromDiscord | <Elegantbeef> `if defined(...): ....` will always check the body but only run it if `defined(...)` is true |
22:25:59 | FromDiscord | <Elegantbeef> Can even make macros to wrap it to make it 100000% more sane 😄 |
22:26:22 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/staticcases.nim#L57-L99 examples of that 😄 |
22:27:22 | FromDiscord | <Elegantbeef> Do I ever wish `staticCase` and `typeCase` were builtins |
22:27:34 | FromDiscord | <guttural666> so when defined(prod): do_in_prod(), the do_in_prod() will only be compiled into my code if prod is defined |
22:27:42 | FromDiscord | <Elegantbeef> In hindsight probably `whenCase` and `whenType` is more sensible |
22:27:44 | FromDiscord | <Elegantbeef> Yes |
22:27:52 | FromDiscord | <guttural666> okay, nice |
22:28:45 | FromDiscord | <Elegantbeef> You can even do wild things like `when compiles(someExpr): someExpr` 😛 |
22:30:14 | FromDiscord | <Phil> Alrighty, threadbutler supports async, tasks will have to wait, I don't get how to make it work and owlkettle already has GTask + whatever utilities I provide a skilled programmer likely could write themselves anyway so eh |
22:30:34 | FromDiscord | <graveflo> In reply to @Elegantbeef "`if defined(...): ....` will": would this just replace the `defined` call with a boolean literal? |
22:30:42 | FromDiscord | <Elegantbeef> Yes |
22:30:52 | FromDiscord | <Phil> Time to deal with my other worst enemy: docgen |
22:30:54 | FromDiscord | <Elegantbeef> Constant folding is cool |
22:33:01 | FromDiscord | <jviega> sent a long message, see <!doctype html> |
22:33:20 | FromDiscord | <jviega> On Intel, it's a bit closer to even, but lockless still wins most of the time. |
22:33:41 | FromDiscord | <jviega> And these are wait free, not just lock free, which tend to be a bit slower, but w/ firm guarantees of progress |
22:34:03 | FromDiscord | <Elegantbeef> Maybe I'm an idiot, but lockless winning is not surprising to me |
22:34:16 | FromDiscord | <Phil> This would be a lot neater if I could stop it so I could actually look at the numbers 😄 |
22:34:27 | FromDiscord | <zectbumo> jtv, how do you make gifs? |
22:34:40 | FromDiscord | <Elegantbeef> Hey jtv wrote a cli program he's gotta get the money out of it |
22:35:06 | FromDiscord | <graveflo> You'd expect efficiency to go up when you make a relaxation. Just don't overcompensate ig |
22:35:26 | FromDiscord | <jviega> Oh most people assume locks are more efficient; it used to be there weren’t good approaches for lock free for most data structures |
22:35:48 | FromDiscord | <Phil> Huh, my preconception is just that lock-free is more difficult to get correct |
22:35:52 | FromDiscord | <Elegantbeef> Well waiting around for a lock generally takes time |
22:35:55 | FromDiscord | <Phil> Not necessarily that its slower |
22:36:10 | FromDiscord | <jviega> Sorry if I were at my desk not in my phone I’d convert it to 1/4 speed for you lol |
22:36:12 | FromDiscord | <Elegantbeef> Lock free should be faster cause you do not have to wait, it just requires being smarter |
22:36:35 | FromDiscord | <Phil> ~~Basically: Skill issue~~ |
22:36:44 | FromDiscord | <graveflo> it's more efficient if you use sleep and make sure it's a nice long rest. no one runs smoothly when REM is interrupted |
22:37:02 | FromDiscord | <jviega> No, that’s not generally true, especially when there’s typically no contention for locks |
22:37:12 | FromDiscord | <guttural666> why web crawler is doing its first long test, so exciting 🥹 |
22:37:26 | FromDiscord | <Elegantbeef> He I said I'm an idiot |
22:37:33 | FromDiscord | <Elegantbeef> Hey\ |
22:37:48 | FromDiscord | <Elegantbeef> I'm also speaking in generalities of what I've done/seen |
22:37:54 | FromDiscord | <jviega> The main place there’s a clear advantage for lockless is because of context switching while holding a lock |
22:38:10 | FromDiscord | <Elegantbeef> Nim channels for instance is easy to get yourself into a lock race |
22:38:29 | FromDiscord | <Elegantbeef> Share one channel to multiple threads now you're waiting if you do `send` |
22:38:40 | FromDiscord | <guttural666> (edit) "why" => "my" |
22:39:25 | FromDiscord | <graveflo> In reply to @jviega "The main place there’s": yea this does make sense. Everyone is abuzz with context switching appeasement nowadays. It's how it works |
22:39:40 | FromDiscord | <Phil> I feel more and more validated in using `trySend` rather than `send` to avoid that scenario. |
22:40:08 | FromDiscord | <Elegantbeef> Well `trySend` either means you drop the message or wait until you can send it |
22:40:21 | FromDiscord | <jviega> I mean the great thing about lock free data structures is the progress guarantee |
22:40:23 | FromDiscord | <Phil> Yeah but it means it's the user that gets to decide if that happens or not |
22:42:10 | FromDiscord | <jviega> But those hash tables are all almost identical save for a few instructions. |
22:43:38 | FromDiscord | <jviega> Yet, you cant really deadlock w the locking one; you could if the thread died holding the lock, but the lock is never held past the library call boundary so isn’t realistically a worry |
22:48:27 | FromDiscord | <jviega> But I’m particularly tired w Nim community false claims on lockless; have even seen araq claim you can’t get consistent views which is entirely untrue. |
22:49:01 | FromDiscord | <graveflo> tangentially related to this parallel / efficient talk here, anyone know why blasting and atomic int with increments might fail after some time? I saw that issue here a couple days ago and couldn't figure it out. The memory scheme for the atomic int should have been default |
22:49:48 | FromDiscord | <Elegantbeef> > Nim community false claims on lockless↵Hey in my case it's just what I understood for RCU and not all lockless! |
22:49:53 | FromDiscord | <graveflo> idk if you can't stress them too much or something. doesn't make sense to me but I stopped looking into it after reading about the C spec |
22:50:18 | FromDiscord | <jviega> What platform and what’s the error condition?? |
22:51:08 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:51:10 | FromDiscord | <jviega> If the compiled code is using the platform’s underlying fetch-and-add instruction it should never be non-atomic but could get memory ordering issues |
22:51:15 | FromDiscord | <Elegantbeef> Atomic operations should not suddenly stop working |
22:51:23 | FromDiscord | <graveflo> i figure but |
22:51:51 | FromDiscord | <graveflo> I had to add another 0 in there |
22:51:55 | FromDiscord | <graveflo> but then it fails |
22:52:12 | FromDiscord | <graveflo> didnt look at the codegen either |
22:54:53 | FromDiscord | <graveflo> oh and the platform is linux & ryzen 9 |
22:55:36 | FromDiscord | <jviega> So I also don't know how nim's doing synchronization there. Does the parallel block not exit until any threads have exited? |
22:57:46 | FromDiscord | <graveflo> doesn't say, but it does say that it's a semantic checker so maybe it's just that. I bet you're right tho that is the simplest explanation |
22:58:39 | FromDiscord | <Elegantbeef> I too believe it blocks until all are done |
22:59:18 | FromDiscord | <graveflo> now if only fancy syntaxs like `spawn` didn't make it slightly more effort to figure out how to manipulate the underlying stuff like the thread pool |
22:59:46 | FromDiscord | <jviega> I'd be shocked if atomicInc didn't generate a FAA, so it would probably be some locking issue. It could be a memory access ordering issue if there's no barrier, but with the IO happening, seems unlikely |
23:00:08 | FromDiscord | <jviega> Which also implies some basic sync problem |
23:00:31 | FromDiscord | <jviega> Cause any synchronize primitive for end of a block like that should include a full memory barrier |
23:02:56 | FromDiscord | <Phil> Oh hey, I could just use std/tasks |
23:06:38 | FromDiscord | <graveflo> If I change it from a count to a flip flop then it is never off by more than one. It's falling off not skipping beats. Ig the `parallel` block really is the likely suspect. Ah well. To tired to care about that anymore rn |
23:07:15 | FromDiscord | <graveflo> and just like that I got an answer that was more then 1. I eat my words |
23:07:24 | FromDiscord | <guttural666> is spinning on a while loop that expensive? my cpu usage is going up to 12% when the main thread idles |
23:07:55 | FromDiscord | <guttural666> will introducing a sleep mitigate that? |
23:08:05 | FromDiscord | <Elegantbeef> You're wasting cycles |
23:08:07 | FromDiscord | <jviega> I mean, it's using CPU whenever it context switches in |
23:08:40 | FromDiscord | <jviega> If you use something the OS will queue it on (like sleep), it won't eat CPU until the OS is ready to dequeue it |
23:09:13 | FromDiscord | <jviega> This is mainly why there are things like select() and epoll(), not just plain old polling |
23:09:55 | FromDiscord | <Phil> ... is std/tasks so little used that fundamental compilation errors weren't caught? |
23:09:59 | * | xet7 joined #nim |
23:10:41 | FromDiscord | <Phil> Hmm, no I'm using it wrong somehow |
23:10:54 | FromDiscord | <guttural666> okay, so I'll have to introduce some feedback on how long another thread is likely to work, so my main thread can sleep and return ressources to the OS |
23:11:27 | FromDiscord | <guttural666> I'm also apparently memory "leaking" or accumulating |
23:17:27 | FromDiscord | <Elegantbeef> @Phil Malebolgia uses `std/tasks` so it does have some testing |
23:17:39 | FromDiscord | <Phil> I'm getting the weirdest errors |
23:18:00 | FromDiscord | <Phil> `/usr/lib/nim/std/tasks.nim(131, 30) Error: inconsistent typing for reintroduced symbol 'scratch': previous type was: ptr ScratchObj; new type is: ptr ScratchObj`What is scratch and what does it have to do with me? |
23:19:11 | FromDiscord | <Phil> I'm seeing if malebolgia behaves less weird, just wtf |
23:19:21 | FromDiscord | <graveflo> nim version? |
23:19:26 | FromDiscord | <Phil> 2.0 |
23:20:22 | FromDiscord | <graveflo> so your not on devel just the regular nim release? I don't think switching to devel would help just curious |
23:20:44 | FromDiscord | <Phil> yes |
23:21:00 | FromDiscord | <Phil> The only reason I was on devel before was that there were half a dozen fixes I relied on |
23:21:18 | FromDiscord | <graveflo> and so it goes. I lot of people use devel |
23:21:29 | FromDiscord | <graveflo> (edit) "I" => "A" |
23:22:40 | FromDiscord | <Phil> Does malebolgia just block on awaitAll? |
23:23:16 | FromDiscord | <Phil> Trying to figure out whether that idea works |
23:24:24 | FromDiscord | <graveflo> looks like it |
23:25:56 | FromDiscord | <Phil> The idea really was to simply have an event-loop that can push tasks into their own thread and forget about them and the task as part of its thing either dies eventually or sends a message to another thread (which may or may not be done in a blocking manner) |
23:26:17 | FromDiscord | <Phil> And the other thread can, as part of their event loop, just read the message from their channel and do things with it |
23:26:38 | FromDiscord | <Phil> But that idea seems to not work so well because sooner or later you always start blocking for the other thread |
23:27:21 | FromDiscord | <graveflo> you never have to block for the other thread unless you are cleaning up and there are ways around that too |
23:27:44 | FromDiscord | <graveflo> in some situations you have to block but only if theres no way around that |
23:27:44 | FromDiscord | <Phil> Sure, basically every syntax variation of tasks relies on blocking eventually though |
23:28:14 | FromDiscord | <graveflo> can you not put your thread manager as a thread of it's own then? |
23:29:08 | FromDiscord | <Phil> I mean, what's the point of having a thread spawn one-off task threads when you block for the task thread in the end anyway?↵Might as well do the work on the first mentioned thread |
23:29:24 | FromDiscord | <Phil> I want fire and forget essentially |
23:30:12 | FromDiscord | <Phil> And relying on the task to either not need to return anything, or to send me a message on my channel back (or to another thread) if it does |
23:30:31 | FromDiscord | <graveflo> malebolia looks like it can easily be broken out if you want to put your main line in the event loop: https://github.com/Araq/malebolgia/blob/master/src/malebolgia.nim#L57 just would take a little patch |
23:31:08 | FromDiscord | <Phil> I'm barely at the level of using these libs, I'm not fucking around with modifying them |
23:33:03 | FromDiscord | <graveflo> I would just use the conventional thread mechanisms then, but i have 0 experience with threading in nim. It's just so far it seems that the other mechs dont have their use case centered around a custom (but simple) pool management |
23:57:19 | * | advesperacit quit () |