WeakRef

Bill Baxter dnewsgroup at billbaxter.com
Fri Jan 25 17:39:04 PST 2008


Bill Baxter wrote:
> Is this a good way to make a weak reference to an object?
> Am I missing anything?  The little unittest seems to work.
> 
> It would be nice if something like this were in the standard library so 
> I wouldn't have to worry about using the undocumented notifyRegister and 
> notifyUnRegister methods.
> 
> --bb

Looks like just a week before I sent this Tango got weak pointers.  So 
now you can do a similar thing in Tango too.
     http://www.dsource.org/projects/tango/forums/topic/341

BTW tango's names for the subscribe/unsubscribe functions are slightly 
better-named than Phobos'!
     rt_attachDisposeEvent and rt_detachDisposeEvent
  vs
     notifyRegister and notifyUnRegister

They're not documented in Phobos, so it's not too late to pick some 
better names (or provide some better aliases anyway)!

--bb



More information about the Digitalmars-d mailing list