The State of Exceptions
Michael S. Klein
mklein at alumni.caltech.edu
Tue Oct 20 20:59:43 UTC 1998
> A block with a return in it is what I was thinking of
> as a continuation. A block is a first-class object.
A block with a return it only captures the most common usage
of continuations... that of an exit function which is called at most once,
and has no reference outside of the environment of the initial call-cc.
In Smalltalk, you can do this for blocks by:
Block(Context/Closure) >> valueWithExit
^self value: [:answer | ^answer]
result := [:exit| exit value: 3+4] valueWithExit.
assigns 7 to result, whereas
result := [ ^3 + 4 ] value.
does a non-local return which never assigns to result.
> >3. independent of implementation. Some dialects
> >provide direct access to the sender and home pointers
> >upon which ^ depends; others don't. The meaning
> >of continuations is fixed across Scheme implementations.
I think the semantics of call-cc underwent subtle changes
between R4RS & R5RS, due to dynamic-wind. But you'd have
to talk to a Scheme expert to know for sure.
More information about the Squeak-dev