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

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



    Date: Sat, 17 Jun 89 16:50:44 BST
    From: Jeff Dalton <jeff%aiai.edinburgh.ac.uk@NSFnet-Relay.AC.UK>

    What I wanted to do was just to change point 1 of step 8 on page 337
    of CLtL, which is where unescaped constituents are converted to upper
    case.  At that point, characters are being considered one at a time.
    If :INVERT's going to work on entire extended tokens, it looks like it
    requires a more complicated change to the specification of READ.

Right.  But the specification of READ should be how it behaves, not
a program-written-in-English.

       If the read case of the current readtable is :INVERT and
       if if all of the unescaped letters in the extended token are
       of the same case, those letters are converted to the opposite
       case.

Agreed.  I think that's a good way to phrase it, too.

    I'm a bit worried about the use of "unescaped" at this point,
    since the other parts of the processing of extended token depend
    only on attributes such as alphabetic or digit.  

How about changing the places where it says escaped characters are given
the attribute alphabetic, and the places that say characters like ! and
= have the attribute alphabetic (obvious nonsense, eh?) to use the new
attribute name "ordinary".  In fact there will no longer be an
alphabetic attribute, because all the letters have the alphadigit
attribute instead.  But you'd have to switch 0 through 9 from alphadigit
to digit.  Let's gloss over the impact, if any, on bases less than 10
(in octal, is 9 alphabetic?), otherwise we'd have to invent an
"ordinadigit" attribute for 0 through 9 to have.

So you could rephrase the rule:

       If the read case of the current readtable is :INVERT and
       if all of the alphabetic characters in the extended token are
       of the same case, those characters are converted to the opposite
       case.

That seems neater.

    I'm also a bit worried about things like this:

      \abc reads as aBC, but prints as Abc

This is inherent in the idea of escape characters, so you shouldn't
worry about it.  Anyone who uses it to attack your proposal isn't
playing fair, they should be attacking CLtL Common Lisp for this
if they don't like it.

Oh excuse me, it can't print as Abc since that reads as Abc.
It has to print as aBC or |aBC|.  Any printer has to be able to
figure out whether it has to put in escapes to make the reader
read it back correctly, so that's no problem.

    > Can you / will you write a version 4 that contains only the keywords
    > proposal and that specifies :INVERT to invert case only when all the
    > unescaped letters are in a single case?

    Yes to at least the first.  I'd like to have some more feedback on the
    second.

I hope this is enough feedback.  The amount of mail seems to be dying down.