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) |
From: | "Dmitry A.Kazakov" <mailbox@dmitry-kazakov.de> |
Newsgroups: | comp.compilers |
Date: | 7 Apr 2002 12:37:44 -0400 |
Organization: | Compilers Central |
References: | 02-03-190 |
Keywords: | C++, OOP |
Posted-Date: | 07 Apr 2002 12:37:44 EDT |
Jean-Marc Bourguet wrote:
> Is there such a technique allowing to dispatch on the type of several
> parameters
> - in time proportionnal to the number of dispatching parameter
> - in such a way that independant compilation is possible.
The first move would be getting rid of vtable. The dispatch table
should be associated rather with methods than with objects. For a
method with n dispatching parameters the dispatch table could be a
n-dimensional array of thunks. The type tag could be a pointer to the
type vector that for each method gives an index in the dispatch
table. Thus a dispatching call would require n x indexing the types'
vectors + indexing the method's dispath table.
The major problems are:
1. Maintaining the data structures supporting dispatch at run time.
Provided that overriding may occur in a nested block, consider:
function Funny (...) is
type AA is new A ... -- A new type derived from A
function Foo (...) -- Override some method Foo of A
Object : AA;
begin
Foo (Object, ...); -- Dispatch to the local version of Foo
end Funny; -- Here AA is finalized and all effects should disappear
2. Freezing rules. Methods cannot be associated with just one type. Thus
they cannot be declared like in C++ within type declarations. The freezing
point in C++ is the closing } of the type declaration. One must relax this
rule, but not very loosely. Because arbitrary overrdinings are near to
impossible to maintain.
--
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de
Return to the
comp.compilers page.
Search the
comp.compilers archives again.