Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

4.1 Names

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. 


name ::= 
     direct_name | explicit_dereference
   | indexed_component | slice
   | selected_component | attribute_reference
   | type_conversion | function_call
   | character_literal | qualified_expression
   | generalized_reference | generalized_indexing
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 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

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 designated subtype has unconstrained discriminants, the (actual) subtype of the view is constrained by the values of the discriminants of the designated object, except when there is a partial view of the type of the designated subtype that does not have discriminants, in which case the dereference is not constrained by its discriminant values. 
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 of direct names: 
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)
Examples of dereferences:
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 Ada 2005 and 2012 Editions sponsored in part by Ada-Europe