The State of Exceptions
sheldonn at teleport.com
Mon Oct 19 00:53:26 UTC 1998
From: Ralph E. Johnson <johnson at cs.uiuc.edu>
>At 9:04 PM 10/12/98, Sheldon Nicholl wrote:
>>The clean solution is continuations. Otherwise raise an exception.
>But non-local returns ARE continuations. I don't get it.
I was thinking along the lines of the continuations
in Scheme. These differ from Smalltalk's ^ in
1. first-class objects. They can be passed as
arguments to functions, returned as values from
functions, assigned to variables, and even
gathered into collections. ^ has none of these
2. independent of execution. The meaning of a
continuation is fixed once it's created. ^ requires
certain properties of the stack in order to work.
These properties can vary over time as the execution
proceeds. The cannotReturn: error is impossible with
continuations, as far as I know.
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.
4. mathematically clean, since they're very closely related
to the continuations in denotational semantics. ^ is, as far
as I know, unique to Smalltalk.
Smalltalk's philosophy of turning as many things as
possible into objects has yielded immense benefits.
Non-local returns are one of the few things left to
reify. Continuations are the perfect candidate.
More information about the Squeak-dev