semantics of Exception>>outer ?
John Brant
brant at refactory.com
Fri Jun 27 18:07:06 UTC 2003
> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of Anthony Hannan
>
> I rewrote ifError: in ContextCleanup-ajh, and fixed #outer to report that
> it is
> deprecated because it is the same a #pass. Or is it different? At least
> the
> old code is equivalent.
They are different according to the ANSI standard. When an exception is
resumed from an outer, the resumption occurs at the #outer message send, not
the original #signal. For example, consider
outer :
[Notification signal. 4]
on: Notification
do: [:ex | ex outer. ex return: 5]
pass :
[Notification signal. 4]
on: Notification
do: [:ex | ex pass. ex return: 5]
In the first example, the resume occurs for the "ex outer" statement so the
"ex return: 5" is executed and the overall expression returns 5 (according
to ANSI). However, in the second, the resume occurs for the "Notification
signal" and "4" is returned. If the exception isn't resumable, then they
should behave the same.
John Brant
More information about the Squeak-dev
mailing list
|