Abstracting control
- 1 May 1990
- proceedings article
- Published by Association for Computing Machinery (ACM)
- p. 151-160
- https://doi.org/10.1145/91556.91622
Abstract
The last few years have seen a renewed interest in continuations for expressing advanced control structures in programming languages, and new models such as Abstract Continuations have been proposed to capture these dimensions. This article investigates an alternative formulation, exploiting the latent expressive power of the standard continuation-passing style (CPS) instead of introducing yet other new concepts. We build on a single foundation: abstracting control as a hierarchy of continuations, each one modeling a specific language feature as acting on nested evaluation contexts.We show how iterating the continuation-passing conversion allows us to specify a wide range of control behavior. For example, two conversions yield an abstraction of Prolog-style backtracking. A number of other constructs can likewise be expressed in this framework; each is defined independently of the others, but all are arranged in a hierarchy making any interactions between them explicit.This approach preserves all the traditional results about CPS, e.g., its evaluation order independence. Accordingly, our semantics is directly implementable in a call-by-value language such as Scheme or ML. Furthermore, because the control operators denote simple, typable lambda-terms in CPS, they themselves can be statically typed. Contrary to intuition, the iterated CPS transformation does not yield huge results: except where explicitly needed, all continuations beyond the first one disappear due to the extensionality principle (&eegr;-reduction).Besides presenting a new motivation for control operators, this paper also describes an improved conversion into applicative-order CPS. The conversion operates in one pass by performing all administrative reductions at translation time; interestingly, it can be expressed very concisely using the new control operators. The paper also presents some examples of nondeterministic programming in direct style.Keywords
This publication has 17 references indexed in Scilit:
- Control delimiters and their hierarchiesHigher-Order and Symbolic Computation, 1990
- Embedding continuations in procedural objectsACM Transactions on Programming Languages and Systems, 1987
- Revised 3 report on the algorithmic language schemeACM SIGPLAN Notices, 1986
- The congruence of two programming language definitionsTheoretical Computer Science, 1981
- Constructing Call-by-Value Continuation SemanticsJournal of the ACM, 1980
- Call-by-name, call-by-value and the λ-calculusTheoretical Computer Science, 1975
- On the Relation between Direct and Continuation SemanticsPublished by Springer Nature ,1974
- A bonus from van Wijngaarden's deviceCommunications of the ACM, 1972
- Definitional interpreters for higher-order programming languagesPublished by Association for Computing Machinery (ACM) ,1972
- Proving algorithms by tail functionsInformation and Control, 1971