12.5.3 Formal Array Types
[The category determined for a formal array type is the category of all
This rule follows from the rule in 12.5
says that the category is determined by the one given in the name of
the syntax production. The effect of the rule is repeated here to give
a capsule summary of what this subclause is about.
For a formal array
subtype, the actual subtype shall satisfy the following conditions:
The formal array type and the actual array type
shall have the same dimensionality; the formal subtype and the actual
subtype shall be either both constrained or both unconstrained.
For each index position, the index types shall
be the same, and the index subtypes (if unconstrained), or the index
ranges (if constrained), shall statically match (see 4.9.1
The component subtypes of the formal and actual
array types shall statically match.
If the formal type has aliased components, then
so shall the actual.
Ramification: On the other hand, if the
formal's components are not aliased, then the actual's components can
be either aliased or not.
Example of formal
-- given the generic package
type Item is private;
type Index is (<>);
type Vector is array (Index range <>) of Item;
type Table is array (Index) of Item;
package P is
-- and the types
type Mix is array (Color range <>) of Boolean;
type Option is array (Color) of Boolean;
-- then Mix can match Vector and Option can match Table
package R is new P(Item => Boolean, Index => Color,
Vector => Mix, Table => Option);
-- Note that Mix cannot match Table and Option cannot match Vector
Incompatibilities With Ada 83
The check for matching of
component subtypes and index subtypes or index ranges is changed from
a runtime check to a compile-time check. The Ada 83 rule that “If
the component type is not a scalar type, then the component subtypes
shall be either both constrained or both unconstrained” is removed,
since it is subsumed by static matching. Likewise, the rules requiring
that component types be the same is subsumed.
Wording Changes from Ada 95
We change to “determines a category” as that is the new terminology
(it avoids confusion, since not all interesting properties form a class).
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe