How to remove a dynamic prompt: static and dynamic delimited continuation operators are equally expressible

We show how to remove a dynamic prompt (aka reset) and thus to turn so-called static delimited continuation operators (shift/reset) into dynamic ones: control, control0, shift0. Our technique extends the continuation captured by shift by composing it with the previous fragments of the ‘stack’. Composition of context fragments can be done via regular functional composition. We thus demonstrate that all the above delimited continuation operators are macroexpressible in term of each other — without capturing undelimited continuations and without using mutable state. Furthermore, the operators shift, control, control0, shift0 are the members of a single parameterized family, and the standard CPS is sufficient to express their denotational semantics. We give the simplest Scheme implementation of the dynamic control operators. We give a formal simulation proof that control realized through shift indeed has its standard reduction semantics.

[1]  Didier Rémy,et al.  A generalization of exceptions and control in ML-like languages , 1995, FPCA '95.

[2]  Michael J. Fischer,et al.  Lambda-calculus schemata , 1993, LISP Symb. Comput..

[3]  Olivier Danvy,et al.  A Functional Abstraction of Typed Contexts , 1989 .

[4]  Matthias Felleisen,et al.  On the Expressive Power of Programming Languages , 1990, European Symposium on Programming.

[5]  Matthias Felleisen,et al.  Abstract continuations: a mathematical semantics for handling full jumps , 1988, LISP and Functional Programming.

[6]  Olivier Danvy,et al.  Abstracting control , 1990, LISP and Functional Programming.

[7]  Chung-chieh Shan,et al.  Shift control. , 2002, Nursing standard (Royal College of Nursing (Great Britain) : 1987).