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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Dan Book
Date:
June 23, 2022 21:26
Subject:
Re: Pre-RFC: yield true feature
Message ID:
CABMkAVXYzZHbD8Nb9ghzE0U_f9Ac0W27hMzAn=f0SyMNzB9B=A@mail.gmail.com
On Thu, Jun 23, 2022 at 5:10 PM Tom Molesworth via perl5-porters <
perl5-porters@perl.org> wrote:

> On Fri, 24 Jun 2022 at 04:52, Graham Knop <haarg@haarg.org> wrote:
>
>> On Wed, Jun 22, 2022 at 1:19 AM Yuki Kimoto <kimoto.yuki@gmail.com>
>> wrote:
>> >
>> > Summary.
>> >
>> > Are we going in the following direction?
>> >
>> > If the "yield_true" feature is enabled,
>> >
>> >   - the effect is local-scope. Generally the "yield_true" feature is
>> used at the top level file scope.
>> >   - It has no effect on the return value of .pm file. Both an implicit
>> return value and an explicit return value specified by return statement.
>> >   - "require" ignores the return value to determine if the module was
>> successfully loaded.
>> >   - "require" returns the return value of .pm file just like the
>> current behavior.
>> >
>>
>> I think having require return the last value from the file would be a
>> terrible change.
>>
>
> It already returns the last value _if it was true_, so I think this
> description is a bit misleading - the concern here could be reworded as
> "require should never return false", since that'd be what breaks the eval {
> require } combination?
>

Not completely true anyway; it only returns the last value if the module
has not previously been successfully loaded. So anything relying on it
being anything other than a generic true value should be encouraged to fix
their code.

-Dan

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