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

Re: Pre-RFC: yield true feature

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
June 9, 2022 06:07
Subject:
Re: Pre-RFC: yield true feature
Message ID:
CAExogxMbPRcEn9s6BpPh3BEzaZkM6rnvLJqZe5uDoL8Q9moGkw@mail.gmail.com
2022-6-7 9:40 Dan Book <grinnz@gmail.com> wrote:

>
> But there's also another option: we could do both. Though it seems a
> little unnecessary for such a trivial feature.
>
> -Dan
>

 I write the idea that the effect is as little as possible.

A flag "REQUIRE_NOT_CHECK_RETURN_VALUE" is added to the block (file scope)
of loaded file in the feature "yeald_true".

  op_file_scope_block->flag |= REQUIRE_NOT_CHECK_RETURN_VALUE

And if "require" finds the flag "REQUIRE_NOT_CHECK_RETURN_VALUE" in the
feature "require_not_check_return_value", "require" doesn't see the return
value.

  # Foo.pm
  package Foo;
  use feature 'yeald_true';

  undef;

  # main.pl
  use feature 'require_not_check_return_value';
  require Foo;

If a user want the original behavior of "require", he do "no feature
'require_not_check_return_value'"

  no feature 'require_not_check_return_value'
  require Foo;

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