Lady Ada

Ada '83 Language Reference Manual

Copyright 1980, 1982, 1983 owned by the United States Government. Direct reproduction and usage requests to the Ada Information Clearinghouse.


3.1. Declarations

[UP][NEXT]

The language defines several kinds of entities that are declared, either explicitly or implicitly, by declarations. Such an entity can be a numeric literal, an object, a discriminant, a record component, a loop parameter, an exception, a type, a subtype, a subprogram, a package, a task unit, a generic unit, a single entry, an entry family, a formal parameter (of a subprogram, entry, or generic subprogram), a generic formal parameter, a named block or loop, a labeled statement, or an operation (in particular, an attribute or an enumeration literal; see 3.3.3).

There are several forms of declaration. A basic declaration is a form of declaration defined as follows.

    basic_declaration ::=
         object_declaration     | number_declaration
       | type_declaration       | subtype_declaration
       | subprogram_declaration | package_declaration
       | task_declaration       | generic_declaration
       | exception_declaration  | generic_instantiation
       | renaming_declaration   | deferred_constant_declaration 

Certain forms of declaration always occur (explicitly) as part of a basic declaration; these forms are discriminant specifications, component declarations, entry declarations, parameter specifications, generic parameter declarations, and enumeration literal specifications. A loop parameter specification is a form of declaration that occurs only in certain forms of loop statement.

The remaining forms of declaration are implicit: the name of a block, the name of a loop, and a statement label are implicitly declared. Certain operations are implicitly declared (see 3.3.3).

For each form of declaration the language rules define a certain region of text called the scope of the declaration (see 8.2). Several forms of declaration associate an identifier with a declared entity. Within its scope, and only there, there are places where it is possible to use the identifier to refer to the associated declared entity; these places are defined by the visibility rules (see 8.3). At such places the identifier is said to be a name of the entity (its simple name); the name is said to denote the associated entity.

Certain forms of enumeration literal specification associate a character literal with the corresponding declared entity. Certain forms of declaration associate an operator symbol or some other notation with an explicitly or implicitly declared operation.

The process by which a declaration achieves its effect is called the elaboration of the declaration; this process happens during program execution.

After its elaboration, a declaration is said to be elaborated. Prior to the completion of its elaboration (including before the elaboration), the declaration is not yet elaborated. The elaboration of any declaration has always at least the effect of achieving this change of state (from not yet elaborated to elaborated). The phrase "the elaboration has no other effect" is used in this manual whenever this change of state is the only effect of elaboration for some form of declaration. An elaboration process is also defined for declarative parts, declarative items, and compilation units (see 3.9 and 10.5).

Object, number, type, and subtype declarations are described here. The remaining basic declarations are described in later chapters.

Note:

The syntax rules use the term identifier for the first occurrence of an identifier in some form of declaration; the term simple name is used for any occurrence of an identifier that already denotes some declared entity.

References: attribute, block name, block statement, character literal, component declaration, declarative item, declarative part, deferred constant declaration, discriminant specification, elaboration, entry declaration, enumeration literal specification, exception declaration, generic declaration, generic instantiation, generic parameter declaration, identifier, label, loop name, loop parameter specification, loop statement, name, number declaration, numeric literal, object declaration, operation, operator symbol, package declaration, parameter specification, record component, renaming declaration, representation clause, scope, simple name, subprogram body, subprogram declaration, subtype declaration, task declaration, type declaration, visibility.

Rationale references: 2.2 Textual Structure, 3.1 Simple Declarations: Variables and Constants, 3.2 Declarative Parts - Linear Reading, 3.3 Multiple Declarations

Style Guide references: 3.2.1 Names

[INDEX][CONTENTS]


[Ada Information Clearinghouse]

Address any questions or comments to adainfo@sw-eng.falls-church.va.us.