develooper Front page | perl.perl5.porters | Postings from November 2015

Re: [perl #126715] Deprecate barewords?

Thread Previous | Thread Next
From:
Abigail
Date:
November 23, 2015 14:31
Subject:
Re: [perl #126715] Deprecate barewords?
Message ID:
20151123143057.GA29556@almanda.fritz.box
On Mon, Nov 23, 2015 at 06:04:05AM -0800, Ed Avis wrote:
> # New Ticket Created by  "Ed Avis" 
> # Please include the string:  [perl #126715]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=126715 >
> 
> 
> 
> This is a bug report for perl from eda@waniasset.com,
> generated with the help of perlbug 1.40 running under perl 5.20.3.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> Does anybody use barewords?  I know that not everyone runs with 'use
> strict' all the time, but is the ancient rule treating an unknown,
> unquoted word as a string still useful?  Even for the most throwaway
> oneliner it seems to get in the way more than it helps.  Other
> opinions welcome, though.
> 
> If there is a consensus that barewords are no longer useful, perhaps
> they could start to trigger a deprecation warning?  Then in a future
> release "use strict 'subs'" or something like it could be built in.
> 
> [Please do not change anything below this line]
> -----------------------------------------------------------------


I use 

    print STDERR "bla bla";

quite often.


But if you're referring to unquoted strings, they already trigger
a warning:

    $ perl -wE 'say STDERR 1 ? yes : nope'
    Unquoted string "yes" may clash with future reserved word at -e line 1.
    Unquoted string "nope" may clash with future reserved word at -e line 1.
    yes
    $


If you opt to run it without warnings, it won't warn, and just DWIM.



Abigail

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