[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
REMF and REMPROP
In reply to: David L. Andre <DLA at DIAMOND.S4CC.Symbolics.COM>
Both of these are documented by CLtL to "destructively splice the
property list" to remove the value. The nature of the destructive
splicing is not specified.
The question is, is it legal for REMF and REMPROP to remove the pointer
to the value (i.e., by setting it to NIL) as part of this operation?
I guess this is yet another thing that needs to be clarified. Here are
a couple of opinions that may be of use in the meantime:
First, it is in the nature of property lists that they get destructively
modified, and it is a remarkably bad idea to write code of the sort you
describe that shares this top-level list structure. Anyone who writes
code that does this should change the code to something sensible and not
quibble about what is legal.
On the other hand, it seems to me that it violates the (implicit)
contract of a destructive operation like REMPROP to take the excised
piece of list and chop it up into little pieces or to re-use the list
cells that it snipped out. The fact that some built-in operation makes
a destructive change does not necessarily give this operation the right,
or the necessary global perspective, to decide what is garbage and what
is not. Sharing is possible in Common Lisp, and it is the garbage
collector's job to decide what cons cells can safely be recycled.
Destructive operations should do what they are documented to do, and no
I grant that CLtL does not explicitly prohibit the kind of operation you
are describing, but I submit that this is because it never occurred to
us that anyone would want to do such a thing.