|
|
|
|
|
by nickelpro
341 days ago
|
|
Random switching between "Awaitor" and "awaiter" makes it seem like these are distinct concepts instead that the reader is supposed to understand. In general this moves way too fast for the density of the grammar it's trying to introduce, lines like: > We have seen Awaitors already - suspend_always is an empty awaiter type that has await_ready returns false always. But we haven't "seen" suspend_always, it's mentioned in half a sentence in an earlier paragraph, with no further context or examples. There's a reason Lewis Baker's writings about C++ coroutines are 5000 word monsters, the body of grammar which needs to be covered demands that level of careful and precise definition and exploration. |
|
A stackful coroutine is "write the live registers to your stack, swap the stack pointer to a suspended coroutine, load the old live registers from your new stack". It's a short and boring sequence of assembly.
A C++ coroutine is a CFG transform with a bunch of logic around heap allocation elision to construct something less capable than the above, with a bunch of keywords and semantics that you can kind of derive from the work the compiler needs to do to wire things together.