- 10 ·
- An explicit declaration overrides an implicit declaration of a primitive subprogram, [regardless of which declaration occurs first];
- 10.a
- Ramification: And regardless of whether the explicit declaration is overloadable or not.
- 10.b
- The "regardless of which declaration occurs first" is there because the explicit declaration could be a primitive subprogram of a partial view, and then the full view might inherit a homograph. We are saying that the explicit one wins (within its scope), even though the implicit one comes later.
- 10.c
- If the overriding declaration is also a subprogram, then it is a primitive subprogram.
- 10.d
- As explained in 7.3.1, "Private Operations", some inherited primitive subprograms are never declared. Such subprograms cannot be overridden, although they can be reached by dispatching calls in the case of a tagged type.
- 11 ·
- The implicit declaration of an inherited operator overrides that of a predefined operator;
- 11.a
- Ramification: In a previous version of Ada 9X, we tried to avoid the notion of predefined operators, and say that they were inherited from some magical root type. However, this seemed like too much mechanism. Therefore, a type can have a predefined "+" as well as an inherited "+". The above rule says the inherited one wins.
- 11.b
- The "regardless of which declaration occurs first" applies here as well, in the case where
derived_type_declaration in the visible part of a public library unit derives from a private type declared in the parent unit, and the full view of the parent type has additional predefined operators, as explained in 7.3.1, "Private Operations". Those predefined operators can be overridden by inherited subprograms implicitly declared earlier.
- 12 ·
- An implicit declaration of an inherited subprogram overrides a previous implicit declaration of an inherited subprogram.
- 13 ·
- [For an implicit declaration of a primitive subprogram in a generic unit, there is a copy of this declaration in an instance.] However, a whole new set of primitive subprograms is implicitly declared for each type declared within the visible part of the instance. These new declarations occur immediately after the type declaration, and override the copied ones. [The copied ones can be called only from within the instance; the new ones can be called only from outside the instance, although for tagged types, the body of a new one can be executed by a call to an old one.]
- 13.a
- Discussion: In addition, this is also stated redundantly (again), and is repeated, in 12.3, "Generic Instantiation". The rationale for the rule is explained there.