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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
Paul "LeoNerd" Evans
June 20, 2022 11:41
Re: Pre-RFC: yield true feature
Message ID:
On Sun, 19 Jun 2022 13:23:30 +0100
Dave Mitchell <> wrote:

> And here's what I think.
> We should be guided by avoiding, as far as possible, edge/special
> cases, a.k.a. the principle of least surprise.
> So I propose:
> 1) that the yield_true feature is strictly lexically scoped. Because
> otherwise it's a special case.

Yeah, I'm with Dave on this. Keeping it as a lexically-scoped one makes
the model simpler for users to understand, writers to document, and
porters to implement.

It already justworks with code written in this style:

  package My::Package::Name;
  use v5.40;


  use v5.40;
  package My::Package::Name;

I am willing to bet that >99% of perl files ever encountered are of one
of these two forms.

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.

Also I suspect this is the only way it'll work to not upset the "concat
all the .pm files into one script" fatpackers.

Paul "LeoNerd" Evans      |  |

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