Rua M. S. Vicente 225, 22453-900; Rio de Janeiro RJ, Brazil
user correction - Legacy Corrections
AUTHOR NAME
Roberto Ierusalimschy
user correction - Legacy Corrections
AUTHOR AFFIL
Computer Science Department – PUC-Rio
user correction - Legacy Corrections
AUTHOR ADDR
Rua M. S. Vicente 225, 22453-900; Rio de Janeiro RJ, Brazil
user correction - Legacy Corrections
ABSTRACT
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 oneshot 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 implementations of several useful control behaviors, including cooperative multitasking.