Re: [boost] Runtime Dynamic Dispatch (boost-dispatch)

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Janek Kozicki Sent: Wednesday, October 18, 2006 4:53 PM To: boost@lists.boost.org Subject: Re: [boost] Runtime Dynamic Dispatch (boost-dispatch)
Dean Michael Berris said: (by the date of Wed, 18 Oct 2006 22:24:09 +0800)
Hi Everyone,
I'm about to make a shameless plug about the runtime dispatch library I've been working on the past few months (mostly testing and using in a project), which I've uploaded to the vault: http://tinyurl.com/ycsq6n for everyone to check out and comment on.
can it be used for multimethods ?
Doesn't seem like it. It uses a single value to dispatch so it's the same thing as single dispatch. Shouldn't be impossible to dispatch based on multiple values though.

Sohail Somani said: (by the date of Wed, 18 Oct 2006 17:03:26 -0700)
can it be used for multimethods ?
Doesn't seem like it. It uses a single value to dispatch so it's the same thing as single dispatch. Shouldn't be impossible to dispatch based on multiple values though.
Do you know something that does multimethods? I have written my own multimethods library, based on "Modern C++ Design" by Andrei Alexandrescu. I use it in my prject, yade. But I'm looking forward for some boost replacement, anybody working on it? -- Janek Kozicki |

Hi Guys, On 10/19/06, Sohail Somani <s.somani@fincad.com> wrote:
can it be used for multimethods ?
Doesn't seem like it. It uses a single value to dispatch so it's the same thing as single dispatch. Shouldn't be impossible to dispatch based on multiple values though.
I have an example use (in the accompanying tests) which uses a boost::tuple<> as the index type. If the aim was to use multiple values, you can create a tuple from it and use that as an index -- then couple it with a validation and routing strategy that allows you to validate and manipulate the index used for the dispatch. If you need to call multiple methods, you can use the invoker interface to the dispatcher -- but still using single dispatch. You can even use Boost.Signals to register a set of methods and register it to the dispatcher on a single index. HTH -- Dean Michael C. Berris C++ Software Architect Orange and Bronze Software Labs, Ltd. Co. web: http://software.orangeandbronze.com/ email: dean@orangeandbronze.com mobile: +63 928 7291459 phone: +63 2 8943415 other: +1 408 4049532 blogs: http://mikhailberis.blogspot.com http://3w-agility.blogspot.com http://cplusplus-soup.blogspot.com

Dean Michael Berris said: (by the date of Thu, 19 Oct 2006 17:09:02 +0800)
can it be used for multimethods ?
I have an example use (in the accompanying tests) which uses a boost::tuple<> as the index type. If the aim was to use multiple values, you can create a tuple from it and use that as an index -- then couple it with a validation and routing strategy that allows you to validate and manipulate the index used for the dispatch.
If you need to call multiple methods, you can use the invoker interface to the dispatcher -- but still using single dispatch. You can even use Boost.Signals to register a set of methods and register it to the dispatcher on a single index.
thanks, I will check it out. I have one question though. Currently I am using a 2D matrix to preform dispatching on two virtual base classes. This matrix approach allows fast lookup. Does your method allow a similar solution? -- Janek Kozicki |

Hi Janek, On 10/20/06, Janek Kozicki <janek_listy@wp.pl> wrote:
Dean Michael Berris said: (by the date of Thu, 19 Oct 2006 17:09:02 +0800)
can it be used for multimethods ?
I have an example use (in the accompanying tests) which uses a boost::tuple<> as the index type. If the aim was to use multiple values, you can create a tuple from it and use that as an index -- then couple it with a validation and routing strategy that allows you to validate and manipulate the index used for the dispatch.
If you need to call multiple methods, you can use the invoker interface to the dispatcher -- but still using single dispatch. You can even use Boost.Signals to register a set of methods and register it to the dispatcher on a single index.
thanks, I will check it out. I have one question though. Currently I am using a 2D matrix to preform dispatching on two virtual base classes. This matrix approach allows fast lookup. Does your method allow a similar solution?
I haven't checked out how the dispatcher plays on the traditional object oriented models: inheritance and multiple inheritance. However, the idea of using a 2D matrix can be solved by perhaps using a tuple as the index to the associated method/function. An example below might give more light: boost::dispatch::dispatcher<void(), boost::tuple<int, int> > d; d[make_tuple(0, 0)] = function_1; d[make_tuple(0, 1)] = function_2; d[make_tuple(1, 0)] = function_3; d[make_tuple(1, 1)] = function_4; // ... int x, y; std::cin >> x >> y; d[make_tuple(x, y)](); HTH! :-) -- Dean Michael C. Berris C++ Software Architect Orange and Bronze Software Labs, Ltd. Co. web: http://software.orangeandbronze.com/ email: dean@orangeandbronze.com mobile: +63 928 7291459 phone: +63 2 8943415 other: +1 408 4049532 blogs: http://mikhailberis.blogspot.com http://3w-agility.blogspot.com http://cplusplus-soup.blogspot.com
participants (3)
-
Dean Michael Berris
-
Janek Kozicki
-
Sohail Somani