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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
June 21, 2022 08:02
Re: Pre-RFC: yield true feature
Message ID:
On Mon, Jun 20, 2022 at 1:41 PM Paul "LeoNerd" Evans <>

> On Sun, 19 Jun 2022 13:23:30 +0100

> In the tiny cornercase that people use a toplevel brace structure for
> their entire file;
>   package My::Package::Name {
>     use v5.40;
>   }
> then maybe we just tell them "hey, don't do that. There's no need to".
> That structure does also give people a real valid escape hatch in case
> they genuinely did not want that feature.

Uh oh. I do that quite a bit and more and more of my code examples are like
that. I like knowing that I have a proper lexical block there to
encapsulate things. To me, the fact that the following prints "3" is a
feature I prefer to avoid:

    package Foo; my $x = 3;
    package Bar; say $x;

If I switch those to postfix blocks, it won't compile.

Curtis "Ovid" Poe
CTO, All Around the World
World-class software development and consulting

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