[GAP] Ada 2005 object.method doesn't always dispatch

Erhard Ploedereder ploedere at informatik.uni-stuttgart.de
Thu Feb 16 12:49:00 CET 2006


Martin wrote:
> To get dispatching, I have to do:
> classwide_ptr(this).operation2

Pascal wrote:
> Don't we have the same behavior in Ada95 (I mean this is not related to
> Ada 2005). Calling a method with a non-classwide type (access type or
> not) will never dispatch.


Indeed. This is the unchanged Ada95 rule. The difference to Java merely 
becomes more obvious with the object prefix notation.
A small amendment to Pascal's words: ... unless the method is abstract.

This is a difference versus all "truly object-oriented languages" like 
Java or Eiffel, and the affictionados of OO hate it. 
However, there are excellent software engineering reasons for this
decision. I have a 90 minute talk on what redispatching, combined with
accidental method capture, does to you in maintenance. Whenever I gave
this talk, even the affictionados started thinking (because the problem
has no known solution in "true OO").

Erhard
-------------------------
Erhard Plödereder
University of Stuttgart
  


More information about the GAP mailing list