C++ and Rust are both system programming languages that recently received support for asynchronous programming using coroutines. Given the memory and time constraints, both languages opted for stackless coroutines implemented by a compiler-generated state machine. However, beyond that the designs are very different: in C++ the awaitables continue a coroutine from the bottom up, whereas in Rust a waker polls a future from the top down.
We’ll figure out what this means by exploring how C++ and Rust coroutines work, what sets them apart, and what the trade-offs are. If you like programming language design, this talk is for you.
See also (C++)
- cppreference on coroutines
- Lewis Baker’s series about coroutines (old, but mostly relevant)
- David Mazières’ tutorial about coroutines