develooper Front page | perl.perl5.porters | Postings from July 2021

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
From:
Dan Book
Date:
July 2, 2021 18:16
Subject:
Re: RFC 0004 - defer {} syntax
Message ID:
CABMkAVUtWpciBsBEnPfGma__3XGPCAZxLmFVwAe4+gHz9mXA6Q@mail.gmail.com
On Fri, Jul 2, 2021 at 12:58 PM David Nicol <davidnicol@gmail.com> wrote:

>
> the multiple exceptions behavior looks like a bug to be repaired, not a
> feature to be accommodated.
>
> IMO The first exception thrown from deferred code should prevent later
> defer blocks in that scope from happening, just as if they were later in
> the code text, instead of getting rearranged there through defer sugar.
>
> sub foo { say "Hi"; die "two"; die "one" }  # should this not be
> equivalent?
>

No; the defer blocks were reached, so their scope cleanup should occur
whenever the scope is left, in this case because of an exception
propagating.

-Dan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About