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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Oodler 577
Date:
June 9, 2022 04:25
Subject:
Re: Pre-RFC: yield true feature
Message ID:
YqF2QXb25+1giDGa@odin.sdf-eu.org
* Dan Book <grinnz@gmail.com> [2022-06-08 23:32:32 -0400]:

> On Wed, Jun 8, 2022 at 10:56 PM Oodler 577 <oodler577@sdf-eu.org> wrote:
> 
> > * 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;".
> >
> 
> > This is not a feature we?d expect people to use explicitly, but would be
> part of the version bundle, so you?d get it for free with a future `use
> v5.XY`.

Okay, thank you for your continued patience.

Final thought:

I guess frankly speaking this seems like it's just going to cause
confusion among long timers and provide no benefit to new comers.

A fair compromise would be a combination of,

* improved documentation on the feature behind the "1;"
  boiler plate (because TBH I don't know what a false-y
  value there would allow one to do or not do).

* something meaningful like Test::More's "done_testing;" that
  can actually benefit new users. Like something I mentioned
  before just to make the point, "egakcap" ('package' backwards),
  but then again why bother when this works (upon testing):

  package test; # does work like this noaw
  
  # ... pkg stuff
  
  __PACKAGE__

And just spitballing here, but what would happen if C<__END__>
got converted to that "1;"? As far as I know it's just tells
the interpreter "no more code past here" - so what better way
to be assured that a "1;" is okay?

  package test; # doesn't actually work like this
  
  # ... pkg stuff
   
  __END__

But what about putting nothing? I think that's a terrible idea
on account of the decades of having to do that. I put it in the
same camp as removing sigils or semi-colons.

Cheers,
Brett
> 
> -Dan

-- 
--
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