The fundamental concept of continuations

David Kastrup dak at
Wed Oct 10 12:49:58 CEST 2007

gnuist006 at writes:

> Again I am depressed to encounter a fundamentally new concept that I
> was all along unheard of. Its not even in paul graham's book where i
> learnt part of Lisp. Its in Marc Feeley's video.
> Can anyone explain:
> (1) its origin
> (2) its syntax and semantics in emacs lisp, common lisp, scheme
> (3) Is it present in python and java ?
> (4) Its implementation in assembly. for example in the manner that
> pointer fundamentally arises from indirect addressing and nothing new.
> So how do you juggle PC to do it.
> (5) how does it compare to and superior to a function or subroutine
> call. how does it differ.

Basically, there is no difference to function/subroutine call.  The
difference is just that there is no "call stack": the dynamic context
for a call is created on the heap and is garbage-collected when it is
no longer accessible.  A continuation is just a reference to the state
of the current dynamic context.  As long as a continuation remains
accessible, you can return to it as often as you like.

David Kastrup, Kriemhildstr. 15, 44793 Bochum

More information about the Python-list mailing list