Post AdcwUIgnB6G2uowSRs by RustyCrab@clubcyberia.co
 (DIR) More posts by RustyCrab@clubcyberia.co
 (DIR) Post #AdcjEjVwNQhg4f73Cq by Coyote@social.singing.dog
       2024-01-08T03:40:31.969645Z
       
       0 likes, 1 repeats
       
       Has anyone found a compelling use for C++ coroutines? I check every couple of months and every time it always seems like coroutines require huge supporting libraries or are trivially replaceable with a lambda just for a slightly different syntax. It feels like they're going to be the new exceptions.
       
 (DIR) Post #AdcjVJHd9i4ndyK8ci by RustyCrab@clubcyberia.co
       2024-01-08T03:43:31.789814Z
       
       2 likes, 0 repeats
       
       @Coyote coroutines are niche but insanely useful for their niche. Specifically if you are making finite state machines they take pretty horrible code and make it very VERY simple to read.
       
 (DIR) Post #AdcjX1hrTe2fi1PaE4 by tyler@nicecrew.digital
       2024-01-08T03:43:56.551784Z
       
       1 likes, 0 repeats
       
       Sounds like you should use a real language like Python that doesn't have those problems.
       
 (DIR) Post #Adcjc2kR23tKO40Wum by tyler@nicecrew.digital
       2024-01-08T03:44:50.907084Z
       
       2 likes, 0 repeats
       
       (Don't let him know I'm messing with him)Yeah we should go back to single threaded applications, if you program needs multiple threads at once it's simply unoptimized.
       
 (DIR) Post #Adcjcm1Ki598nVGA08 by diazepam@clubcyberia.co
       2024-01-08T03:44:56.845390Z
       
       1 likes, 0 repeats
       
       @Coyote ive found https://youtu.be/_Q9tiEa-jG4 this talk to be interesting and a non retarded case of using coroutines if not a bit overengineered. the problem with c++ coroutines is that they can be customized the fuck out of them so people first trying to use it have no idea wtf is going on.
       
 (DIR) Post #AdclCkZNgJRig1u7M0 by Moon@shitposter.club
       2024-01-08T04:02:33.050641Z
       
       2 likes, 0 repeats
       
       @RustyCrab @Coyote use them on things like 8 bit chips where you don't get much processing power.
       
 (DIR) Post #AdclG5Y88SRQc5uXdw by Moon@shitposter.club
       2024-01-08T04:03:15.786294Z
       
       2 likes, 0 repeats
       
       @RustyCrab @Coyote oh I Was thinking of protothreads
       
 (DIR) Post #AdclVTuRqd8yVZgpsW by RustyCrab@clubcyberia.co
       2024-01-08T04:05:54.228618Z
       
       1 likes, 0 repeats
       
       @Moon @Coyote nah this is cooperative multithreading which is something terribly underutilized in programming as a whole. It allows you to write regular looking functions that execute over time without any of the dangers of memory corruption, race conditions etc
       
 (DIR) Post #AdclXKM2LOwtS9TThw by Moon@shitposter.club
       2024-01-08T04:06:22.710502Z
       
       2 likes, 0 repeats
       
       @RustyCrab @Coyote are they like generators
       
 (DIR) Post #AdclaQ2VfDPbxBoavY by RustyCrab@clubcyberia.co
       2024-01-08T04:06:49.093072Z
       
       1 likes, 0 repeats
       
       @Moon @Coyote yes but I don't often use them for that purpose
       
 (DIR) Post #Adcm5OL02b25eXETJI by diazepam@clubcyberia.co
       2024-01-08T04:12:33.228289Z
       
       2 likes, 0 repeats
       
       @RustyCrab @Moon @Coyote my biggest gripe with most programming languages that have coroutines is that they use "colored async" which makes interop between coroutines and normal functions a giant pain in the ass. the only languages i know of that do this properly is Go and HolyC (yes really) where basically everything already is a coroutine and you call runtime.Gosched() (Go) or Yield() (HolyC) to switch into the scheduler and let it execute the next coroutine in progress and resume freely later. i do get that you need a scheduler and runtime where it can accomodate such an architecture (in TempleOS the OS is the runtime and Seth runs on the cores as a scheduler) but i really would like to see better support of this model of concurrency.
       
 (DIR) Post #Adcms0loS9LYkUxRYG by Coyote@social.singing.dog
       2024-01-08T04:21:19.176639Z
       
       1 likes, 0 repeats
       
       @RustyCrab I don't doubt that they have a niche, someone had to write the proposal to get them in, but the people who are excited for them can't seem to articulate why people should use them. They either spend an hour explaining boiler plate code or show you something so simple that the feature is moot. It's like explaining metallurgy and forging techniques when asked to explain why someone would want to use a hammer or just yelling "SMASH" in their face.
       
 (DIR) Post #AdcnUdn1pMO0lowjSK by RustyCrab@clubcyberia.co
       2024-01-08T04:28:11.407006Z
       
       0 likes, 0 repeats
       
       @Coyote I think the issue for me would be showing you something that looks so trivial that it would be taken as a truism, but then showing how the only way to implement it without coroutines is a catastrophic mess that's extremely difficult to maintain. A single threaded network protocol (client A does thing and B has to wait, client B does thing then A has to wait, go back and fourth 8 more times), can be written as a single function on both sides with while loops. The alternative is a big ass FSM machine with your state stored far away from your incredibly disjointed logic.
       
 (DIR) Post #AdcoVEvjq8NLuhrzLk by Coyote@social.singing.dog
       2024-01-08T04:39:38.070378Z
       
       1 likes, 0 repeats
       
       @diazepam @RustyCrab @Moon That's kind of how I envisioned coroutines being, a way for functions to yield on a dependency that moves execution to other functions while those dependencies get filled. I basically want a language sanctioned task scheduler.
       
 (DIR) Post #Adcog079GWp39FL1Em by RustyCrab@clubcyberia.co
       2024-01-08T04:41:25.522806Z
       
       1 likes, 0 repeats
       
       @Coyote @diazepam @Moon that's more or less what I'm talking about yes. You can use them exactly like that. You just have to keep invoking them as part of your update loop.
       
 (DIR) Post #AdcowtzxG3lt6Q24WW by diazepam@clubcyberia.co
       2024-01-08T04:44:38.273022Z
       
       2 likes, 0 repeats
       
       @Coyote @RustyCrab @Moon i recommend you reading https://pabloariasal.github.io/2022/11/12/couring-1/ which shows how to use a scheduler with coroutines and make practical use of them
       
 (DIR) Post #Adcvvy4FLJ0L72XcvY by Coyote@social.singing.dog
       2024-01-08T06:02:52.275767Z
       
       1 likes, 0 repeats
       
       @RustyCrab @diazepam @Moon I guess my hangup is just that the standard fumbled when it came to the library support along with coroutines being invasive. There isn't a way to sprinkle them into an existing codebase without a huge commitment unlike say lambdas or constexpr.
       
 (DIR) Post #AdcwCt0HQK84KVklsm by RustyCrab@clubcyberia.co
       2024-01-08T06:05:49.757233Z
       
       1 likes, 0 repeats
       
       @Coyote @diazepam @Moon they took 15 years to even get them to this point I would much rather have these than nothing :abyss:
       
 (DIR) Post #AdcwEUIoEUm6IeBT0a by diazepam@clubcyberia.co
       2024-01-08T06:06:15.312713Z
       
       1 likes, 0 repeats
       
       @RustyCrab @Coyote @Moon has your company adopted c++20 yet though:abyss:
       
 (DIR) Post #AdcwUIgnB6G2uowSRs by RustyCrab@clubcyberia.co
       2024-01-08T06:09:00.158449Z
       
       1 likes, 0 repeats
       
       @diazepam @Coyote @Moon yes actually