D2 weak references

Stewart Gordon smjg_1998 at yahoo.com
Wed Apr 15 10:33:59 PDT 2009


Jason House wrote:
> Does anyone have a weak reference library for D2?
> 
> Without that, hash tables and search trees don't mix. I'm hoping that 
> a weak reference library can be merged into druntime.

Weak references don't fit well into D at the moment.  It's been talked 
about before (albeit not in reference to D2 in particular):

http://www.digitalmars.com/d/archives/digitalmars/D/713.html
http://www.digitalmars.com/d/archives/digitalmars/D/Weak_references._69761.html

and probably others.

But I think that, if D gained weak references as a built-in feature it 
would work well and be useful.  A decent library implementation may 
otherwise be possible if D's GC API gains:
- an explicit pinning mechanism
- a means of creating listeners on the GC

Stewart.



More information about the Digitalmars-d mailing list