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

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
From:
Dan Book
Date:
June 16, 2021 23:33
Subject:
Re: RFC 0004 - defer {} syntax
Message ID:
CABMkAVUDSsv5rfeYyH4KT51+nOC2rNg5O6YoM6MgaFY9+ba2NA@mail.gmail.com
On Wed, Jun 16, 2021 at 7:21 PM <hv@crypt.org> wrote:

> :Another rejected idea is that of conditional enqueue:
> :
> :  defer if (EXPR) { BLOCK }
>
> Given the (snipped) reference to symmetry with the behaviour of local,
> I would be hopeful that you could get the same effect with:
>   defer BLOCK if EXPR;
> just as we can get conditional localization (something of which I make
> heavy use in recursive code), eg:
>   local @hash{@keys} = @values if $localize;
>

I had a similar thought - but this would necessitate making `defer BLOCK`
an expression rather than a complete statement, so that it could be used
with statement modifiers similarly to `do BLOCK`; this means that bare
`defer BLOCK` will need a semicolon. It seems useful for if and unless
conditions, but haven't really thought it through.

-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