The fundamental concept of continuations

David Kastrup dak at gnu.org
Fri Oct 12 15:17:11 EDT 2007


George Neuner <gneuner2/@/comcast.net> writes:

> Yes and no.  General continuations, as you describe, are not the
> only form continuations take.  Nor are they the most common form
> used.  The most common continuations are function calls and returns.
> Upward one-shot continuations (exceptions or non-local returns) are
> the next most common form used, even in Scheme.
>
> Upward continuations can be stack implemented.  On many CPU's, using
> the hardware stack (where possible) is faster than using heap
> allocated structures.  For performance, some Scheme compilers go to
> great lengths to identify upward continuations and nested functions
> that can be stack implemented.

There is a Scheme implementation (I keep forgetting the name) which
actually does both: it actually uses the call stack but never returns,
and the garbage collection includes the stack.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum



More information about the Python-list mailing list