Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-10-12 12:23:37

Hi Marco!

On 10/12/07, Marco Costalba <mcostalba_at_[hidden]> wrote:
> Now that we have an overload implementation I was starting to think
> how to integrate Dean dispatcher with overload.

It should be pretty straight forward, and the only thing I can agree
to is the one mentioned below, only this time it's going to have to be
more involved and more extensive -- the change to the Runtime Dynamic
Dispatcher Library (RDDL) will mean a lot of the functionality I've
written will have to be discarded, which I definitely don't mind.

> a dispatcher holds a fusion::vector of overloads objects instead of
> directly boost::functions, so that you can say
> d[0](7);
> d[0](7, "test");
> This is the most natural and most immediate approach.

I think holding a fusion::vector of overloads is needless. I think
having a map instead of keys to overload objects will be better than
the Functor wrappers I've implemented -- which should have contained
the functionality that Boost.Overload is now implementing. More
concretely, the dispatcher will now just be very much like:

std::map<key_type, boost::overload<signature1, signature2> > d;

The only advantage the dispatcher will have is that it will still
support the strategized index concept, strategized routing concept,
and the invoker interface.

I'm now going to first concentrate on documenting the Boost.Overload
implementation, get it eventually up to Boost standards (as far as
documentation, implementation, tests, portability, etc. are
concerned), then see first that it either gets into Boost as a
separate library or as an extension to Boost.Function before adding
support for it in the RDDL.

OTOH, I can cut a branch of the RDDL which packages and uses
Boost.Overload internally for those interested and do the integration
with it. If anybody's interested in doing this or working more on it,
let me know so I can add you to the Sourceforge project.

> But a perhaps more interesting approach is
> Integration from BELOW:
> In this case is overload that holds, instead of a tuple of
> boost:function objects a tuple of dispatcher opbjects.
> Currently dispatcher is single-signature, and this fits perfectly as a
> replacement for boost::function as used in overload.
> In this case we could have
> int foo1();
> int foo2();
> int bar();
> overload<int(), int(int)> f;
> f.set(foo1);
> f.set(foo2);
> f.set(bar);
> f()[0]; //calls foo1
> f()[1]; //calls foo2
> f(7); //calls bar
> Just some rough ideas to get some comments...

First, I don't see Boost.Function being replaced by the Dispatcher.
It's the other way around, RDDL depends on Boost.Function being there.

To enable multi-signature dispatch, the RDDL needs something like
Boost.Overload to be able to pull that off.

> Thanks
> Marco

Thank you too for the continued interest in the RDDL. Are you
currently using it in a setting other than your Factory

Dean Michael C. Berris
Software Engineer, Friendster, Inc.
[+63 928 7291459]
[+1 408 4049523]

Boost list run by bdawes at, gregod at, cpdaniel at, john at