[Cuis-dev] [Ann] Refinements to Exception handling

Phil B pbpublist at gmail.com
Thu Oct 17 18:44:35 PDT 2019


Andres,

On Thu, Oct 17, 2019 at 9:14 PM Andres Valloud via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> See below: the #nonLocalReturn: method is an illustration device to show
> that having to cross a method boundary allows flexibility and ease of
> maintenance that ^ does not.
>
> However, all of that is prefixed by "I would object less", rather than
> "I would stop objecting".
>

If you're saying that one should generally try to avoid designs that
necessitate non-local returns in exception handlers, I would agree with
that. (with the caveat that they are actually avoided, and not just
side-stepped)


> The style of using non-local return in exception handlers, irrespective
> of how it happens, still has long term disadvantages.
>

If you are using them in a 'control flow' use case (i.e. where the block is
declared at its point of application), what problems to you anticipate?

Thanks,
Phil


>
> On 10/14/19 21:02, Andres Valloud via Cuis-dev wrote:
> > The below argument seems to focus on how easy it is to write new code.
> > What I'm arguing is that the long term consequences of said code matter
> > even more.  IME, non-local returns in exception handler blocks are not
> > as beneficial as they initially seem to be.
> >
> > I would object less if exceptions understood a message such as #return:
> > that performed a non-local return.  At least then you can easily
> > breakpoint that, because if instead of
> >
> >      [:ex | ^5]
> >
> > the code reads
> >
> >      [:ex | ex nonLocalReturn: 5]
> >
> > then you can reimplement nonLocalReturn: *in the exception of interest
> > alone*, without breaking everything else.
> >
> > This is different from ^5 in a regular method because there the context
> > of ^5 is much more readily understood.  In an exception handler block,
> > at first glance you have no idea of where the exception might be coming
> > from, so what does ^5 mean in the context where the exception happened?
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191017/dfd04b3b/attachment.htm>


More information about the Cuis-dev mailing list