Ambiguous use of non-feature functions goes unnoticed without warnings:

$ perl -E '$x = "txt"; sub ref {return $x . "r";}; say &ref($x);' txtr $ perl -E '$x = "txt"; sub ref {return $x . "r";}; say ref($x);' $

With warnings enabled, the non-feature functions will generate warnings about ambiguous context:

$ perl -wE '$x = "txt"; sub ref {return $x . "r";}; say &ref($x);' txtr $ perl -wE '$x = "txt"; sub ref {return $x . "r";}; say ref($x);' Ambiguous call resolved as CORE::ref(), qualify as such or use & at -e line 1. $

The trouble is, enabling "feature functions" like say() via the -E command line flag (or 'use features qw(say)', or 'use v5.10', or even 'use 5.010') will not result in warnings about ambiguous context even when warnings are enabled.

$ perl -wE 'sub say {print "txt\n";}; &say("hello");' txt $ perl -wE 'sub say {print "txt\n";}; say("hello");' hello

Ambiguous functions really should warn when warnings are enabled, even if they are new "feature" functions. I've got 5.10.1 installed at the moment, so my question is, "Has the lack of warnings on feature function ambiguity been fixed in more recent perl versions?"


In reply to No warnings on feature function ambiguity? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.