Lady Ada

Ada '83 Language Reference Manual

Copyright 1980, 1982, 1983 owned by the United States Government. Direct reproduction and usage requests to the Ada Information Clearinghouse.


12. Generic Units

A generic unit is a program unit that is either a generic subprogram or a generic package. A generic unit is a template, which is parameterized or not, and from which corresponding (nongeneric) subprograms or packages can be obtained. The resulting program units are said to be instances of the original generic unit.

A generic unit is declared by a generic declaration. This form of declaration has a generic formal part declaring any generic formal parameters. An instance of a generic unit is obtained as the result of a generic instantiation with appropriate generic actual parameters for the generic formal parameters. An instance of a generic subprogram is a subprogram. An instance of a generic package is a package.

Generic units are templates. As templates they do not have the properties that are specific to their nongeneric counterparts. For example, a generic subprogram can be instantiated but it cannot be called. In contrast, the instance of a generic subprogram is a nongeneric subprogram; hence, this instance can be called but it cannot be used to produce further instances.

References: declaration, generic actual parameter, generic declaration, generic formal parameter, generic formal part, generic instantiation, generic package, generic subprogram, instance, package, program unit, subprogram.

Rationale references: 12 Generic Units

Sub-topics:

[INDEX][CONTENTS]
[Ada Information Clearinghouse]

Address any questions or comments to adainfo@sw-eng.falls-church.va.us.