[ENH] Case independent numbers

Dwight Hughes dwighth at ipa.net
Thu Mar 2 15:40:42 UTC 2000


Bert Freudenberg wrote:
> 
> On Wed, 1 Mar 2000, Dan Ingalls wrote:
> 
> > I will have to admit to a bit of bigotry here.  I was the originator
> > of the numeric format, and I object to a couple of the ANSI decisions
> > regarding the syntax of numeric constants.  I have three reasons for
> > this...
> >
> > 1.  I much prefer 2r1e31 to 2r10000000000000000000000000000000 for the
> > sign bit and 16rFe8 for the high nibble of a 32-bit integer and 10e6
> > for a million.  Come on.
> 
> We do agree here, except for the hex case. I find 16rF0000000 more
> readable (and, btw, more correct - which prooves my point) to refer to the
> hi nibble than the exponent notation. 

Dan obviously meant 16rFe7 -- that's an F followed by seven zeroes - how
difficult is that to understand? I don't even have to count the zeroes
to make sure I put in the correct number of them. It means the exact
same as 16rF * (16 raisedTo: 7) -- precisely as one would logically
expect.

>                                      If we used another char ($^ would
> come to mind) for the exponent if the base is > 10, it'd be fine with me.
>
> > 2.  I just feel that the current (Squeak) def, which is the original
> > one, is a micro world of simplicity and generality.  Radix, digits and
> > exponent defined analogously over ints, largeInts, and Floats.
> > That's all.
> 
> I completely agree. I liked the syntax from the beginning. I don't want to
> restrict, but rather widen it.

Well, you're increasing the amount of syntax and arbitrary detail and
exceptions to remember - so I guess that can be considered "widening"
the syntax. I don't think that is a direction I would want to go in
though. 

> 
> Here's a short form of what my proposal was: Within the current number
> syntax, allow case insensitive letters, but only allow exponent notation
> with $e for bases <= 10.

Repeat after me, "creating arbitrary gratuitous limitations is a Bad
Idea".

> Optionally, we could allow another exponent char for bases >= 10.

This sort of thing reminds me of chocolate-covered manhole covers, but
if you _must_ have lowercase digits, then define "R" with "E" for
lowercase digits and the current "r" with "e" for uppercase digits -- so
16rABCDEFe9 = 16RabcdefE9.

Grumpily yours,

-- Dwight





More information about the Squeak-dev mailing list