Higher-Order and Symbolic Computation, 12, 47–73 (1999)
1999 Kluwer Academic Publishers, Boston. Manufactured in The Netherlands.
Using a Continuation Twice and Its Implications forthe Expressive Power of
Department of Computer Science, Queen Mary and Westﬁeld College, University of London
We study the implications for the expressive power of
of upward continuations, speciﬁcallythe idiom of using a continuation twice. Although such control effects were known to Landin and Reynolds whenthey invented
, the forebears of
, they still act as a conceptual pitfall for some attempts toreason about continuations. We use this idiom to refute some recent conjectures about equivalences in a languagewith continuations, but no other effects. This shows that ﬁrst-class continuations as given by
havegreater expressive power than one would expect from
, continuations, upward continuations, expressiveness, program equivalence.
You can enter a room once, and yet leave it
(Peter Landin)A common informal explanation of continuations is the comparison with
.This is in some sense a very apt simile: forward
s obviously do not give rise to loops,and continuations, without some reﬂexive type, do not add this ability either — unlikebackward
exceptions with their general  type .Pushedtoofar,the
analogycanbeharmful. Itisintuitivelyobviousthatifalljumpsare forward, one cannot jump to the same label twice. But it would be unsafe to concludethat, by analogy, one cannot invoke the same continuation twice.It was realised by Landin  (reprinted as a journal paper ) that his
(for jump)operator allows control quite unlike a forward
.Wemayhowever, observethat, when
isadded, thefunction-producingfeatureamounts roughly to the possibility of jumping to a label after leaving the block inwhich it was introduced.Similarly, Reynolds writes about his
:Forexample,itispossiblethattheevaluationofthebodyofanescapeexpressionmay not cause the application of the escape function, but may produce the escapefunction (or some function that may call the escape function) as its value. In a more LISP-inspired jargon, “caus[ing] the application of the escape function” is calleda
use of the captured continuations, whereas “ the escape function (or some
*PartofthisworkwascarriedoutwhiletheauthorwasanEUHCMpostdocatINRIASophia-Antipolis,France;the author is currently funded from EPSRC grant GR/L54639.