Ada Reference Manual (Ada 2022)Legal Information
Contents   Index   References   Search   Previous   Next 

3.11 Declarative Parts

1
A declarative_part contains declarative_items (possibly none). 

Syntax

2
declarative_part ::= {declarative_item}
3
declarative_item ::= 
    basic_declarative_item | body
4/1
basic_declarative_item ::= 
    basic_declaration | aspect_clause | use_clause
5
body ::= proper_body | body_stub
6
proper_body ::= 
    subprogram_body | package_body | task_body | protected_body

Static Semantics

6.1/2
 The list of declarative_items of a declarative_part is called the declaration list of the declarative_part.

Dynamic Semantics

7
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.
8
An elaborable construct is in the elaborated state after the normal completion of its elaboration. Prior to that, it is not yet elaborated
9
For a construct that attempts to use a body, a check (Elaboration_Check) is performed, as follows: 
10/1
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. 
11/3
For a call to a protected operation of a protected type (that has a body — no check is performed if the protected type is imported — see B.1), 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. 
12
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. 
13
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.
14
The exception Program_Error is raised if any of these checks fails. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe