Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

No warnings on feature function ambiguity?

by Anonymous Monk
on Oct 26, 2011 at 10:47 UTC ( [id://933857]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

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?"

Replies are listed 'Best First'.
Re: No warnings on feature function ambiguity?
by Anonymous Monk on Oct 26, 2011 at 11:16 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://933857]
Approved by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found