www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - weak pointers for Objects and delegates pointing to Objects

reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Who said D didn't support weak pointers?





































































































Usage sample:




























Don't be irritated by additional output.
http://d.puremagic.com/issues/show_bug.cgi?id=457

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFPyYhLK5blCcjpWoRAgiTAJ9vsjPF0HPuYLG7lnJqSxQTZVr8iACgjWzW
4X1omJzTMbab/iEe3z3AAQc=
=n0dP
-----END PGP SIGNATURE-----
Oct 25 2006
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Thomas Kuehne wrote:

 Who said D didn't support weak pointers?
So is this "problem solved?" Are there any issues or limitations with the weak pointer code you posted? If not, Great! Weak refs were one of the last pieces of the puzzle for implementing rock-solid signals/slots from what I understood. --bb
Oct 25 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bill Baxter schrieb am 2006-10-26:
 Thomas Kuehne wrote:

 Who said D didn't support weak pointers?
So is this "problem solved?" Are there any issues or limitations with the weak pointer code you posted? If not, Great!
Limitation: Only objects and delegates pointing to object member functions are supported. I haven't yet looked through the GC code, but adding support for all GC allocated types ought to be possible without major changes there. Weak pointers to array elements though will most likely be impossible without major changes. Using GCC/GDC's "-finstrument-functions" should allow weak pointers for all types stored on the stack as a pure library implementation. For DMD that would require "-profile" as well as hijacking internal/trace.d. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFQFysLK5blCcjpWoRAn+bAJsHxPYr/RNgDN76OZgyydWq0b6cSgCgkjag zP+m/bxMAq2vCt9KY4L0Nvc= =Xu4O -----END PGP SIGNATURE-----
Oct 26 2006