Dynamic binding -- Qt's Signals and Slots vs Objective-C

Josh Stern josh_usenet at phadd.net
Wed Sep 27 12:50:33 PDT 2006


On Wed, 27 Sep 2006 20:44:05 +0200, Lutger wrote:

> Josh Stern wrote:
>> On Wed, 27 Sep 2006 17:55:03 +0200, Lutger wrote:
>> 
>> I found this comparison of different C++ approaches to signal slots
>> with a web search.
>> 
>> http://slotsig.sourceforge.net/doc/features-compare.html
>> 
>> Can't vouch for the validity of the summary, but it might be a good
>> starting point for further investigation.
>> 
>> 
> 
> Nice list, there are also a few benchmarks there. Depending on 
> interpretation of course, my sigslots library scores equal points 
> feature-wise as slotsig. There are some features in slotsig which might 
> be worth investing, thank you for the link.
>   These lists are always biased, but the biggest advantages of QT are 
> not listed: dynamic connections which make it possible to, for example, 
> script connections, load from xml resource, etc. This is where string 
> based sigslots or - as I understand - Objective C is superior to the 
> template-based implementations.

The issues of what has to be decided at design time, compile time, and 
run time in order to use signals and  slots are important. 
Requiring inheritance from QObject for some things is one kind
of strong restriction, and requiring connections specified at
compile time is another.  There are language vs. library issues
involved here.  A (the?) key language feature seems to be the question of
what kind of support does the language provide for making it easy to
attach a "hook" to a given function (where hook means roughly "now
Mr.Ffunction, from now on, before you exit, please call this other
function I'm about to tell you about with your return value as
its input and maybe some other info like a pointer to your object in case
you are a member function"). I agree with the implicit point made by the
slotsig guy that part of this mechanism ideally should give the user
options about thread-safety and thread-locality. Seems like if the
language provides a really good hook mechanism, a lot of convenient
library stuff can be built on top to taste. Intuitively it seems like D's
system of Boxs and delegates could be put to good use towards finding
attractive possibilities within the library problem design space, and
having GC to eliminate most ownership issues makes many solutions a lot
simpler.   








More information about the Digitalmars-d mailing list