Go to the first, previous, next, last section, table of contents.


12.5.3 Formal Array Types

  1. The class determined for a formal array type is the class of all array types.

    Syntax

  2. formal_array_type_definition ::= array_type_definition
    

    Legality Rules

  3. The only form of discrete_subtype_definition that is allowed within the declaration of a generic formal (constrained) array subtype is a subtype_mark.
  4. For a formal array subtype, the actual subtype shall satisfy the following conditions:
    1. 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.
    2. 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 section 4.9.1 Statically Matching Constraints and Subtypes.
    3. The component subtypes of the formal and actual array types shall statically match.
    4. If the formal type has aliased components, then so shall the actual.

Examples

  1. Example of formal array types:
  2. --  given the generic package
    
  3. generic
       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
       ...
    end P;
    
  4. --  and the types
    
  5. type Mix    is array (Color range <>) of Boolean;
    type Option is array (Color) of Boolean;
    
  6. --  then Mix can match Vector and Option can match Table
    
  7. package R is new P(Item   => Boolean, Index => Color,
                       Vector => Mix,     Table => Option);
    
  8. --  Note that Mix cannot match Table and Option cannot match Vector
    


Go to the first, previous, next, last section, table of contents.