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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Ovid
Date:
June 21, 2022 08:02
Subject:
Re: Pre-RFC: yield true feature
Message ID:
CA+M4CHtSPQmeD7fKnyzUH_LTv0=3tKo4D4BqPh=RdHG1POj9SA@mail.gmail.com
On Mon, Jun 20, 2022 at 1:41 PM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

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


> In the tiny cornercase that people use a toplevel brace structure for
> their entire file; a.la.
>
>   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.

Best,
Curtis "Ovid" Poe
CTO, All Around the World
World-class software development and consulting
https://allaroundtheworld.fr/

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