May 17, 2004
In article <c8b8mj$v82$1@digitaldaemon.com>, Brian Hammond <d at brianhammond dot com> says...
>
>Your idea is fine it's just manual.  I was mostly curious if my issue could be solved using weakrefs in D.  As has been pointed out, weakrefs don't apply well to D.  Thus, to implement this, the monitored object must notify interested parties (say a cache) that it's been collected (notification is done in the destructor).

My original thought was to use this technique to create a generic "weak pointer" object.  But I have had a realization w.r.t finalization: weak pointers won't work properly from a "gc-dead" object because the finalizer cannot legally fiddle with sub-objects: they may also be garbage.

Kevin


1 2
Next ›   Last »