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

Jaromir Matas m at jaromir.net
Thu May 6 07:31:39 UTC 2021


Hi Eliot,


Eliot Miranda-2 wrote
> I've always assumed/understood that the two are equivalent.  To be more
> precise I've always assumed/understood that the first is short-hand for
> the
> second.  That somewhere in the exception system there is code like
> 
>     exception return: (handlerBlock cull: exception)
> 
> so that if the handler block returns a value the exception is sent return:
> with its value.

That was the idea behind this post. Currently there's no such code and so
the two structures are distinct and can provide two different results as
Jakob showed earlier. However, as Jakob showed too, ANSI probably does allow
for such interpretation. I wish it didn't :)

The current implementation doesn't even guarantee the two forms of return
will return to the same context as was the case with #outer and re-signaling
bugs fixed earlier. So I suggested to at least avoid that and modify the
code to an equivalent of:

    exception handlerContext return: (handlerBlock cull: exception)


Eliot Miranda-2 wrote
> Phrasing the question the other way around, in what ways would anyone
> expect
> 
> [] on: Exception do: [ 42 ]
> [] on: Exception do: [:ex | ex return: 42 ]
> 
> to differ?

Can't think of any... I considered them synonymous.

Thanks a lot for your opinion.
best,



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


More information about the Squeak-dev mailing list