On Thu, 2002-11-28 at 18:08, Richard Nuttall wrote:
> James Mastros wrote:
> 
> > On 11/27/2002 7:54 PM, Angel Faus wrote:
> >
> >> For example, the integer 30 can be written in base 16
> >> in two equivalent ways:
> >>
> >>    my $x = 16#1D;
> >>    my $x = 16#1:14;
> >>
> >> These two representations are incompatible, so writing
> >> something like C<16#D:13> will generate a compile-time
> >> error.
> >
> > Ambiguity:
> > Is C<my $x = 16#14;> equivlent to the digit "14", base-sixteen, or is 
> > it equivlent to 0x14?  (This has been noted before, but I don't think 
> > anybody has decided.  My vote is 0x14, you should say my $x=16#0:14 if 
> > you want the other meaning.)
> 
> Doesn't
> my $x=16#0:14
> give you 2 digits rather than 1 ?

Yes, but the first digit is 0.  Or, more accurately, 0 * 16**2.

> 
> if not, there'll be an inconsistency between 16#1:14 and 16#0:14
> Maybe it needs to be 16#:14 - UGH.

16#E
16#0E
16#000000000000000000E
16#0:14
16#0:0:0:0:0:0:0:0:0:0:0:0:14
0xE
0x0E
0x00000E

16#0:14 == 10#14
16#1:14 == 10#30

> 
> Presumably the compiler can determine that 16#141312 means 
> 16#1:4:1:3:1:2 because of the length, so its only 2 character numbers 

No.  It can determine that because it doesn't have a colon.  Keeps the
rule set small, simple, and consistent.


-- 
Bryan C. Warnock
bwarnock@(gtemail.net|raba.com)

Reply via email to