Can you recommend any general learning resources on coroutines?
I'm looking for tutorials, books, or other non-video sources that are largely language independent (or introduce a few primitives clearly) and, most importantly, explain how to program with couroutines and for which problems or situations they're typically used. I'm looking to learn the concepts, not features of specific languages.
I'm not interested in other control or concurrency primitives.
Today I need to understand #Python coroutines and futures. The documentation doesn't explain it at all well to me.
I'm very comfortable using async/await in JavaScript.
Does anyone have any pointers?
Earlier today I released a new version of https://thi.ng/fibers aka building blocks and operators for coroutine-based multitasking and alternative to async-await. It's one of the more recent packages, but also one which is quickly cementing itself as one of the most powerful & flexible tools of the whole #ThingUmbrella collection, similar to how https://thi.ng/transducers & https://thi.ng/rstream have done in other contexts...
Recent versions have included new helpers to improve interop between fibers and async functions and to simplify time-sliced processing of child tasks and/or iterables (incl. via transducers).
The attached code snippet shows an example excerpt of how this is used in the recent (and even more recently updated) #HowToThing Mastodon UI demo. See linked toot for demo link & fully commented source code...
After some friendly inquiry by @computersandblues, I spent a few hours today adding basic CSP (#CommunicatingSequentialProcesses) primitives for https://thi.ng/fibers and writing some preliminary documentation. I'm amazed how simple (and easy!) it was this time around (compared to https://thi.ng/csp) and it's giving me big hopes for the fiber based approach in general...
I have a simple animation system using #Lua#coroutines in #pico8. Right now, I added animation pausing to this system, so I could avoid having #game logic in the animation #code. This refactor makes it feel a lot less hacky.
Because I'm using #coroutines everywhere, I decided to create a centralized system for them, instead of having like 4 systems that each work differently.
Now it'll be easier to run things like the #AI and the #dialog box at the same time. (Check out that box!) #pico8