[r6rs-discuss] #!fold-case and #!no-fold-case
William D Clinger
will at ccs.neu.edu
Thu Jun 21 06:59:30 EDT 2007
First a rant, then a couple of observations.
Historically, implementations of Scheme have used syntaxes such
as #!true and #!unspecified for miscellaneous self-quoting
constants. The draft R6RS abandoned this tradition by making
#!r6rs into a comment, which either complicates the formal
grammar(s) or requires special-case hand-coding in get-datum.
Then the non-binding appendix compounded the problem by
specifying a "region of its effect" for #!fold-case and
#!no-fold-case that is inconsistent with the region of
effect for #!r6rs.
Did these specifications arise out of scorn for tradition,
disregard of consequence, or mere carelessness?
Fortunately, implementations can just ignore the region of
effect specified for #!fold-case and #!no-fold-case, since
they are introduced by a non-binding appendix. They can
also ignore the suggestion that these directives act as
comments, leaving #!r6rs as the only wart of that kind.
That was the first observation. The second observation is
that I don't know quite what to do with #!no-fold-case when
presented with symbols such as
The problem is that the hexadecimal escapes could be playing
either of two roles:
allow non-Ascii letters to be expressed in Ascii
prevent the escaped character from being case-folded
The second role is problematic because the case-folding
of Unicode strings does not coincide with character-wise
case-folding. In general, therefore, it doesn't quite
make sense to perform case-folding on the un-escaped
characters but not to perform case-folding on the escaped
Even with #!no-fold-case, therefore, I am inclined not to
perform case-folding on symbols that were written using
hexadecimal escapes, and this is what I have implemented
in Larceny. This is certainly legal, since case folding
is forbidden by the draft R6RS proper, and I am just
interpreting the non-binding appendix.
But I'd like to hear from people who actually expect to
use #!no-fold-case in their programs, or have legacy
code to which they expect to add #!no-fold-case and
some hexadecimal escapes. What semantics would you
More information about the r6rs-discuss