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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Oodler 577 via perl5-porters
Date:
June 9, 2022 02:56
Subject:
Re: Pre-RFC: yield true feature
Message ID:
YqFhVpaL3IXAXO+K@odin.sdf-eu.org
* Yuki Kimoto <kimoto.yuki@gmail.com> [2022-06-08 17:47:27 +0900]:

> 2022-6-8 0:56 Dan Book <grinnz@gmail.com> wrote:
> 
> > On Tue, Jun 7, 2022 at 5:06 AM Darren Duncan <darren@darrenduncan.net>
> > wrote:
> >
> >> What would the effect of yield_true be on a Perl source file used as
> >> simple
> >> configuration data like the following, which I have actually practiced...
> >>
> >
> > No effect. This is only for require (and thus use).
> >
> > -Dan
> >
> 
> "yield_true" feature doesn't affect "do".
> 
> Does this mean "yield_true" is not simple syntax sugar at the end of "1"?

This is beginning to sound like Test::More.

    use Test::More tests => 42;
    ...

or

    use Test::More;

    ...

    done_testing; 

So maybe follow that kind of pattern. But I am still lost why
typing "use feature 'yield_true';" is better than "1;".

Looking back at the pre-RFC itself, I don't think the "motivation"
is sufficiently, developed.

"Eliminate the need for a true value at the end of a Perl file."

Okay, but why?

> 
> Does the following code work well?

idk.

> 
>   # Foo.pm
>   use feature 'yield_true';
> 
>   undef
> 
>   # do - $ret is undef
>   my $ret = do 'Foo.pm';
> 
>   # require - OK
>   require 'Foo.pm';

Cheers,
Brett

-- 
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native

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