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. Currently, require will always return a true value, because anything else will croak. There is plenty of code that relies on this. For example: if (eval { require $module }) { ... } This has always been a reliable way to check if the module could be loaded. If require continues to return the (possibly false) value from the file, plenty of code will break. In fact, using the return value of require as a true value has been the only reliable use of its return value, since it will not return the "last value" after the first call to require for a given file. I strongly believe that when require loads a file that is using this feature, it should ignore the final value from the module and instead return a standard boolean true.Thread Previous | Thread Next