-
Names can denote declared entities, whether declared explicitly or
implicitly, See section 3.1 Declarations. Names can also denote objects or subprograms
designated by access values; the results of type_conversions or
function_calls; subcomponents and slices of objects and values;
protected subprograms, single entries, entry families, and entries in
families of entries. Finally, names can denote attributes of any of the
foregoing.
Syntax
-
name ::=
direct_name | explicit_dereference
| indexed_component | slice
| selected_component | attribute_reference
| type_conversion | function_call
| character_literal
-
direct_name ::= identifier | operator_symbol
-
prefix ::= name | implicit_dereference
-
explicit_dereference ::= name.all
-
implicit_dereference ::= name
-
Certain forms of name (indexed_components, selected_components, slices,
and attributes) include a prefix that is either itself a name that
denotes some related entity, or an implicit_dereference of an access
value that designates some related entity.
Name Resolution Rules
-
The name in a dereference (either an implicit_dereference or an
explicit_dereference) is expected to be of any access type.
Static Semantics
-
If the type of the name in a dereference is some access-to-object type
T, then the dereference denotes a view of an object, the nominal subtype
of the view being the designated subtype of T.
-
If the type of the name in a dereference is some access-to-subprogram
type S, then the dereference denotes a view of a subprogram, the profile
of the view being the designated profile of S.
Dynamic Semantics
-
The evaluation of a name determines the entity denoted by the name. This
evaluation has no other effect for a name that is a direct_name or a
character_literal.
-
The evaluation of a name that has a prefix includes the evaluation of
the prefix. The evaluation of a prefix consists of the evaluation of the
name or the implicit_dereference. The prefix denotes the entity denoted
by the name or the implicit_dereference.
-
The evaluation of a dereference consists of the evaluation of the name
and the determination of the object or subprogram that is designated by
the value of the name. A check is made that the value of the name is not
the null access value. Constraint_Error is raised if this check fails.
The dereference denotes the object or subprogram designated by the value
of the name.
Examples
-
Examples of direct names:
-
Pi -- the direct name of a number See section 3.3.2 Number Declarations
Limit -- the direct name of a constant See section 3.3.1 Object Declarations
Count -- the direct name of a scalar variable See section 3.3.1 Object Declarations
Board -- the direct name of an array variable See section 3.6.1 Index Constraints and Discrete Ranges
Matrix -- the direct name of a type See section 3.6 Array Types
Random -- the direct name of a function See section 6.1 Subprogram Declarations
Error -- the direct name of an exception See section 11.1 Exception Declarations
-
Examples of dereferences:
-
Next_Car.all -- explicit dereference denoting the object
-- designated by the access variable Next_Car,
-- See section 3.10.1 Incomplete Type Declarations
Next_Car.Owner -- selected component with implicit dereference;
-- same as Next_Car.all.Owner