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

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
June 21, 2021 02:14
Subject:
Re: RFC 0004 - defer {} syntax
Message ID:
d7e02ea7-c202-4b1d-9997-3c2f7b61899a@beta.fastmail.com
On Sun, Jun 20, 2021, at 9:36 PM, Ben Bullock wrote:
> What I find confusing is that, as far as I know, there is not an obvious way to exit the if{} without actually getting to the end of it, so
> 
>    if (something) {
>       defer {
>         cleanup;
>       }
>       do something;
>       now do the deferred cleanup.
>     }
> 
> doesn't offer an advantage over
> 
>     if (something) {
>       do something;
>       cleanup;
>     }

Consider that "do something" might throw an exception.

-- 
rjbs
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