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

Re: PATCH [perl #59342] chr(0400) =~ /\400/ fails for >= 400

Thread Previous | Thread Next
From:
Glenn Linderman
Date:
November 12, 2008 08:50
Subject:
Re: PATCH [perl #59342] chr(0400) =~ /\400/ fails for >= 400
Message ID:
491B0910.8050609@NevCal.com
On approximately 11/12/2008 7:03 AM, came the following characters from 
the keyboard of Rafael Garcia-Suarez:

> However, I see some value in still allowing [\000-\377] character
> ranges, for example. Do we really want to deprecate that as well?
> This doesn't seem necessary.


I personally see no value in octal notation now that Unicode uses hex, 
and most programmers are familiar with it.  The octal notation was 
somewhat useful when there were 9-bit/18-bit machines, and when hex was 
foreign (what are those letters doing in my numbers?).  I daresay that 
hex is about the second thing most programmers learn, these days.  "This 
is a computer... this is hexadecimal numbering system... there are lots 
of computer languages..."

Another approach would be to change the escape from \nnn to \o{nnnnn...}

\o is available (but is half of the 5 pairs that are left)

The {} provide explicit delimiters, so octal numbers could then achieve 
parity with hex in the range of numbers available.

If people think octal is still worth supporting, this looks like a 
better syntax to support it wholeheartedly.

Python 3.0 has moved to 0onnnnn for its octal integers (zero oh 
digit-sequence) after concluding that leading zeros alone are just too 
problematical, so the "o" indicator has a precedent (albeit recent) in 
addition to reasonably intuitively meaning octal to anyone that 
understands the hexadecimal notation and has ever heard of octal.  The 
0o syntax could also be added to Perl integer constants outside of 
strings/regices.

The above items could be added to the language immediately, during the 
deprecation cycle for \nnn octal notation, giving people an extremely 
simple way to convert their octal constants: inside of strings/regices, 
insert o after \ and wrap the digits with {}; outside of 
strings/regices, insert o after leading 0.

This would allow people that still wish to use octal a way to do so, 
without ambiguity.


-- 
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

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