Section 2.5 - Review of Basic Ada Structures
Let's briefly review what we've learned so far:
-
Logically, Ada programs are composed of a set of program units.
-
There are different kinds of program units; the ones we've concentrated
on are subprograms and packages.
-
Subprograms define processing algorithms.
Subprograms can be procedures or functions.
-
Packages are the main Ada structuring tool used to group
things together.
-
In general, a program unit has two parts, a declaration
and a body.
Sometimes a declaration is also called a specification.
-
Ada compilers compile compilation units.
A compilation unit is either a program unit's declaration or body,
preceded by a context clause.
-
A context clause is a set of with clauses
(that state what other program units are needed) and/or
use clauses (the program units to search by default).
Quiz:
Given what you know now, is it possible for an Ada compiler to
compile a package declaration (when preceded by the appropriate
context clauses), even if implementation details are needed and
the package body has not been developed yet?
- Yes
- No
You may also:
David A. Wheeler (dwheeler@ida.org)