10.1 Separate Compilation
[
{separate compilation}
{compilation (separate)}
{Program unit}
[Glossary Entry]
A
program unit 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.
{Compilation unit}
[Glossary Entry]
The text of a program can be submitted
to the compiler in one or more
compilations.
Each
compilation
is a succession of
compilation_units.
A
compilation_unit
contains either the declaration, the body, or a renaming of a program
unit.] The representation for a
compilation
is implementation-defined.
Implementation defined: The representation
for a
compilation.
Ramification: 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
source file.
Note that a protected subprogram is a subprogram,
and therefore a program unit. An instance of a generic unit is a program
unit.
A protected entry is a program unit, but protected
entries cannot be separately compiled.
{Library unit}
[Glossary Entry]
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.
{subsystem}
A root library unit, together with its children and
grandchildren and so on, form a
subsystem.
Implementation Permissions
Discussion: 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.