Optional case insensitivity

In contrast with earlier revisions of the report [2], the syntax of datums distinguishes upper and lower case in identifiers and in characters specified via their names. For example, the identifiers X and x are different, and the character #\space cannot be written #\SPACE.

Implementors may wish to support case-insensitive syntax for backward compatibility or other reasons. If they do so, they are encouraged to adopt the following directives to control case folding.

#!fold-case
#!no-fold-case

These directives may appear anywhere comments may appear and are treated as comments, except that they affect the reading of subsequent datums. The #!fold-case causes the reader to case-fold (see library section on ““Unicode””) each <identifier> and <character name>. The #!no-fold-case directive causes the reader to return to the default, non-folding behavior.

The region where each of these directives has effect depends on the context. If the directive occurs at top level, the region extends until the next such directive at top level, or until the end of the source text if no such directive follows. If the directive occurs in the immediate context of a <list> or <vector> datum (i.e., in a place that would make it an element of the list or vector if it were a datum), the region of its effect extends until the next such directive in the same context, or until the end of the context if no such directive follows. A directive occurring inside the region of effect of another directive takes precedence.