Re: Multi-method

Jean-Marc Bourguet <>
7 Apr 2002 12:36:53 -0400

          From comp.compilers

Related articles
Multi-method (Jean-Marc Bourguet) (2002-03-31)
Re: Multi-method (2002-04-06)
Re: Multi-method (2002-04-06)
Re: Multi-method (Joachim Durchholz) (2002-04-06)
Re: Multi-method (Jean-Marc Bourguet) (2002-04-07)
Re: Multi-method (Jean-Marc Bourguet) (2002-04-07)
Re: Multi-method (Dmitry A.Kazakov) (2002-04-07)
Re: Multi-method (Joachim Durchholz) (2002-04-07)
Re: Multi-method (Richard Rogers) (2002-04-10)
| List of all articles for this month |

From: Jean-Marc Bourguet <>
Newsgroups: comp.compilers
Date: 7 Apr 2002 12:36:53 -0400
Organization: Guest of ProXad - France
References: 02-03-190 02-04-022
Keywords: C++, OOP
Posted-Date: 07 Apr 2002 12:36:53 EDT (VBDis) writes:

> Jean-Marc Bourguet <> schreibt:
> >In the first case, the use of "vtable" allows to have an efficient way
> >of making this dispatch, even in the context of separate compilation
> >(at the cost of constraining the possible types).
> >
> IMO the types here are not constrained.

A dispatching function can't select between an implementation for two
unrelated types, not even for two related types for which the common
ancestors are not valid types.

Yes, these constrains also allow static type checking but allowing to
do the type checking at run time will not remove all of them if you
want to implement dispatching with vtable indexed by an integer
(you'll have to make the vtable associative table indexed by the
function name).

Allowing the declaration of dispatching function outside the module
where the type is declared will also imply the possibility of adding
elements to the table or force its construction at link or start up

> With multiple parameters C++ templates may be useful.

C++ template gives static polymorphism, multiple dispatch a dynamic
one. I fail to see how template can help in this context.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.