Newsgroups: comp.lang.lisp
From: hoey@ai.etl.army.mil (Dan Hoey)
Date: 17 Mar 89 18:42:19 GMT
Subject: Re: Garbage Collecting symbols

tt...@opus.cdc.com (Tuyen Tran) writes:

>If the only path from the root to a symbol is through the symbol's
>package, and the symbol's value/function/plist cells are empty, is it
>safe to remove the symbol?

It's not ``safe'' in the sense of being invisible to the user, who
may be using the package as a way of storing a set of strings that
are later to be retrieved with DO-SYMBOLS.  That is why all lisps
that I know of that GC interned symbols do so under control of a
user-selectable switch.  Maclisp called its switch something like
GCTWA, for ``GC truly worthless atoms''.  Back in those days they
often called symbols ``atoms.''

>Some LISPs use the existance of a symbol on a package to shadow
>inherited symbols of the same name.  It seems to me that removing
>empty symbols in some cases would affect the behavior of the
>system.

Your definition of these symbols as having their only path ``through
the package'' leaves something to be desired.  All definitions I've
heard of that deal with TWA's specify that there be no pointer to
them other than that implicit in the symbol's accessibility through
DO-SYMBOLS or equivalent.  Thus the symbol's presence on the
PACKAGE-SHADOWING-SYMBOLS list of the package would preserve it from
collection.

If you explicitly UNINTERN a shadowing symbol, then Common Lisp
removes it from the shadowing-symbols list.  Thus it is impossible to
determine whether the system uses the presence of the symbol or its
membership in the shadowing- symbols list to perform shadowing.

Dan
