[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue: READ-CASE-SENSITIVITY (Version 1)

> But it's nontrivial to design something of this sort.  The options seem
> to be:
>   * some way just to turn case concersion on and off
>   * a way to specify a conversion for every character
>     (normally, some would be converted to upper case)
>     [I can imagine lots of objections to this since
>     it would make readtables bigger, it would have to
>     say what happens when one of the characters is
>     defined as a macro, etc.]
>   * define some way for character macro functions to return
>     a substitute character (or characters?).
>   * [maybe] specify an alternative character set that doesn't
>     have case conversion.
> Any preferences?

I notice that our reader calls CHAR-UPCASE on characters which the read
table defines as possible constituents of a symbol name.  Suppose that
instead of a hard-coded call to CHAR-UPCASE, it FUNCALLed a function
contained in the read table, with #'CHAR-UPCASE being the initial value
in the standard read table.  That would be a very simple change, but would
give you all the flexibility you might want.  The only drawback is that it
could slow the reader down, since our call to CHAR-UPCASE is actually
expanded inline now.

I like the idea of doing things like this as keyword arguments to
COPY-READTABLE, both to avoid inventing new function names and to protect
the standard readtable from alteration.  For example:

                                :SYMBOL-CHAR-TRANSLATION #'IDENTITY))