From: Marco Antoniotti
Subject: Re: changing a symbol name
Date: 
Message-ID: <qGDbd.12$u5.23062@typhoon.nyu.edu>
Christophe Turle wrote:

> "Pascal Costanza" <········@web.de> a �crit dans le message de
> ·················@f1node01.rhrz.uni-bonn.de...
> 
>>Christophe Turle wrote:
>>
>>
>>>I want to change a symbol name. But it is an error to do that, why ?
>>>
>>>(setf (symbol-name 'myfunc) "myFunct")
>>>=> attempt to to modify a read-only string: "MYFUNC"
>>>
>>>From the semantic view point, i don't see why it is forbidden. I hope
> 
> it's
> 
>>>not for performance issue :(
>>>
>>>Is there an easy way to hack this ? I really need this feature.
>>
>>You're calling for deep trouble. (Hint: Symols are part of a program
>>source code.)
> 
> 
> Symbols are but why their name are ? symbol & name should be distinct.
> 
> 
>>What is it that you actually want to do?
> 
> 
> I want to rename all lisp symbols to their downcase counter part. I found
> this way to correct the bad reader uppercase convention : we write symbols
> in lower-case but as mentionned here a few days ago, we still use upper-case
> conversion for backward compatibility :(

It is not "backward compatibility".  It is TWTA (The Way Things Are). 
:) Sorry.  I don't like it either, but that is the way it is.

The way to do that is to define your own package.

(defpackage "MY-CL" (:use))

(do-external-symbols (s "CL")
   (let ((new-symbol (intern (string-downcase (symbol-name s)) "MY-CL")))
      (when (boundp s)
        (setf (symbol-value new-symbol) (symbol-value s)))
      (when (fboundp s)
        (setf (symbol-function new-symbol) (symbol-function s)))
      ;; Classes, types and other named entitied should be handled
      ;; here.
     ))

It is not perfect, but it is a start.

> The trouble arises when you need to mingle your code with preserve case code
> (like java). You have to use ugly '|' syntax to make all work together. And
> all that overhead because of old choices.

You need READTABLE-CASE :INVERT and *PRINT-CASE* :DOWNCASE at a minimum, 
and it still has rough edges.
Apart from that, there are no easy and portable solutions around.

As per the "old choices" they are the standard.  Either you change that 
(good luck :) ), or you may end up breaking it and making your programs 
unportable.

> Note that this is also useful when you change your mind about the name of a
> function, macro, variable or better : something you don't know all sub
> layers ...

Isn't M-% enough? :)

Cheers
--
Marco