[r6rs-discuss] Lexical Syntax
alan at alan-watson.org
Mon Nov 12 13:02:59 EST 2007
William D Clinger wrote:
> The formal syntax says #\XFF is *not* a valid character,
> The only reason I can see to regard #\XFF as a valid
> character is the following sentence in R6RS 4.2.6:
> Case is significant in #\<character>, and in
> #\<character name>, but not in #\x<hex scalar value>.
> I believe that sentence was intended to say that case
> is not significant in the <hex scalar value> part of
> #\x<hex scalar value>, but the sentence was worded
The formal syntax also does not indicate that +I, -I, +NAN.0, +NaN.0,
+INF.0, +Inf.0, etc., are valid numbers, but the second sentence of
4.2.8 make its clear that they are. I believe that the lexical grammar
is defined by the formal grammar in 4.2.1 modified by the rest of 4.2. I
do not see that we have freedom to ignore parts of 4.2.6. Therefore, I
maintain that \XFF is a valid character.
> Regardless of the editors' intent, I believe the best
> way to resolve the inconsistency is to interpret that
> sentence as Aziz and I have.
With three exceptions, the lexical syntax of the R6RS is sensitive to
case in strings and things which might be interpreted as names
(identifiers and character names) and insensitive everywhere else. The
exceptions are \x in hex escapes (which is sensitive to case) and nan
and inf (which are insensitive to case). In particular, with the
exception of \x in hex escapes, all of the \? notations are insensitive
to the case of ?. It might therefore be slightly more consistent to
allow both \x and \X in hex characters and hex escapes. I would still
welcome a clarification and possible modification to the syntax in a
future revision of the R6RS.
In the meantime, portable code will not want to live dangerously.
More information about the r6rs-discuss