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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Tom Molesworth via perl5-porters
Date:
June 16, 2022 05:06
Subject:
Re: Pre-RFC: yield true feature
Message ID:
CAGXhHdnuUZhjfeayrmEYcJpjeOROx0Hp38DeVOwc8LjndWujrg@mail.gmail.com
On Thu, 16 Jun 2022 at 12:29, Tony Cook <tony@develop-help.com> wrote:

> Thinking about implementation, how should this behave if the included file
> was:
>
>   package Zork {
>       use feature 'yield_true';
>   }
>

Since it's called `yield_true` rather than `ignore_false`, I'd expect that
lexical scope to behave as if it was wrapped in `(...) or builtin::true`,
so the `require Zork;` would work as if it had been `package Zork;
builtin::true`. Similarly for nested scopes: behaving a bit like `perl
-le'print do { { { (undef) or 1 } } }'` with the true value propagating.
Presumably that would enforce scalar context: is that likely to be a
problem?

Similarly:

my $value = do { use feature 'yield_true'; undef }; # we're expecting
$value = builtin::true, yes?

This level of detail seems more appropriate for the RFC stage. Seems
there's enough interest to go beyond pre-RFC here?

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