[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] r7rs-draft-6: identifiers looking as numbers
-----BEGIN PGP SIGNED MESSAGE-----
On 05/09/2012 08:36 PM, Daniel Villeneuve wrote:
> The draft says: "An identifier is any sequence of letters, ...
> provided that it does not have a prefix which is a valid number."
> But in our implementation, a symbol can match the following
> The following identifiers are therefore legal:
> 100-in-30-window 1-in-7-window-domestic
I have not tested recently, but as of a few years ago, there were
several major implementations that considered any sequence of
printing characters which didn't parse according to the rules for
numbers, characters, strings, etc, to be an identifier.
My own parser uses a rule that identifiers cannot *both* begin
with a sign, digit or decimal point, *and* end with a digit or
decimal point. This is on the assumption anything which does
both begin and end with such a character is syntax that I may
eventually want to use for some kind of number.
Both of those approaches treat all of the above as legal
Also, despite what the standard says, I see specific procedures
named 1+ and 1- used in a lot of code apparently intended to be
portable. In fact the prevalence of these identifiers influenced
the definition of identifiers in my own parser. If not for them,
the rule would be simpler: that identifiers may not both begin
and end with a sign, decimal point, or digit.
The standard has not historically forbidden such extensions to
identifier syntax. I don't see a compelling reason why it should
do so now.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
Scheme-reports mailing list