This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: problem compiling primitive array references
- From: Per Bothner <per at bothner dot com>
- To: "Hurst, Dave" <DHurst at lisletech dot com>
- Cc: "'kawa at sources dot redhat dot com'" <kawa at sources dot redhat dot com>
- Date: Fri, 07 Jul 2006 10:55:53 -0700
- Subject: Re: problem compiling primitive array references
- References: <9E8A844656C6D9119A780060B0A3897E2A6EF5@arcturus.lisletech.com>
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/