Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

4.1 Names

1
Names can denote declared entities, whether declared explicitly or implicitly (see 3.1). 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

2
name ::= 
     direct_name | explicit_dereference
   | indexed_component | slice
   | selected_component | attribute_reference
   | type_conversion | function_call
   | character_literal
3
direct_name ::= identifier | operator_symbol
4
prefix ::= name | implicit_dereference
5
explicit_dereference ::= name.all
6
implicit_dereference ::= name
7/2
Certain forms of name (indexed_components, selected_components, slices, and attribute_references) 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

8
The name in a dereference (either an implicit_dereference or an explicit_dereference) is expected to be of any access type. 

Static Semantics

9
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
10
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

11/2
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.
12
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.
13
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

14
Examples of direct names: 
15
Pi       -- the direct name of a number           (see 3.3.2)
Limit    -- the direct name of a constant         (see 3.3.1)
Count    -- the direct name of a scalar variable  (see 3.3.1)
Board    -- the direct name of an array variable  (see 3.6.1)
Matrix   -- the direct name of a type             (see 3.6)
Random   -- the direct name of a function         (see 6.1)
Error    -- the direct name of an exception       (see 11.1)
16
Examples of dereferences:
17
Next_Car.all        --  explicit dereference denoting the object designated by
                    --  the access variable Next_Car (see 3.10.1)
Next_Car.Owner      --  selected component with implicit dereference;
                    --  same as Next_Car.all.Owner

Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe