[Cuis-dev] Exception handler blocks with non-local returns

Phil B pbpublist at gmail.com
Mon Oct 14 22:37:26 PDT 2019


Andres,

Still working on this part:

On Sun, Oct 13, 2019 at 10:51 PM Andres Valloud via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Do we even agree this is a problem?
>

So I did some research:

- Blue Book - Useless... the only thing remotely mentioning exceptions had
nothing to do with them.  I don't  see #on:do: referenced anywhere.
Wondering if Exception as we know it even existed back then?  I see things
like SyntaxError hanging directly off of Object.

- Orange Book - Section 4 (starting on p. 351) is all about error
handling.  However, it mostly appears to be dealing with using the tools
and doesn't define the mechanism.  No help.

- ANSI draft - Now we're getting somewhere...

On p.84 the define #on:do: an mention that 'The result of evaluating the
receiver is returned.'  It says nothing about the result of evaluating the
exception block.  Something interesting is that on p.84 when talking about
#ensure: and #ifCurtailed: they go to the effort of explicitly stating 'the
value returned from the evaluation of terminationBlock is discarded' but
for whatever reason didn't say anything (the same or different) for #on:do:.

On p.92 they define the signaledException protocol which includes #return,
#return: etc. and states 'These message are used to explicitly control how
execution will continue when it leaves the handler block.'

Taken together, I'd interpret that as any return value from the handler
block is a gray area and implementer's choice.  So as I believe you've
stated, the only way to ensure a specific return a value is to send #return
(for nil) or #return: (for any other value.)  I find that more than a bit
scary since it means that the behavior before the most recent changes was
valid.  And so was the behavior after the most recent changes.

Unless someone can find something else to make be feel better, I'm in full
agreement that we do have a problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191015/b14f6752/attachment.htm>


More information about the Cuis-dev mailing list