[Home] [Prev] [Next] [Index]

3.9 Declarative Parts

3.9 Declarative Parts

1
A declarative part contains declarative items (possibly none).

2
declarative_part ::=
    {basic_declarative_item} {later_declarative_item}

basic_declarative_item ::= basic_declaration
     | representation_clause | use_clause

later_declarative_item ::= body
     | subprogram_declaration | package_declaration
     | task_declaration | generic_declaration
     | use_clause | generic_instantiation

body ::= proper_body | body_stub

proper_body ::=
    subprogram_body | package_body | task_body

3
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. After its elaboration, a declarative item is said to be elaborated. Prior to the completion of its elaboration (including before the elaboration), the declarative item is not yet elaborated.

4
For several forms of declarative item, the language rules (in particular scope and visibility rules) are such that it is either impossible or illegal to use an entity before the elaboration of the declarative item that declares this entity. For example, it is not possible to use the name of a type for an object declaration if the corresponding type declaration is not yet elaborated. In the case of bodies, the following checks are performed:

5 ·
For a subprogram call, a check is made that the body of the subprogram is already elaborated.

6 ·
For the activation of a task, a check is made that the body of the corresponding task unit is already elaborated.

7 ·
For the instantiation of a generic unit that has a body, a check is made that this body is already elaborated.

8
The exception PROGRAM_ERROR is raised if any of these checks fails.

9
If a subprogram declaration, a package declaration, a task declaration, or a generic declaration is a declarative item of a given declarative part, then the body (if there is one) of the program unit declared by the declarative item must itself be a declarative item of this declarative part (and must appear later). If the body is a body stub, then a separately compiled subunit containing the corresponding proper body is required for the program unit (see 10.2).

10
References:

*
activation 9.3

*
instantiation 12.3

*
program_error exception 11.1

*
scope 8.2

*
subprogram call 6.4

*
type 3.3

*
visibility 8.3

11
Elaboration of declarations:

*
in general 3.1

*
component declaration 3.7

*
deferred constant declaration 7.4.3

*
discriminant specification 3.7.1

*
entry declaration 9.5

*
enumeration literal specification 3.5.1

*
generic declaration 12.1

*
generic instantiation 12.3

*
incomplete type declaration 3.8.1

*
loop parameter specification 5.5

*
number declaration 3.2.2

*
object declaration 3.2.1

*
package declaration 7.2

*
parameter specification 6.1

*
private type declaration 7.4.1

*
renaming declaration 8.5

*
subprogram declaration 6.1

*
subtype declaration 3.3.2

*
task declaration 9.1

*
type declaration 3.3.1

12
Elaboration of type definitions:

*
in general 3.3.1

*
access type definition 3.8

*
array type definition 3.6

*
derived type definition 3.4

*
enumeration type definition 3.5.1

*
integer type definition 3.5.4

*
real type definition 3.5.6

*
record type definition 3.7

13
Elaboration of other constructs:

*
context clause 10.1

*
body stub 10.2

*
compilation unit 10.1

*
discriminant part 3.7.1

*
generic body 12.2

*
generic formal parameter 12.1

*
generic formal parameter 12.3

*
library unit 10.5

*
package body 7.1

*
representation clause 13.1

*
subprogram body 6.3

*
subunit 10.2

*
task body 9.1

*
task object 9.2

*
task specification 9.1

*
use clause 8.4

*
with clause 10.1.1



[Home] [Prev] [Next] [Index]

documentation@rational.com
Copyright © 1993-2000, Rational Software Corporation. All rights reserved.