Parsing Numbers

Andreas Raab andreas.raab at gmx.de
Sat Sep 17 22:44:08 UTC 2005


Alexander Lazarević wrote:
> In addition there could be a new
> AmbiguousNumericLiteralWarning that could be raised whenever a numerical
> literal is parsed that has base>14 and contains an e character. The
> default action could be to get a reassurance that the number with
> exponent is what is wanted. Maybe too much ado though.

Actually, that's a *great* idea if you generalize it a little, e.g., 
make it so that you get the warning whenever a lower-case character is 
encountered where it could be interpreted as a digit under the current 
base[*]. This would generally cover the problem of people not being 
aware that they need to spell the digits as upper case. It sure as hell 
would've solved my problem ;-)

[*] As a matter of fact this might be signaled _whenever_ a character is 
encountered that cannot be uniquely interpreted in a numeric literal. 
For example, if you write "10F" the compiler will perfectly interpret 
that as "10 F" where, clearly, either that needs to be 16r10F or I'm 
such a lazy guy that I don't put white spaces where they belong. In 
either case, a warning would be adequate.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list