Re: Multi-method

vbdis@aol.com (VBDis)
6 Apr 2002 23:19:38 -0500

          From comp.compilers

Related articles
Multi-method jm@bourguet.org (Jean-Marc Bourguet) (2002-03-31)
Re: Multi-method haberg@matematik.su.se (2002-04-06)
Re: Multi-method vbdis@aol.com (2002-04-06)
Re: Multi-method joachim_d@gmx.de (Joachim Durchholz) (2002-04-06)
Re: Multi-method jm@bourguet.org (Jean-Marc Bourguet) (2002-04-07)
Re: Multi-method jm@bourguet.org (Jean-Marc Bourguet) (2002-04-07)
Re: Multi-method mailbox@dmitry-kazakov.de (Dmitry A.Kazakov) (2002-04-07)
Re: Multi-method joachim_d@gmx.de (Joachim Durchholz) (2002-04-07)
Re: Multi-method rprogers@seanet.com (Richard Rogers) (2002-04-10)
| List of all articles for this month |

From: vbdis@aol.com (VBDis)
Newsgroups: comp.compilers
Date: 6 Apr 2002 23:19:38 -0500
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
References: 02-03-190
Keywords: OOP
Posted-Date: 06 Apr 2002 23:19:38 EST

Jean-Marc Bourguet <jm@bourguet.org> 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. Every new type has a new VMT,
and since the invocation goes from the object (instance) through its
VMT to its method, it's a pretty extensible system.


With multiple parameters C++ templates may be useful. The key IMO is
the separation of the various parameters, so that in the best case
every single parameter can be handled separately. Otherwise up to N^M
procedures are required, to handle N parameters of M possible types.


In Delphi the TPersistent class has an Assign mechanism, which allows
to assign one object to another one. When A.Assign(B) is invoked, then
A executes the assignment if B is of a type, which is built into
A.Assign. Otherwise A calls B.AssignTo(A), whereupon B tries to
execute the assignment, in the opposite direction. Both Assign and
AssignTo are virtual methods, which pass unhandled arguments (types)
to their parent class method. If neither A nor B know about the other
type, then the assignment fails.


How would you exclude the latter case, that no procedure can handle a
given combination of dynamic types?


DoDi


Post a followup to this message

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