Contents   Index   Search   Previous   Next


10.1 Separate Compilation

1
   [{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.
2
   {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.
2.a
Implementation defined: The representation for a compilation.
2.b
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.
2.c
Note that a protected subprogram is a subprogram, and therefore a program unit. An instance of a generic unit is a program unit.
2.d
A protected entry is a program unit, but protected entries cannot be separately compiled.
3
   {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

4
   An implementation may impose implementation-defined restrictions on compilations that contain multiple compilation_units.
4.a
Implementation defined: Any restrictions on compilations that contain multiple compilation_units.
4.b
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

4.c
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.
4.d
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.

Contents   Index   Search   Previous   Next   Legal