Glenn Linderman wrote:
> 
> Tony Olekshy wrote:
> 
> > Glenn Linderman wrote (in RFC 119 v2):
> > >
> > > It  is not clear whether  the finally clause is  executed if
> > > the try statement is exited via a goto or return, but  the
> > > statement is made that once a try statement  is entered,  it
> > > is  guaranteed that the  finally clause is entered,  but none
> > > of  the discussion mentions  exiting  via goto or return.
> >
> > Quote from RFC 88 + ISSUES + Mixed Flow Control:
> 
> Yes, I saw that mixed flow control statement in RFC 88.  But you
> do not explain what happens regarding the finally clause in this
> situation, if the branch is taken.

Sorry I wan't more clear.  RFC 88 talks generically about any
unwind-semantics block, and I thought said applicability to all
of try, catch, and finally was apparent.

> Does the finally clause execute or not?  So this is an issue of
> unclarity of RFC 88, which you can no doubt easily resolve.

RFC 88 does say:

    finally { ... }

    Once the try block is entered, every finally block is guaranteed
    to be entered before the try statement completes, whether or not
    any exceptions have been raised since the try block was entered.

I would take that to mean that goto, next, return, &c from try or
catch does *not* skip finally, because the try block was "entered".

> I agree that RFC 88 and RFC 119 would suffer similar consequences
> regarding branches out of catch, finally, and always blocks.  If
> branches out of catch, finally, and always blocks cannot be
> achieved, it would be nice if they were forbidden at compile time.
> In both proposals, it is obvious what code is within the blocks.

Yes, I think this is a good idea and possibly possible.  Worst case
I'm sure a run-time error would be possible, but compile-time would
be much nicer.

> I suppose always could be a separate RFC, orthogonal to RFC 119 or
> 88, to add to either.  On the other hand, maybe RFC 88 wouldn't
> need its finally syntax at all if a separate always RFC made prime
> time.

Hmm, with finally we can do this:

    try { ... } finally { &do_something(); }

Am I correct in saying that the equivalent with always would be:

    {
        my $dummy always { &do_something(); }
        ...
        }

Yours, &c, Tony Olekshy

Reply via email to