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

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
From:
David Nicol
Date:
June 17, 2021 19:18
Subject:
Re: RFC 0004 - defer {} syntax
Message ID:
CAFwScO-_xpee660L0gD4HwsdAYCj9j9kOXeuuz4xz_dUCw+rWA@mail.gmail.com
and at compile time, a SCOPE_EXIT phaser would attach its coderef to the
exiting of the scope, encountered during run-time flow or not. Or
alternately, activated by having encountered it during run-time flow.
SCOPE_EXIT blocks if any (are active) would run before unlocalization of
package vars.


On Thu, Jun 17, 2021 at 12:35 PM Eirik Berg Hanssen <
Eirik-Berg.Hanssen@allverden.no> wrote:

> On Thu, Jun 17, 2021 at 7:07 PM David Nicol <davidnicol@gmail.com> wrote:
>
>> it's a phaser, phasers are all-caps, whatever it's called. BLOCK_EXIT
>> maybe. My other often wished-for phaser is ONCE.
>>
>
>   Is it?  I would have expected a phaser to take (some) effect at compile
> time.  As would the RFC, it seems: " All the SHOUTY PHASER BLOCKS are
> declarations, activated by their mere presence at compiletime, whereas
> `defer {}` is a statement which only takes effect if dynamic execution
> actually encounters it."
>
>   But I'm not sure what we should expect.  What even is a phaser in Perl
> 5?  Is this the occasion to land a definition?
>
>   (In Raku a phaser is documented to be a trait of a closure.  It's not
> clear to me if they could be applied after compilation, but they certainly
> don't do so out of the box.)
>
>
> Eirik
>


-- 
"Lay off that whiskey, and let that cocaine be!" -- Johnny Cash

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