[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

quoted constants

 Since we've tripped over the subject of quoted constants and the
compiler I have a question. Is it valid for the compiler/interpreter
to assume that a quoted constant is read-only? That is, is this
code valid in all implementations:

 (let ((x '(nil))) (rplaca x 3))

 It turns out that Lucid will assume that quoted constants ARE
read-only. The implications of this are that quoted constants can
be placed in read-only storage and the garbage collector can assume
that these need not be traversed. There is a hole (feature? bug?)
in lucid common lisp that allows this code to work provided that
you have executed it interpretively since the quoted constants will
not be stuck into read-only storage for efficiency reasons. However,
if two garbage collections occur then you will probably have
lost the pointer (with 'undefined results').

 It seems to me that the above code should be defined as valid
common lisp. Please try to clarify this issue.

T.J.Watson Research Center
Yorktown Heights, N.Y. 10598