Boost logo

Boost :

From: Karl Nelson (kenelson_at_[hidden])
Date: 2000-11-20 19:39:36


[...]
> > Not at all. You simply need to build a slot type for a general
> > functor or lambda and it will plug into the system easily.
> >
> > Ie.
> >
> > boost::callback<void> cb= Functor();
> > Slot0<void> sl= functor_slot(cb);
> > sl(); // calls cb() -> Functor::operator()()
>
> Slot0<void> s1;
> {
> Object obj;
> boost::callback<void> cb = Closure(&obj, Object::foo);
> s1 = functor_slot(cb);
> s1();
> }
> s1();
>
> In the above, 'obj->foo' is really the target. When 'obj' goes out
> of scope the slot can't automatically disconnect the target.

Certainly, which is why if target cooperation is to be done, the
slot must be formed directly from by the signal/slot library.
(In the examples of the callback library no adaptors for
targetting an existing object were given.)

This is the basic argument as to why a signal/slot library isn't really
a replication of lambda because unless the lambda handles the
reverse dependencies it can't really be done or code above will
allow breakage.

[...]
> > Because the signals internals are reference counted they can be
> > passed and converted to a slot which will then be able emit the
> > signal at a later point. Thus everything is automated such that
> > the user does not need to manage any of the internal workings.
> > SigC-1.0 lacked a lot of these type of functionality.
>
> A user never manages the internals ;). I was suggesting that
> the "trick" was nice enough to be considered by any implementation of
> related concepts, provided the implementation can manage the
> overhead, meaning prevent it from becoming detrimonious.

Ah. It was possible to do this before in SigC but the user had
to write their own slot class. That basically meant the user
had to dink with internals. :-) I agree it is a good enough
feature that any multicast system should consider it.

I hope these emails have provided some insight into the design
goals of SigC verses the boost's target system and the design
space in which they both exist.

--Karl


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk