Re: Numeric literals, take 3
[email protected] (Richard Nuttall) Thu, 28 Nov 2002 23:08:42 +0000
| Newsgroups | perl.perl6.documentation |
|---|---|
| Organization | Invisible Networks |
| Message-ID | <[email protected]> |
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 ? if not, there'll be an inconsistency between 16#1:14 and 16#0:14 Maybe it needs to be 16#:14 - UGH. 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 with both characters numeric that are ambiguous. That's a small set of literals, but still needs resolving. R.