[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How constant are defconstants?
I would assume that whereever one had written code like
(FOO *PLANETS*)
that he would get the same operational behaviour as if he had written
(FOO '(MERCURY VENUS EARTH MARS JUPITER SATURN URANUS NEPTUNE PLUTO))
PDP10 MacLisp made it possible to convert all such constants into
read-only areas -- with the view to catching unintended updates such as
your example
(SETF (CAR *PLANETS*) something)
but I'm sure that Common Lisp can't enforce such a protective mechanism
-- only permit it. Even MacLisp's solution is only partial, in that the
constants are writeable until the explicit call to "convert" everything
over.
Interlisp has gone to the other extreme -- not only is there lots of
existing code with runtime updates to compile-time constants, but in
Interlisp-10 there is even the weird SETN to update "numbers". E.g.
-> (SETQ TEM (SETQ PI 3.14))
3.14
-> (SETN PI 3.14159)
3.14159
-> TEM
3.14159
Happily, Interlisp-D, didn't perpetuate the SETN lossage, but there is
still a lot of resistance in the Interlisp community to giving up
updatability of "constants".
-- JonL --