* I've found that state machines are much easier to understand when they consist of actual gotos, with labels for each state; the current state being where execution is.
* Coroutines are one of those things that I think are easier to understand and write in Asm - a yield looks much like a call but you pop the return address off the stack and save it somewhere, so the next call basically becomes a jump to the resumption point.
* Yielding between coroutines is very similar to switching between threads.
* It helps a lot when understanding coroutines if you forget any existing notions of what functions are and have to do, and just focus on how the execution flows.
* I've found that state machines are much easier to understand when they consist of actual gotos, with labels for each state; the current state being where execution is.
* Coroutines are one of those things that I think are easier to understand and write in Asm - a yield looks much like a call but you pop the return address off the stack and save it somewhere, so the next call basically becomes a jump to the resumption point.
* Yielding between coroutines is very similar to switching between threads.
* It helps a lot when understanding coroutines if you forget any existing notions of what functions are and have to do, and just focus on how the execution flows.