| Thread overview | |||||
|---|---|---|---|---|---|
|
January 21, 2008 WeakRef | ||||
|---|---|---|---|---|
| ||||
Attachments: | 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 | |||
January 21, 2008 Re: WeakRef | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | 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
Oh, and that's public domain if anyone wants to use it.
--bb
| |||
January 26, 2008 Re: WeakRef | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | 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 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply