Abstract
A generic unit is a program unit that is either a generic subprogram or a generic package. A generic unit is a template, which can be parameterized, 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, an instance of a generic subprogram is a (nongeneric) subprogram; hence, this instance can be called but it cannot be used to produce further instances.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2013 Authors/Editors
About this chapter
Cite this chapter
Tucker Taft, S., Duff, R.A., Brukardt, R.L., Ploedereder, E., Leroy, P., Schonberg, E. (2013). Generic Units. In: Taft, S.T., Duff, R.A., Brukardt, R.L., Ploedereder, E., Leroy, P., Schonberg, E. (eds) Ada 2012 Reference Manual. Language and Standard Libraries. Lecture Notes in Computer Science, vol 8339. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-45419-6_12
Download citation
DOI: https://doi.org/10.1007/978-3-642-45419-6_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-45418-9
Online ISBN: 978-3-642-45419-6
eBook Packages: Computer ScienceComputer Science (R0)