On Mon, 05 May 2008 09:45:24 +0200, Torben Fgidius Mogensen wrote:
> The most important optimisation is to get rid of dynamic method calls.
>
> This can, however, be quite tricky as you can't tell if a method can
> be overridden without knowing the whole program, so it plays havoc
> with separate compilation. A compromise is to allow methods to be
> declared "final", which ensures it is never overridden.
I think a consistent types system would be a better way. In Ada it is
always known if a call is dispatching or not. That is because of
proper typing. When an object is of a specific type, its methods never
dispatch, for that obvious reason, that the type is known to be
specific.
For the same reason in Ada there is no implicit re-dispatch from the
method bodies. A method always deals with a specific type, it has
dispatched before. Therefore any further calls from there to other
methods never dispatch again. The compiler knows their targets
statically, it can inline them etc.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


|