Go to the first, previous, next, last section, table of contents.

3.1 Declarations

  1. The language defines several kinds of named entities that are declared by declarations. The entity's name is defined by the declaration, usually by a defining_identifier, but sometimes by a defining_character_literal or defining_operator_symbol.
  2. There are several forms of declaration. A basic_declaration is a form of declaration defined as follows.


  3. basic_declaration ::=
         type_declaration         | subtype_declaration
       | object_declaration       | number_declaration
       | subprogram_declaration   | abstract_subprogram_declaration
       | package_declaration      | renaming_declaration
       | exception_declaration    | generic_declaration
       | generic_instantiation
  4. defining_identifier ::= identifier

    Static Semantics

  5. A declaration is a language construct that associates a name with (a view of) an entity. A declaration may appear explicitly in the program text (an explicit declaration), or may be supposed to occur at a given place in the text as a consequence of the semantics of another construct (an implicit declaration).
  6. Each of the following is defined to be a declaration: any basic_declaration; an enumeration_literal_specification; a discriminant_specification; a component_declaration; a loop_parameter_specification; a parameter_specification; a subprogram_body; an entry_declaration; an entry_index_specification; a choice_parameter_specification; a generic_formal_parameter_declaration.
  7. All declarations contain a definition for a view of an entity. A view consists of an identification of the entity (the entity of the view), plus view-specific characteristics that affect the use of the entity through that view (such as mode of access to an object, formal parameter names and defaults for a subprogram, or visibility to components of a type). In most cases, a declaration also contains the definition for the entity itself (a renaming_declaration is an example of a declaration that does not define a new entity, but instead defines a view of an existing entity See section 8.5 Renaming Declarations.)
  8. For each declaration, the language rules define a certain region of text called the scope of the declaration See section 8.2 Scope of Declarations. Most declarations 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 declaration, the view it defines, and the associated entity; these places are defined by the visibility rules See section 8.3 Visibility. At such places the identifier is said to be a name of the entity (the direct_name or selector_name); the name is said to denote the declaration, the view, and the associated entity See section 8.6 The Context of Overload Resolution. The declaration is said to declare the name, the view, and in most cases, the entity itself.
  9. As an alternative to an identifier, an enumeration literal can be declared with a character_literal as its name See section 3.5.1 Enumeration Types, and a function can be declared with an operator_symbol as its name See section 6.1 Subprogram Declarations.
  10. The syntax rules use the terms defining_identifier, defining_character_literal, and defining_operator_symbol for the defining occurrence of a name; these are collectively called defining names. The terms direct_name and selector_name are used for usage occurrences of identifiers, character_literals, and operator_symbols. These are collectively called usage names.

    Dynamic Semantics

  11. The process by which a construct achieves its run-time effect is called execution. This process is also called elaboration for declarations and evaluation for expressions. One of the terms execution, elaboration, or evaluation is defined by this International Standard for each construct that has a run-time effect.


  12. (1) At compile time, the declaration of an entity declares the entity. At run time, the elaboration of the declaration creates the entity.

Go to the first, previous, next, last section, table of contents.