10.1 Separate Compilation
is either a package, a task unit, a protected unit,
a protected entry, a generic unit, or an explicitly declared subprogram
other than an enumeration literal. Certain kinds of program units can
be separately compiled. Alternatively, they can appear physically nested
within other program units.
for a compilation
Some implementations might
choose to make a compilation
be a source (text) file. Others might allow multiple source files to
be automatically concatenated to form a single compilation
Others still may represent the source in a nontextual form such as a
parse tree. Note that the RM95 does not even define the concept of a
Note that a protected subprogram is a subprogram,
and therefore a program unit. An instance of a generic unit is a program
A protected entry is a program unit, but protected
entries cannot be separately compiled.
A library unit is a separately
compiled program unit, and is always a package, subprogram, or generic
unit. Library units may have other (logically nested) library units as
children, and may have other program units physically nested within them.
A root library unit, together with its children and
grandchildren and so on, form a subsystem
For example, an implementation
might disallow a compilation
that contains two versions of the same compilation unit, or that contains
the declarations for library packages P1 and P2, where P1 precedes P2
in the compilation
but P1 has a with_clause
that mentions P2.
Wording Changes from Ada 83
The interactions between language issues and
environmental issues are left open in Ada 95. The environment concept
is new. In Ada 83, the concept of the program library, for example, appeared
to be quite concrete, although the rules had no force, since implementations
could get around them simply by defining various mappings from the concept
of an Ada program library to whatever data structures were actually stored
in support of separate compilation. Indeed, implementations were encouraged
to do so.
In RM83, it was unclear which was the official
definition of “program unit.” Definitions appeared in RM83-5,
6, 7, and 9, but not 12. Placing it here seems logical, since a program
unit is sort of a potential compilation unit.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe