Implementation strategies for continuations

  • Authors:
  • Will Clinger;Anne Hartheimer;Eric Ost

  • Affiliations:
  • Semantic Microsystems, Inc, 4470 SW Hall, Suite 340, Beaverton, Oregon;Semantic Microsystems, Inc, 4470 SW Hall, Suite 340, Beaverton, Oregon;Metaphor Corp, Bloomington, Indiana

  • Venue:
  • LFP '88 Proceedings of the 1988 ACM conference on LISP and functional programming
  • Year:
  • 1988

Quantified Score

Hi-index 0.00

Visualization

Abstract

Scheme and Smalltalk continuations may have unlimited extent. This means that a purely stack-based implementation of continuations, as suffices for most languages, is inadequate. Several implementation strategies have been described in the literature. Determining which is best requires knowledge of the kinds of programs that will commonly be run.Danvy, for example, has conjectured that continuation captures occur in clusters. That is, the same continuation, once captured, is likely to be captured again. As evidence, Danvy cited the use of continuations in a research setting. We report that Danvy's conjecture is somewhat true in the commercial setting of MacScheme+Toolsmith™, which provides tools for developing Macintosh user interfaces in Scheme. These include an interrupt-driven event system and multitasking, both implemented by liberal use of continuations.We describe several implementation strategies for continuations and compare four of them using benchmarks. We conclude that the most popular strategy may have a slight edge when continuations are not used at all, but that other strategies perform better when continuations are used and Danvy's conjecture holds.