Coroutines explained
summary
Explains coroutines by showing concrete code in Lua resume/yield, JavaScript generators and async/await -> state machine and call/cc continuations in Scheme, with timings (2s and 5s promises produce a 7s composed result) and runnable patterns. Demonstrates wrapping callback APIs into promises (readPromise) to flatten nested callbacks, shows that async/await compiles to a state machine, warns that generators can leak resources because finally runs only on exhaustion and that stackful vs stackless semantics affect where and how suspension and resumption happen.
AI-written summary · about
chapters (12)
- 0:00Start
- 3:43Core Routine
- 4:31Example in Lua
- 8:17Example Code
- 8:39Mandatory Notes about Concurrency versus Parallelism
- 15:41Factorial
- 25:34Co-Routines
- 26:08What Is Continuation
- 39:48Example of Sequential Read
- 42:55Summary
- 43:44Carry Continuation
- 44:31Thread Safety
related talks
41mCoroutines explained by example
44mCoroutines Party Tricks
52mCoroutines: C++ vs Rust
01h 01mUnderstanding C++ Coroutines by Example, Part 1
01h 36mUnderstanding C++ Coroutines by Example, Part 2: Generators
48m“Coroutines: what can't they do?”
43mCoroutines for Java Developers
01h 06mC++ Coroutines from scratch
