Front page | perl.perl6.language |
Postings from February 2005
Re: Octals
Thread Previous
|
Thread Next
From:
Uri Guttman
Date:
February 22, 2005 11:41
Subject:
Re: Octals
Message ID:
x7mztwpeku.fsf@mail.sysarch.com
>>>>> "J" == Juerd <juerd@convolution.nl> writes:
J> And for symmetry, can we get 0d and \d for decimal, for those cases
J> where you want to be explicit?
in a regex \d is a digit, so that isn't a good idea. it would be better
to require \0d. the others also need a base designator character so
decimals don't need a shortcut. and why would we need 0d123 as a
literal? there are no ambiguities and decimal is the simple and obvious
default. i just don't think we need symmetry in all possible cases.
J> I think \777 should be chr(777). As should \0d777, should you want to
J> document that it's really not octal. (Important mostly the first year
J> after the first release.)
too much history with \777 being octal. i think that should be a compile
time error (die) as it is illegal. but p5 currently just stops parsing
when it sees an out of range char. this is a silent bug IMO. at least a
warning should be generated. but the other side will want support for a
single char value and not requiring leading pad 0's.
perl -e'print "\xQW"' | od -c
0000000 \0 Q W
perl -e'print "\xaQW"' | od -c
0000000 \n Q W
perl -e'print "\777"' | od -c
0000000 307 277
i don't know what is happening there.
so if you have no valid value chars or are out of range (as with \777),
then i would want to know as i made a mistake. leading pad 0's can be
skipped if some legal value is found.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Thread Previous
|
Thread Next