[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
case sensitive readers
- To: franz!sail.stanford.edu!cl-cleanup
- Subject: case sensitive readers
- From: franz!frisky!jkf@ucbarpa.Berkeley.EDU (John Foderaro)
- Date: Wed, 08 Mar 89 10:18:04 PST
Jeff Dalton brought up the problem of the Lisp reader not being case
sensitive. His application was to read text in which case matters.
I think that we would be better served in solving the global problem of
a solely case insensitive reader, and once this is solved Jeff's problem
disappears.
As a user of Lisp on Unix-based workstations the fact that Common Lisp
is not case-sensitive is a major annoyance. [While Allegro Common Lisp
will run in a case-sensitive mode, the fact that most of what I write
gets shipped to customers means that I have to limit my use of
case-sensitivity]. Clearly many people find case-sensitivity a useful
tool for increasing program readability (if you don't believe this, look at
large C programs and remind yourself that C doesn't impose any
case conventions on the user so that all use of case is strictly
voluntary). Furthermore many people use Lisp on Unix-based workstations
to interface with C, and the fact that there isn't a nice way to
write dual-cased C symbols as Lisp symbols is a major drawback to
seamless integration.
If you now want to reply to this letter letting me know how much you hate
case-sensitive programming languages, please don't bother. It just
doesn't matter what you dislike. What matters is that there
do exist a significant number people for whom the case-sensitivity
is important (unfortunately they are probably under-represented in this forum).
It is possible to come up with a solution that also satisfies people
who are used to using case freely in their programs
(e.g. (Defun Foo (x) (Cond (X :BaR))))
and who want all characters mapped to one case. This is done by
some mechanism that lets the reader know when it should map all
unescaped characters to one case.
Furthermore I'd expect that all symbols defined in the standard be
of a single case so that people using Lisp in the single-case mode
would have access to everything without using escape characters.
Now for the big change: If Common Lisp is to support a case-sensitive
reader for programs, the 'standard' case for symbol names must be
lower case. This is very important because having to use the
shift key to type in most symbol names would make the
case-sensitive mode too painful to be useful.
Allegro Common Lisp can switch at runtime between the standard
Common Lisp case-insensitive upper-case-preferred mode and
the case-sensitive lower-case-preferred mode I've suggested here,
however this is a 'violent' change that isn't necessarily reverseable
and I wouldn't suggest this kind of thing for the standard.
It is trivial to switch between the case-insensitive lower-case-preferred and
case-sensitive lower-case-preferred modes and these are the two modes
I'd suggest be supported in Common Lisp. I don't care how the switch is done
(whether by global variable, readtable-based flag, or function). I believe
that the first step is deciding that the mode switch is necessary and
then the design can be done.
- john foderaro
Franz Inc.