Writing Sound Asynchronous Code with Coroutines
summary
Shows why dangling promises silently lose errors and how a generator-based coroutine library gives concrete fixes: explicit parent-child coroutines where parents handle children’s errors and cannot end until children do, plus immediate termination of a subtree. Demonstrates Express transaction middleware that commits or rolls back only after spawned coroutines finish, a searchable context map for request-scoped data, a small CSP-like channel API with nonblocking pushes and blocking yields, and integration with Promises. Library is alpha on GitHub/NPM.
AI-written summary · about
chapters (10)
- 0:00Start
- 0:15Recap of How We Wrote a Synchronous Code in Javascript in the Past
- 1:03Writing Code with Callbacks
- 14:33Async Await
- 16:38Coroutines as Express Request Handlers
- 18:32Explicit Parent-Child Relationship between Coroutines
- 27:39Difference between Yield and Await
- 32:13Is It Possible To Visualize the Data Flow
- 33:09Observables Instead of Promises
- 33:54Attaching Listeners on Streams
related talks
43mAvoid the headaches – make your asynchronous code look synchronous!
25mAsynchrony: Under the Hood
31mPromises and Generators: control flow utopia
32mPromises Are So Passé
42mBeyond Promises: Async Patterns in JavaScript
33mAsync Functions Awaiting You
15mA Concurrency Model for JavaScript with Cooperative Cancellation
41mNext Generation Asynchronous Patterns in JavaScript
