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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Darren Duncan
Date:
June 18, 2022 03:44
Subject:
Re: Pre-RFC: yield true feature
Message ID:
98ee03ed-3763-01e4-bdc8-204982973b40@darrenduncan.net
On 2022-06-17 8:10 p.m., Ricardo Signes wrote:
> On Fri, Jun 17, 2022, at 23:00, Darren Duncan wrote:
>> 1.  Treat the "yield true" feature like how we treat explicit declarations of
>> file encoding, in that they are explicitly NOT lexical, and that having one
>> anywhere in a file causes it to apply to the entire file, and/or it is only
>> legal for the declaration to exist at the top level of a file and not inside any
>> block.
> 
> What are you referring to when you say "how we treat explicit declarations of 
> file encoding"?

I refer to when we say "use utf8;" or "use encoding" etc.

I know there have been other discussions about improving the behavior of this, 
but one key takeaway I had was that in practice it didn't really seem to be a 
good idea to support a file that was partly one encoding and partly another, and 
so best practice would be that any declarations like "use utf8" etc should 
necessarily be referring to the whole file and not a lesser lexical scope.

So I'm saying that "yield_true" should be the same in the sense that while 
logically it COULD be lexical, there's in practice no good reason for it to be 
so, or if there was, it would be a very different feature than one designed to 
just remove the need for a "1;", that different feature would be mainly about 
altering how subroutines behave.

-- Darren Duncan

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