in reply to Re^6: Try::Tiny and -E
in thread Try::Tiny and -E

I never doubted that feature "try" will dominate, regardless of the compilation order.

I said that the order matters in attempting to warn about the conflict during import/activation.

-->

> I think Try::Tiny should attempt to warn you or die.

In the OP's example Try::Tiny is activated first and can't know about a later feature.

This case must be addressed by the features.

Or more generally, only the second "change" can detect the first.

FWIW: I started a discussion on Reddit while PM was unreachable:

Perl's feature.pm and backwards incompatibility

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^8: Try::Tiny and -E
by ikegami (Patriarch) on Dec 30, 2025 at 00:02 UTC

    In the OP's example Try::Tiny is activated first and can't know about a later feature.

    I think it can check correctly, but I'm not sure. If it can, it can do so regardless of whether it was loaded first or not. And if it can, it's not trivial.

    More importantly, is it even its job? After all, the following doesn't warn:

    sub print { ... } print ...;

    Maybe this is something Perl::Critic can handle.

      That's because print is a very special beast which allows an unusual print FH @args syntax.

      compare

      ~$ perl use warnings; sub shift {} shift; __END__ Ambiguous call resolved as CORE::shift(), qualify as such or use & at +- line 4. ~$

      Other languages like Javascript block the use of built-ins as function names. This could be a solution for the case print and similar commands.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

        But so is try.

        The difference between print and shift is that print can't be prototyped. The same goes for try since it's not even a function but a keyword like while.

        $ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' shift ;\@ $ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' print [undef] $ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' try [undef]