moore%cdr.utah.edu@cs.utah.edu (Tim Moore) (01/10/91)
In article <2872363025@ARTEMIS.cam.nist.gov> miller@GEMcam.nist.gov (Bruce R. Miller) writes: > >I'm given to understand that Allegro common lisp has a form > > (set-case-mode :case-sensitive-lower) > >such that, afterwards, Lisp code is case sensitive and to access the >`standard' lisp, one must type in lowercase. >Presumably there are :case-sensitive-upper, etc. variants. >Note, I'm not just talking about a case-sensitive readtable. > >This has me wondering... > 2) Is there anything like this slated to be part of CL? Do other >implementations provide a similar hack? In the proposed ANSI standard (and CLtL2) readtables have a READTABLE-CASE slot that can be one of :UPCASE, :DOWNCASE, :PRESERVE, or :INVERT. To quote CLtL2, "For :upcase, replaceable characters are converted to uppercase. (This was the behavior specified by the first edition.) For :downcase, replaceable characters are converted to lowercase. For :preserve, the cases of all characters remain unchanged. For :invert, if all of the replaceable letters in the extended token are of the same case, they are all converted to the opposite case; otherwise the cases of all characters in that token remain unchanged." Utah Common Lisp implements this; presumably others do or are about to. Tim Moore moore@cs.utah.edu {bellcore,hplabs}!utah-cs!moore "Ah, youth. Ah, statute of limitations." -John Waters
miller@GEM.cam.nist.gov (Bruce R. Miller) (01/10/91)
In article <10080@pasteur.Berkeley.EDU>, Vance Maverick writes: > In article <2872363025@ARTEMIS.cam.nist.gov>, miller@GEMcam.nist.gov > (Bruce R. Miller) writes: > > > > I'm given to understand that Allegro common lisp has a form > > > > (set-case-mode :case-sensitive-lower) > > > > such that, afterwards, Lisp code is case sensitive and to access the > > `standard' lisp, one must type in lowercase. [First a note: Thanks to Tim Moore for the excerpt from CLtL2 (I dont have one yet .. waiting for CLtLreally :> ) But I'm NOT talking solely about readtables; what I'm talking about is (apparently) a combination of readtables & intern & printer slashification & ? ... Well, that's really part of the question, isn't it! :> ] > No, this means that 'foo and 'FOO are the same symbol, print name "foo". > :case-sensitive-upper would mean the print name would be "FOO", but the > same code would work, except where it counted on the case of print > names. Are you sure? This has me confused. [no offense] You seem to describe a :case-insensitive-lower (hypothetical?). 'foo & 'FOO being the same seems to mean that there is case INsensitivity. One might still want to specify whether print names are upcased, downcased or casepreserved. The lisp code of the program that triggered this query has ALL symbols from the common-lisp package written in lower case. Some of the new symbols in the applications' own package are written in with mixed case. APPARENTLY the idea is that these new symbols have PRINT NAMES with mixed case (ie. preserved) and they must be typed in the same way (to access the same symbol, anyway), and further, they are typed in & printed out without using |..|'s. Or have I totally misunderstood the application? ... > It can take a while for CL to scan all the packages and convert > all the print names. This I can believe! > > 3) Who uses it, why, and in what way? > > I use it because I occasionally get code (CLX examples come to mind) > which assumes case insensitivity. ^^ I assume you meant case sensitivity? All `traditional' lisp assumes case insensitivity. But you punt! Why did the writers of that code (eg. CLX) use case-sensitivity? Good reasons? Has it made it harder/easier for you to use it? Has it affected your ability to work with different applications within the same lisp image? > Everything I write is lower-case > anyway, so it doesn't matter.
maverick@fir.Berkeley.EDU (Vance Maverick) (01/10/91)
Oops, dyslexia strikes again. :case-sensitive-lower means that the Lisp is case sensitive and all the standard symbols are lower case (as in Franz Lisp and, more remotely, UNIX and C.). :case-sensitive-upper means that CAR is the function we all know and car is something else. Sorry. The justification given in the Allegro CL documentation for the existence of this mode is that it is the mode used by InterLisp.
barmar@think.com (Barry Margolin) (01/10/91)
In article <10105@pasteur.Berkeley.EDU> maverick@fir.Berkeley.EDU (Vance Maverick) writes: >Oops, dyslexia strikes again. :case-sensitive-lower means that the Lisp >is case sensitive and all the standard symbols are lower case (as in >Franz Lisp and, more remotely, UNIX and C.). :case-sensitive-upper >means that CAR is the function we all know and car is something else. >Sorry. The justification given in the Allegro CL documentation for the >existence of this mode is that it is the mode used by InterLisp. Multics MacLisp is also case-sensitive-lower, and I think Franz Lisp may also be. So, the answer to why the option is provided is to make it easier to port programs written in these Lisp dialects. The proposed ANSI Common Lisp READTABLE-CASE attribute affects both reading and printer slashification; the specification of READTABLE-CASE says that it affects the printer as well. No one ever suggested changes to INTERN; this is a lower-level function, and it is not expected to perform any transformations. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar
cox@Franz.COM (Charles A. Cox) (01/11/91)
In article <10080@pasteur.Berkeley.EDU> maverick@fir.Berkeley.EDU (Vance Maverick) writes: > In article <2872363025@ARTEMIS.cam.nist.gov>, miller@GEMcam.nist.gov > (Bruce R. Miller) writes: > > > > I'm given to understand that Allegro common lisp has a form > > > > (set-case-mode :case-sensitive-lower) > > > > such that, afterwards, Lisp code is case sensitive and to access the > > `standard' lisp, one must type in lowercase. > > No, this means that 'foo and 'FOO are the same symbol, print name "foo". You are probably thinking about (set-case-mode :case-insensitive-lower). If you execute (set-case-mode :case-sensitive-lower) as above, then the reader will intern distinct symbols for 'foo and 'FOO: <cl> (set-case-mode :case-sensitive-lower) :case-insensitive-upper << Return value is previous mode <cl> (eq 'foo 'FOO) nil <cl> Here are the options to excl:set-case-mode: :case-insensitive-upper Standard Common Lisp mode. Reader converts unescaped lowercase characters to uppercase. All system symbols' names (eg. car, cdr) are in uppercase. (eq 'foo 'FOO) ==> T :case-sensitive-lower Reader is case sensitive. Thus (eq 'Foo 'foo) returns nil. All system symbols' names are in lowercase. This mode matches the conventions of C and Unix. (eq 'foo 'FOO) ==> nil :case-sensitive-upper Reader is case-sensitive. All system symbols' names are in uppercase. This mode matches the convention of Interlisp. (EQ 'foo 'FOO) ==> NIL :case-insensitive-lower Similar to :case-insensitive-upper except that reader converts unescaped characters to lowercase. All system symbols' names are in lowercase. (eq 'foo 'FOO) ==> t -- --- Charles A. Cox, Franz Inc. 1995 University Avenue, Suite 275 Internet: cox@franz.com Berkeley, CA 94704 uucp: uunet!franz!cox Phone: (415) 548-3600; FAX: (415) 548-8253