Eldar Insafutdinov wrote:
Yigal Chripun Wrote:

Bill Baxter wrote:
On Fri, Jan 16, 2009 at 10:22 AM, Walter Bright
<newshou...@digitalmars.com>   wrote:
Bill Baxter wrote:
On Fri, Jan 16, 2009 at 9:00 AM, Yigal
Chripun<yigal...@gmail.com>   wrote:

2. there's more to S&S than just an array of delegates -
they are weak refs so that destruction of an object
disconnects automatically the apropriate signals. but there
is a weakref lib for D written by Bill IIRC, that could be
utilized in qtD. no pre-processor needed.
The "delegates" in Qt are more like a QObject,QString pair.
The object and the *name* of the method to call.

And there aren't really "weak refs" in Qt.  When you connect
a signal and slot it also makes some extra connections
between the two objects' destroyed() signals.  So each object
is also listening for the other object to be destroyed.
Sort of a weak ref, but more like a strong ref with active
notifications about destruction either way.   In a GC'ed
language with real weak refs, the slot holder doesn't have
to worry if the signal sender disappears.
This is taken care of in std.signals.
WeakRef Yigal was referring to is just a handy wrapper class for
the same GC callback that std.signals uses.  Plus it's compatible
with both Phobos and Tango.

--bb
What I meant was that QT provides the functionality of a weakref,
but you're right that that's not a "real" weak ref. still, I think
this functionality need to be implemented in qtD and luckily D does
have true weakrefs that can be utilized for this.

Question: since D2 now uses the same runtime as tango and that
includes the (same) GC, do we still need the wrapper, for D2 code?

What do you mean by wrapper? Or you mean extern C++ capabilites of
D2? I tried them, and they seem really poor. Besides nobody who I was
asking knows when D2 finally stabilise and goes out of beta, tango
for example isn't going to be ported to D2 in nearest future.

I was refering to Bill's WeakRef class. In the above quote you can see that he said: "WeakRef Yigal was referring to is just a handy wrapper class for the same GC callback that std.signals uses. Plus it's compatible with both Phobos and Tango."

Reply via email to