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

Re: Pre-RFC: a `library` keyword

Thread Previous | Thread Next
Dagfinn Ilmari Mannsåker
April 4, 2022 10:27
Re: Pre-RFC: a `library` keyword
Message ID:
Yuki Kimoto <> writes:

> I ask a question about  yield_true feature.
> This example seems to be adding "1;" to the end of the file scope.
> Can yield_true feature be implemented actually as a file scope, not as a
> global scope?

All features (as in are lexically scoped, the file scope is
just the top-level lexical scope.  This implies that doing `use feature
'yield_true';` in a non-toplevel scope, i.e. inside a sub or other
block, has no effect, since the feature will not be enabled anymore at
the end of the file scope.

- ilmari

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