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

REMF and REMPROP



Sigh.  Since only Fahlman and Masinter seem to have understood what I
said, I'm going to explain it one more time, rather than sending
individual explanations to people who didn't understand.  I am not
advocating changing REMPROP to be equivalent to (SETF (GET SYMBOP PROP) NIL).
I am advocating changing the function as follows, in Symbolics Common Lisp:

Before:   (defun old-remprop (symbol indicator)
	    (let* ((ppl (locf (symbol-plist symbol)))
		   (pl (location-contents ppl)))
	      (loop
		(when (endp pl) (return nil))
		(when (eq (pop pl) indicator)
		  (setf (location-contents ppl) (cdr pl))
		  (return (return t)))
		(psetf ppl pl pl (cdr pl)))))

After:    (defun new-remprop (symbol indicator)
	    (let* ((ppl (locf (symbol-plist symbol)))
		   (pl (location-contents ppl)))
	      (loop
		(when (endp pl) (return nil))
		(when (eq (pop pl) indicator)
		  (setf (location-contents ppl) (cdr pl))
*** Change -->	  (setf (car pl) nil)
		  (return (return t)))
		(psetf ppl pl pl (cdr pl)))))

(For those of you unfamiliar with Symbolics Common Lisp, LOCF returns a
"locative cell" to the place referenced, which can be then set or
referenced using LOCATION-CONTENTS.  LOCATION-CONTENTS = CDR.)

If the symbol-plist is the only pointer to the property list, then the
behavior of the new-remprop is NO DIFFERENT from old-remprop.  The
change merely allows the garbage collector to reclaim the removed
property in the case where the plist is not immediately reclaimed.  I
view this as an important case because many times programmers use
REMPROP to "remove pointers to structures no longer referenced".

I am writing a formal proposal to CL-Cleanup, and will try to represent
the views others have expressed as best I can.