Raffael Cavallaro <raffaelcavallaro@pas-d'espam-s'il-vous-plait-mac.com> wrote:
| Kent M Pitman <firstname.lastname@example.org> said:
| > Does this help?
| Maybe I'm confused as well, but for me the issue arises because I
| would expect that (constantp x) would tell me if x is a constant
| *object*, which is to say, I would expect that constantp would tell
| me if an object is immutable. Instead, constantp tells me if a
| *form* is a constant form, which is not always helpful.
That's correct [in both senses]. E.g., in an implementation like CMUCL
which chooses to evaluate the value of a (DEFCONSTANT <var> <form>)
at LOAD time, a (CONSTANTP <var>) can return T at compile time and yet
the *value* of <var> is *NOT* available at compile time!!
To say that at times this can be frustrating is an understatement... ;-}
 Legally, according to CLHS "Macro DEFCONSTANT":
If a defconstant form appears as a top level form, the
compiler must recognize that name names a constant variable.
That implies that a (CONSTANTP <var>) later in the code *must*
return T, but:
An implementation may choose to evaluate the value-form
at compile time, load time, or both.
So attempting to *reference* the value of <var> at compile time
is allowed to fail... even if <form> is a simple literal!
Rob Warnock <email@example.com>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607