Subject: bug#10836: guardians and weak references

From: Andy Wingo <[email-masked]>
Date: Wed, 29 Feb 2012 10:26:12 +0100

Hi Mark,

Thanks for your thoughts :-)

On Wed 29 Feb 2012 02:22, Mark H Weaver <[email-masked]> writes:

> Is there a need for weak-key tables that use something other than 'eq?'
> as the predicate?

There are two examples in Guile.  One is (ice-9 poe), and the other is
the symbol table.

> It's not clear to me that any other predicate makes
> sense for a weak-key table.

It wasn't clear to me either, but given those two examples, it makes me
hesitant to remove that functionality.

> On the other hand, even for 'eq?' weak-key tables, there's another way
> to retrieve entries without the key: the table iterators 'hash-fold' et
> al.  I guess this introduces the same race for _any_ kind of hash table.

Yes.  I am wondering whether or not to expose this choice to the user --
they could choose to have the associations present after finalization
(i.e., after a guardian has resurrected an object), or they could choose
to see updates atomically (avoiding this race).  There is a relevant
thread on the libgc list:

  http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/4787/focus=4793

Regards,

Andy
-- 
http://wingolog.org/