Revisiting coroutines

  • Authors:
  • Ana Lúcia De Moura;Roberto Ierusalimschy

  • Affiliations:
  • Catholic University of Rio de Janeiro (PUC--Rio), Rio de Janeiro, RJ;Catholic University of Rio de Janeiro (PUC--Rio), Rio de Janeiro, RJ

  • Venue:
  • ACM Transactions on Programming Languages and Systems (TOPLAS)
  • Year:
  • 2009

Quantified Score

Hi-index 0.02

Visualization

Abstract

This article advocates the revival of coroutines as a convenient 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 delimited continuations. We also show that full asymmetric coroutines and one-shot delimited continuations have many similarities, and therefore present comparable benefits. Nevertheless, coroutines are easier implemented and understood, especially in the realm of procedural languages.