Weak References
Frank Benoit
keinfarbton at googlemail.com
Wed Aug 6 16:38:09 PDT 2008
PJP schrieb:
> Is there any plan to add support for weak references to the D garbage
> collector?
>
> Weak references are references which don't prevent the object from
> being garbage collected. If it has been garbage collected then the
> weak reference returns null.
>
> This is useful for things like resource caches, maintaining
> references to all instances of a specific class (ex: to implement an
> operation such as Window.minimizeAllWindows()), or to register a
> callback/listener with an object such that the registration won't
> prevent that object from being garbage collected.
And please, put a WeakHashMap on the TODO list too :)
http://java.sun.com/j2se/1.4.2/docs/api/java/util/WeakHashMap.html
More information about the Digitalmars-d
mailing list