References: CLtL p. 78, 87
Edit History: V1, 07 Nov 1988, Sandra Loosemore
V2, 12 Dec 1988, Sandra Loosemore
CLtL states that an implementation is permitted to "collapse"
constants appearing in code to be compiled if they are EQUAL. This
implicit sharing of compiled data structures may result in
unpredictable behavior if destructive operations are performed.
However, CLtL does not explicitly allow or disallow destructive
operations on constants.
Clarify that it is an error to destructively modify objects which are
self-evaluating forms or which appear inside of a QUOTE special form.
Disallowing modification of constants consistently in all situations,
rather than just in compiled code, is proposed because in some
compiled-only situations it may be difficult to distinguish between
"compiled" and "interpreted" code.
Many implementations "collapse" compiled constants.
Many implementations treat compiled constants as read-only. In
PSL/PCLS, for example, quoted data structures in compiled code are
copied into a part of memory that is not scanned by the garbage
collector. The TI Explorer's loader also copies constants into a
write-protected memory area.
Cost to implementors:
Cost to users:
User programs which perform destructive operations on constants are
Many novice programmers do not realize that modifying quoted data
structures is an error in many implementations. Including an explicit
statement in the standard that doing so is a bad idea will reduce
The issue of whether implementations are permitted to copy constants
seen by EVAL or COMPILE is discussed separately as issue QUOTE-MAY-COPY.