[gclist] weak pointer and gc

Raymond Wiker Raymond.Wiker@fast.no
Wed, 18 Apr 2001 10:00:22 +0200


Richard A. O'Keefe writes:
 > Ken Anderson <kanderson@bbn.com> wrote:
 > 	The CL implementations i've used, LispM, Lucid, Allegro, CMU
 > 	keep symbols forever.

	Not if you use delete-package.

 > Common Lisp *has* to keep symbols with non-default values for properties
 > around forever.  Suppose a Common Lisp program does
 > 
 >     (setf (symbol-value (intern "Great Zot!")) 42)
 > 
 > and then for the next 40 days and nights there are *no* references to the
 > symbol |Great Zot!| anywhere at all in the program.  Lisp must be ready
 > nonetheless to produce the right value for
 > 
 >     (symbol-value (intern "Great Zot!"))
 > 
 > *even though* the symbol was not referenced.
 > 
 > If a symbol has no value        (makunbound '|Great Zot!|)
 > and no function binding        (fmakunbound '|Great Zot!|)
 > and no property list    (setf (symbol-plist '|Great Zot!|) nil)
 > -- or rather, whatever default property list the Lisp uses --
 > then it may be removed by the garbage collector.

	I don't think so. The symbol *still* has an identity, which
may be required somewhere. Further, the package structures keep
references to interned symbols (either explicitly, via intern, or
implicitly, through reader operations.)

	Of course, this could all be slightly (or not so slightly)
wrong - I'm just a Lisp dabbler.

	//Raymond.

-- 
Raymond Wiker
Raymond.Wiker@fast.no