A Curious Course on Coroutines and Concurrency
เหมือนจะน่าสนใจ เก็บไว้ก่อนEli Bendersky’s website » Blog Archive » Co-routines as an alternative to state machines
Observation: Co-routines are to state machines what recursion is to stacks When you have to traverse some sort of a nested data structure (say, a binary tree), one approach is to create a stack that remembers where in the tree you are. Another, much more elegant approach, is to write the function recursively. A recursive function employs the machine stack used to implicitly implement function calls - you get the benefits of the stack without paying the cost of reduced readability.