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

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
Dan Book
June 16, 2021 23:33
Re: RFC 0004 - defer {} syntax
Message ID:
On Wed, Jun 16, 2021 at 7:21 PM <> 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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About