Re: Numeric literals, take 3

[email protected] (James Mastros) Thu, 28 Nov 2002 23:08:18 -0500
Newsgroups perl.perl6.documentation
Message-ID <[email protected]>
On 11/28/2002 6:47 PM, Bryan C. Warnock wrote:
> On Thu, 2002-11-28 at 18:08, Richard Nuttall wrote:
>> 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.
I'm going to go on the assumption that it was either late or early in 
Richard's day, or he otherwise had good excuse to not be thinking.  Yes, 
16#0:14 has two digits.  No, it doesn't make a difference; the first 
digit is an insignificant zero.

>> 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.
Implying that numbers with no colons are assumed to be in colonless 
form.  OTOH, by this rule 100#57 would be in error, because it's in 
colonless form, but we only allow colonless form for bases <=36.
Thus, I think the rule should be that explicit based numbers (IE hashed 
form) with no colons are taken to be in colonless form if base<=36, and 
single-digit colon form otherwise.
(If you wanted colon form for <=36, specify a leading 0 digit, IE 22#11 
is 1*22**1+1, 22#0:11 is 0*22**1+11.)
Another possiblity is to simply consider base>36 numbers with no colons 
to be in error, which might be best.

	-=- James Mastros