On Fri, 30 Oct 2026 22:35:05 -0000 (UTC) Lawrence =?iso-8859-13?q?D=FFOliveiro?= <l…@nz.invalid> gabbled:
>The trend nowadays is to revive the old coroutine concept, in a new >guise called “stackless” coroutines. These give you support for async >operations, but with transfers of control being made explicit at >“await” points, rather than unpredictably as with full preemptive >threading. This greatly reduces the opportunity for race conditions.
Coroutines are just a complicated way to re-implement a function with a load of statics. eg: void myfunc() { static int i = 0; for(;;++i) { [do something based on value of i] [return when some condition met] } } Also the C++ implementation is so bad its unusable.
>Credit to Microsoft for pioneering this, but nowadays you see the idea >popping up in JavaScript and Python and who knows where else.
Python nailed it - you just call "yield", job done.