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

Re: Issue: HASH-TABLE-GC (no proposal)

I think Kent's message has it just right.

I've been allocated for a week and have not had time to do anything
about a proposal.  But to try to clear up a few points:

1. There is some question about whether weak-key hash tables are
   the right way to provide something of this sort.  On balance,
   I think they are.  There were suggestions on the CL list that
   weak pointers and finalization were better or at least more
   fundamental, but I think something based on hash tables is
   the (or at least a) right user-level facility to provide.
   Weak pointers, finalization, and so forth should be considered
   spearate issues.

2. Precedent.  It's true that there isn't much in the way of
   current practice in Common Lisp, but the idea is not untested.
   Temporary properties have been in Pop implementations for
   many years and, despite the name, they really are just hash
   tables.  Lisp/VM also seems to have them (but I can't be sure
   because I have only the documentation).

3. Need.  Hash tables are often used as a way to add properties
   (i.e., extra slots) to objects.  Imagine, say, that SYMBOL-PLIST
   was implemented not as part of the symbol but using a hash table.
   That seems reasonable until you realized than then any symbol
   with a plist could never be collected.  I should think that
   this problem greatly limits the usefulness of hash tables in
   many applications.

In case anyone is wondering "which Kent message?", it's the one
that said this:

>     ... Anyone else know of other "actual needs"?

>  - In my work with Cloe (internally at Symbolics), I've had need to
>    record various kinds of attribute information about non-symbols.

> All of these items need hash table with weak key links only.
> All of these items cause the accumulation of massive amounts of
> garbage over time with no (semantically valid) hope of recovery
> in the absence of weak hash tables.

> Yet problems that demand this sort of solution continue to hit people
> who have no access to such low-level/bit-twiddly solutions.

> There may be some little details to attend to, but abstractly the idea
> of a table with weak key links is both simple and powerful.

-- Jeff