3.11 Declarative Parts

From OC Systems Wiki!
Jump to: navigation, search

A declarative_part contains declarative_items (possibly none).

Syntax

declarative_part ::= {declarative_item}

declarative_item ::=
    basic_declarative_item | body

basic_declarative_item ::=
    basic_declaration | aspect_clause | use_clause

body ::= proper_body | body_stub

proper_body ::=
    subprogram_body | package_body | task_body | protected_body

Dynamic Semantics

The elaboration of a declarative_part consists of the elaboration of the declarative_items, if any, in the order in which they are given in the declarative_part.

An elaborable construct is in the elaborated state after the normal completion of its elaboration. Prior to that, it is not yet elaborated.

For a construct that attempts to use a body, a check (Elaboration_Check) is performed, as follows:

  • For a call to a (non-protected) subprogram that has an explicit body, a check is made that the body is already elaborated. This check and the evaluations of any actual parameters of the call are done in an arbitrary order.
  • For a call to a protected operation of a protected type (that has a body -- no check is performed if a pragma Import applies to the protected type), a check is made that the protected_body is already elaborated. This check and the evaluations of any actual parameters of the call are done in an arbitrary order.
  • For the activation of a task, a check is made by the activator that the task_body is already elaborated. If two or more tasks are being activated together (see 9.2), as the result of the elaboration of a declarative_part or the initialization for the object created by an allocator, this check is done for all of them before activating any of them.
  • For the instantiation of a generic unit that has a body, a check is made that this body is already elaborated. This check and the evaluation of any explicit_generic_actual_parameters of the instantiation are done in an arbitrary order.

The exception Program_Error is raised if any of these checks fails.

Copyright © 1992,1993,1994,1995 Intermetrics, Inc.
Copyright © 2000 The MITRE Corporation, Inc. Ada Reference Manual