This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem compiling primitive array references


Hurst, Dave wrote:
It seems that Kawa attempts to interpret quoted symbols consisting of digits
and '.' characters as numbers and chokes if there are multiple '.'
characters in the symbol.


For example:
#|kawa:1|# (define ip '192.168.10.5)
<stdin>:1:23: not a valid number: duplicate '.' in number

These symbols were previously (correctly?) interpreted as string values.

I'm surprised; I don't think that has changed since 1.7.


When parsing tokens - and reading S-expressions generally, I borrowed
the framework and concepts of Common Lisp.  When deciding whether a
token is a symbol or a number, we first decide if it is a "potential
number"; otherwise it is a symbol.

If it is a potential number, we try to parse it as an actual number;
if not an error is reported.

The motivation for checking for invalid but potential numbers:
- Make it easier to extend the syntax of numbers with new number
types without breaking existing programs.  (For the Common Lisp
standard, specifically to allow for implementatiom-specific extensions.)
- Catch some typos.

The fix: quote the special characters:

(define ip '|192.168.10.5|)
or:
(define ip '\192.168.10.5)

These work because a token is not considered a potential number
if any character is quoted.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]