Revisiting coroutines
This paper defends the revival of coroutines as a general control abstraction. After proposing a new classification of coroutines, we introduce the concept of full asymmetric coroutines and provide a precise definition for it through an operational semantics. We then demonstrate that full coroutines have an expressive power equivalent to one-shot continuations and one-shot partial continuations. We also show that full asymmetric coroutines and one-shot partial continuations have many similarities, and therefore present comparable benefits. Nevertheless, coroutines are easier implemented and understood, specially in the realm of procedural languages. Finally, we provide a collection of programming examples that illustrate the use of full asymmetric coroutines to support direct and concise implementation of several useful control behaviors, including cooperative multitasking.
Taking into account real or imaginary interest to control operators on LtU, I believe this paper makes nice reading. See also Coroutines in Lua.
Recent comments
1 day 6 hours ago
1 day 11 hours ago
2 days 22 hours ago
2 days 22 hours ago
3 days 2 hours ago
5 days 14 hours ago
3 weeks 3 days ago
3 weeks 3 days ago
3 weeks 3 days ago
3 weeks 6 days ago