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

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



> I'm all for mixed/lower case (I like Franz's  solution)

But it's hard to make their change over a single call to read.

> but let's face it:
> *** READ is designed for reading programs (symbols, lists, structs, etc).
> *** It sounds like you are not primarily concerned with wanting
> "to use case distinctions in code". So, READ should not be changed.

READ is not just for reading programs, it is for reading data too.
Lists, symbols, etc. are used outside of source code, after all.
Is this really a controversial point?

The whole readtable mechanism is there so that the behavior of
READ can be modified.  And it is not unusual for READ to be used
to parse things that are not standard-syntax Common Lisp source
code.

> Dalton, about these large bodies of code which could use READ, except
> for the casing behavior:  can they survive what READ will do with
> chars like #\# #\: #\\ #\| #\` #\( #\) when they are read?

Well, I don't know about "large bodies of code".  But certainly
a number of people just here at Edinburgh have wanted to use READ,
but case-sensitive.  They have wanted to read expressions that
were sufficiently like Lisp's that a good way to read them was
to modify the readtable a bit.  But they also wanted to preserve
case distinctions. 

The reason they can't "use READ" is that the readtable mechanism,
and the other ways to affect READ's behavior, still fall short.

You are right to note that it is difficult to change the behavior of
#\: in certain ways, and that one might want to do so.  This can be a
pain (though I'm sure there's a good reason for it somewhere), but
most of the changes one might want to make can be done by defining
it as a macro.

(BTW, if anyone wonders, the none of the critical comments I
quoted before the start of the proposal were from Edinburgh.)

> If you are not using READ for code or symbol and package rules,
> the what do you get from READ?  the *readtable*?

The read base too.

> To read text you really need to use READ-CHAR or READ-LINE.

I agree completely.

> Even if READ can be used, is it really a good idea? Do you really want 
> to cons a symbol for everything that READ would break into a token?

Sometimes a symbol is exactly what I want.  Symbols are a useful,
after all.

> Maybe you should suggest a READ-TOKEN or READ-SYMBOL function
> that parses like READ (if your really want that) and returns
> a symbol (interned where?) or maybe just a READ-WORD that
> does READ-CHAR up to the next whitespace and interns the string?

Some Lisps do have something like READ-TOKEN, and it can be useful;
but in these Lisps, it's essentially part of READ that happens to be
available separately.  And Common Lisp has PARSE-INTEGER.

But sometimes, I actually want to read lists and have case-sensitivity
set.  Really.  (Maybe I want to read Franz Lisp code, say.)

> Given READ-LINE and READ-CHAR and the multiple interpretations of
> what and when should you break symbols out of text, why/how should 
> this be standardized?  

Why should the readtable be modifiable at all?  Why should I be
able to define character macros?  SET-SYNTAX-FROM-CHAR?

-- Jeff