6 Subprograms
A
subprogram is a program unit or intrinsic operation whose execution is
invoked by a subprogram call. There are two forms of subprogram: procedures
and functions. A procedure call is a
statement;
a function call is an expression and returns a value. The definition
of a subprogram can be given in two parts: a subprogram declaration defining
its interface, and a
subprogram_body
defining its execution. [Operators and enumeration literals are functions.]
To be honest: A function call is an expression,
but more specifically it is a
name.
Glossary entry: A subprogram is a section
of a program that can be executed in various contexts. It is invoked
by a subprogram call that may qualify the effect of the subprogram through
the passing of parameters. There are two forms of subprograms: functions,
which return values, and procedures, which do not.
Glossary entry: A function is a form
of subprogram that returns a result and can be called as part of an expression.
Glossary entry: A procedure is a form
of subprogram that does not return a result and can only be called by
a
statement.
{
AI05-0299-1}
A
callable entity is a subprogram or entry
(see Section 9).
A callable entity is invoked by
a
call; that is, a subprogram call or entry call.
A
callable construct is a construct that defines the action of a
call upon a callable entity: a
subprogram_body,
entry_body,
or
accept_statement.
Ramification: Note that “callable
entity” includes predefined operators, enumeration literals, and
abstract subprograms. “Call” includes calls of these things.
They do not have callable constructs, since they don't have completions.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe