From: DanL on
On 12 Okt., 22:21, alex_sv <avshaba...(a)gmail.com> wrote:

> Thanks all, (setf (readtable-case *readtable*) :invert)  works like a
> charm :)

It does, but be aware of this:

DHL> (setf (readtable-case *readtable*) :invert)
:invert
DHL> (symbol-name 'foo)
"FOO"
DHL> (symbol-name 'Foo)
"Foo"
DHL> (symbol-name 'FOO)
"foo"


From: John Thingstad on
P� Mon, 12 Oct 2009 17:31:16 +0200, skrev DanL <leidischd(a)gmail.com>:

> On 12 Okt., 17:10, Tamas K Papp <tkp...(a)gmail.com> wrote:
>
>> (SETF (READTABLE-CASE *READTABLE*) :PRESERVE)
>
> Which would force one to use UPPERCASE for everything in package CL of
> corse.
>
> (setf (readtable-case *readtable*) :invert)
>
> would be another option.
>
> Regards,
>
> dhl

True, You would have to make a custom core which also uses :preserve.
(Like Allegro does.)
This would probably break something so it would be a chore.
With clbuild using additional libraries shouldn't be too hard though..

--------------
John Thingstad
From: Rob Warnock on
alex_sv <avshabanov(a)gmail.com> wrote:
+---------------
| Thanks all, (setf (readtable-case *readtable*) :invert)
| works like a charm :)
+---------------

It does, and I use it myself when READing certain external files
which are case-sensitive sexps [e.g., EDIF or ".EDN" files produced
by some electronic design tools].

But you should also be aware that there is legacy code out there[1]
which occasionally sprinkles all-uppercase symbols into the code
"for readability"(?), expecting it to be read in :UPCASE mode,
so you need to make sure that code is read in that mode, too.

In short, while the :INVERT kludge is very useful, it's *not* a
panacea. You'll still need to carefully manage the READTABLE-CASE
of each file you READ, LOAD, or COMPILE.


-Rob

[1] Some examples:

- Acronyms or tradenames in features tests, e.g.: #+FreeBSD, #+AMD.

- Visibly distinguishing similar names, e.g., "stageC-carry" from
"stageE-carry". [From CMUCL source file "bignum.lisp", which,
confusingly, also contains instances of "stagec-carry" which
MUST BE THE SAME symbol as "stageC-carry". Ouch.]

- Visibly distinguishing letters from digits, e.g., writing a
variable as "L1" rather than "l1". [CMUCL's "extensions.lisp".]

- Making CASE keys [and similer, e.g., XLIB:EVENT-CASE keys]
stand out from the code they invoke.

- Making TAGBODY tags stand out from their surrounding code.
[Yes, this *shouldn't* cause a problem with :INVERT if all of
the corresponding GO forms *also* capitalize their arguments,
but Murphy is seldom your friend...]

-----
Rob Warnock <rpw3(a)rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607


From: Vassil Nikolov on

On Mon, 12 Oct 2009 20:24:35 -0500, rpw3(a)rpw3.org (Rob Warnock) said:
> ...
> - Making TAGBODY tags stand out from their surrounding code.
> [Yes, this *shouldn't* cause a problem with :INVERT if all of
> the corresponding GO forms *also* capitalize their arguments,

Not to make too fine a point of it, but if they do, that would
defeat the purpose somewhat of uppercasing the tags to make their
_locations_ stand out... (Assuming that seeing the go-to points is
more valuable than seeing the come-from points.)

---Vassil.


--
"Even when the muse is posting on Usenet, Alexander Sergeevich?"
From: Rob Warnock on
Vassil Nikolov <vnikolov(a)pobox.com> wrote:
+---------------
| On Mon, 12 Oct 2009 20:24:35 -0500, rpw3(a)rpw3.org (Rob Warnock) said:
| > - Making TAGBODY tags stand out from their surrounding code.
| > [Yes, this *shouldn't* cause a problem with :INVERT if all of
| > the corresponding GO forms *also* capitalize their arguments,
|
| Not to make too fine a point of it, but if they do, that would
| defeat the purpose somewhat of uppercasing the tags to make their
| _locations_ stand out... (Assuming that seeing the go-to points is
| more valuable than seeing the come-from points.)
+---------------

All good points, but all of the examples I actually found in legacy code
uppercased both (or neither). [Examples from CMUCL: file "code/print.lisp"
function SYMBOL-QUOTEP; file "code/package.lisp" macro WITH-SYMBOL;
file "code/reader.lisp" function READ-TOKEN, just to name a few.]


-Rob

-----
Rob Warnock <rpw3(a)rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607