From: Kaz Kylheku
Subject: Re: changing a symbol name
Date: 
Message-ID: <cf333042.0410141424.3806c730@posting.google.com>
"Christophe Turle" <······@nospam.com> wrote in message news:<·······················@news.free.fr>...
> 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"

This is broken. Or perhaps not.

Firstly (symbol-name 'myfunc) is not any of the standard function
forms that serve as places according to 5.1.2.2 Function Call Forms as
Places. Therefore, it must be treated in accordance with 5.1.2.9 Other
Compound Forms as Places.

This section states that ``For any other compound form for which the
operator is a symbol f, the setf form expands into a call to the
function named (setf f).''

Thus the above is equivalent to:

  ((setf symbol-name) 'myfunc "myFunct")

Assuming that the implementation gets this detail right, it must be
that it actually has a (SETF SYMBOL-NAME) function, as an extension,
and that this function is in fact what is reporting the error, because
it happens to have the semantics of updating the string object
destructively, rather than replacing the name with a new string
object.