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

8.1 Declarative Region

8.1 Declarative Region

1
A declarative region is a portion of the program text. A single declarative region is formed by the text of each of the following:

2 ·
A subprogram declaration, a package declaration, a task declaration, or a generic declaration, together with the corresponding body, if any. If the body is a body stub, the declarative region also includes the corresponding subunit. If the program unit has subunits, they are also included.

3 ·
An entry declaration together with the corresponding accept statements.

4 ·
A record type declaration, together with a corresponding private or incomplete type declaration if any, and together with a corresponding record representation clause if any.

5 ·
A renaming declaration that includes a formal part, or a generic parameter declaration that includes either a formal part or a discriminant part.

6 ·
A block statement or a loop statement.

7
In each of the above cases, the declarative region is said to be associated with the corresponding declaration or statement. A declaration is said to occur immediately within a declarative region if this region is the innermost region that encloses the declaration, not counting the declarative region (if any) associated with the declaration itself.

8
A declaration that occurs immediately within a declarative region is said to be local to the region. Declarations in outer (enclosing) regions are said to be global to an inner (enclosed) declarative region. A local entity is one declared by a local declaration; a global entity is one declared by a global declaration.

9
Some of the above forms of declarative region include several disjoint parts (for example, other declarative items can be between the declaration of a package and its body). Each declarative region is nevertheless considered as a (logically) continuous portion of the program text. Hence if any rule defines a portion of text as the text that extends from some specific point of a declarative region to the end of this region, then this portion is the corresponding subset of the declarative region (for example it does not include intermediate declarative items between the two parts of a package).

Notes:

10
As defined in section 3.1, the term declaration includes basic declarations, implicit declarations, and those declarations that are part of basic declarations, for example, discriminant and parameter specifications. It follows from the definition of a declarative region that a discriminant specification occurs immediately within the region associated with the enclosing record type declaration. Similarly, a parameter specification occurs immediately within the region associated with the enclosing subprogram body or accept statement.

11
The package STANDARD forms a declarative region which encloses all library units: the implicit declaration of each library unit is assumed to occur immediately within this package (see sections 8.6 and 10.1.1).

12
Declarative regions can be nested within other declarative regions. For example, subprograms, packages, task units, generic units, and block statements can be nested within each other, and can contain record type declarations, loop statements, and accept statements.

13
References:

*
accept statement 9.5

*
basic declaration 3.1

*
block statement 5.6

*
body stub 10.2

*
declaration 3.1

*
discriminant part 3.7.1

*
discriminant specification 3.7.1

*
entry declaration 9.5

*
formal part 6.1

*
generic body 12.2

*
generic declaration 12.1

*
generic parameter declaration 12.1

*
implicit declaration 3.1

*
incomplete type declaration 3.8.1

*
library unit 10.1

*
loop statement 5.5

*
package 7

*
package body 7.1

*
package declaration 7.1

*
parameter specification 6.1

*
private type declaration 7.4

*
record representation clause 13.4

*
record type 3.7

*
renaming declaration 8.5

*
standard package 8.6

*
subprogram body 6.3

*
subprogram declaration 6.1

*
subunit 10.2

*
task body 9.1

*
task declaration 9.1

*
task unit 9



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

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