develooper Front page | perl.perl5.porters | Postings from October 2014

RFC: Deprecating non-graphic single character variables; allowing $£

Thread Next
Karl Williamson
October 13, 2014 01:58
RFC: Deprecating non-graphic single character variables; allowing $£
Message ID:
Perl v5.20 deprecates the use of control characters as single character 
variables.  What actually raises a warning are the ASCII C0 controls and 
DEL.  rjbs says he meant to have the C1 [\x80-\x9f] controls also 
deprecated, but that's not what got implemented.

My view is that we shouldn't have invisible variable names; hence 
anything that doesn't have a graphic has no business being in a variable 

I think we should deprecate any non-graphics as single character 
variables.  In the 0-255 range, that merely adds the C1 controls, 
no-break space, and the soft-hyphen to the list that currently warn. 
The documents don't state it, but SPACE currently can't be a single 
character variable name, because it is used by the parser/lexer to 
delimit tokens.

I'm told that a common single variable name is ${£} U+A3.  The rules 
actually currently are that if a program is UTF-8 encoded, a non-ASCII 
single character variable must follow the rules for any identifier, 
which means essentially that it be an alphabetic (there are a few alphas 
that can't be an identifier, but the basic rule holds).  This means that 
currently a UTF-8 program can't use £.  It seems to me that it does no 
harm to allow currency symbols be single-character variables in general, 
such as the EURO SIGN, but I don't think we should get into allowing 
other symbol types or punctuation or numbers as single char variable 
names, without evidence of need.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About