> >This illustrates a fundamental advantage of Ada: It is difficult to
> >write correct programs that have typos.
> I agree in general, but there is one pitfall in the case of OOP (which by
> the way is not unique to Ada). If you misspell the name of a subprogram
> intended to override an otherwise implicitly inherited operation, then you
> do not override it even though you think you have. Example:
> The dynamic binding at (*) invokes the Student version of Financial_Aid,
> which is probably not what was intended. To some extent the need to repeat
> the subprogram specification in the package body reduces the risk of this
> effect, since maybe the typo will be spotted if it appears twice, but it is
> still a potential "gotcha".
But this problem is easily solved by required that operations of a
derived type that override those of the parent be explicitly identified
type T is new Controlled with ...;
override procedure Initialise (O : in out T);
(note the mis-spelling -- it should be -ize)
The error would indeed be caught by the compiler.
The programmer should state his intent on how he intends for an entity
to be used, and the compiler should check that his actual use of the
entity agrees with his stated intent. This is exactly what happens
already when you declare a type.
Although I'm generally happy with Ada95, I feel that not requiring
programmers to explicitly state that an operation overrides that of its
parent, is a language flaw.