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

Re: A 'permanent' keyword

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
November 11, 2021 16:59
Subject:
Re: A 'permanent' keyword
Message ID:
20211111165932.2f225d70@shy.leonerd.org.uk
It's kindof unfortunate that `state` behaves in this manner, as it
isn't actually very useful.

What you describe is exactly what C calls a `static` variable. Because
it isn't lexical, nor is it dynamic. It exists exactly once.

I actually wonder whether the keyword "static" should be used here.

In any case, it's ~trivial to implement that as a CPAN module as a
pluggable keyword. So I'd suggest someone go do that first, and we'll
see how it goes.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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