[squeak-dev] The Inbox: Kernel-jar.1399.mcz

Jaromir Matas m at jaromir.net
Sun May 2 20:43:10 UTC 2021


Hi Nicolas,


Nicolas Cellier wrote
> Maybe it has a virtue of making the return more explicit.
> Currently, behavior differs only if someone refines OwnException>>return:
>     OwnException>>return: anObject
>         self logReturn: anObject.
>         ^super return: anObject
> I wonder what would be the expectations of someone using implicit return:
>      howMany := [self countTheThings] on: OwnException do: [:exc | -1
> "error condition"]
> Shall above construction logReturn: or not?
> Currently it doesn't.
> You are proposing that it does...
> I have no strong opinion.
> Votes?

Thanks; I don't have a strong opinion either, I just incline towards
unifying; it happened to me a couple of times during debugging the two
returns behaved differently which irritated me :) Your example even shows a
real use case... it didn't occur to me.

ANSI doesn't provide a guideline either:

Implicit:
If the evaluation of the exception action returns normally (as if it had
returned from the #value:
message), the value returned from the exception action is returned as the
value of the #on:do: 
message that created the handler. 

Explicit:
return: returnValue
The returnValue is returned as the value of the protected block of the
active exception handler. 

Another example: Cuis uses a modified Exception>>#return definition which
means the modification applies only to the explicit behavior (the difference
is insignificant but it's there).

Thanks again,



-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list