Coroutines explained by example
summary
Coroutines appear as concrete, runnable examples in Lua, JavaScript, Scheme showing yield, generators and async/await mapped to the same idea: suspend and resume with saved local state. The talk demos a 2s dog then 5s pig promise chain (total expected 5s when composed), shows Babel and compiler output that lower-level code becomes a state-machine transformation, and presents a call/cc-based implementation that reconstructs yield/resume semantics and compares performance: coroutines are cheaper than OS threads for high concurrency.
AI-written summary · about
chapters (10)
- 0:00Introduction to coroutines
- 2:22Why use coroutines
- 3:26Coroutines as threads
- 10:31Generators in JavaScript
- 17:34Async/await explained
- 22:22Call/CC in Scheme
- 28:47Callback hell vs coroutines
- 33:30Promises vs coroutines
- 36:46When to use coroutines
- 38:54Q&A and summary








