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.
Syntax
explicit_dereference ::= name.
all
implicit_dereference ::= name
Name Resolution Rules
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 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
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe