4.1 Names

From OC Systems Wiki!
< Guide:95lrm
Revision as of 23:37, 4 May 2019 by imported>WikiVisor (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

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

Copyright © 1992,1993,1994,1995 Intermetrics, Inc.
Copyright © 2000 The MITRE Corporation, Inc. Ada Reference Manual