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


12.7 Formal Packages

  1. Formal packages can be used to pass packages to a generic unit. The formal_package_declaration declares that the formal package is an instance of a given generic package. Upon instantiation, the actual package has to be an instance of that generic package.

    Syntax

  2. formal_package_declaration ::=
       with package defining_identifier is new
         generic_package_name formal_package_actual_part;
    
  3. formal_package_actual_part ::= (<>) | [generic_actual_part]
    

    Legality Rules

  4. The generic_package_name shall denote a generic package (the template for the formal package); the formal package is an instance of the template.
  5. The actual shall be an instance of the template. If the formal_package_actual_part is (<>), then the actual may be any instance of the template; otherwise, each actual parameter of the actual instance shall match the corresponding actual parameter of the formal package (whether the actual parameter is given explicitly or by default), as follows:
    1. For a formal object of mode in the actuals match if they are static expressions with the same value, or if they statically denote the same constant, or if they are both the literal null.
    2. For a formal subtype, the actuals match if they denote statically matching subtypes.
    3. For other kinds of formals, the actuals match if they statically denote the same entity.

Static Semantics

  1. A formal_package_declaration declares a generic formal package.
  2. The visible part of a formal package includes the first list of basic_declarative_items of the package_specification. In addition, if the formal_package_actual_part is (<>), it also includes the generic_formal_part of the template for the formal package.


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