The State of Exceptions
Sheldon Nicholl
sheldonn at teleport.com
Mon Oct 19 00:53:26 UTC 1998
-----Original Message-----
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.
>
>-Ralph
I was thinking along the lines of the continuations
in Scheme. These differ from Smalltalk's ^ in
significant ways.
Continuations are:
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
capabilities.
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.
--Sheldon
More information about the Squeak-dev
mailing list
|