Go to the first, previous, next, last section, table of contents.
-
Objects are created at run time and contain a value of a given type. An
object can be created and initialized as part of elaborating a
declaration, evaluating an allocator, aggregate, or function_call, or
passing a parameter by copy. Prior to reclaiming the storage for an
object, it is finalized if necessary, See section 7.6.1 Completion and Finalization.
Static Semantics
-
All of the following are objects:
-
the entity declared by an object_declaration;
-
a formal parameter of a subprogram, entry, or generic subprogram;
-
a generic formal object;
-
a loop parameter;
-
a choice parameter of an exception_handler;
-
an entry index of an entry_body;
-
the result of dereferencing an access-to-object value, See section 4.1 Names,
-
the result of evaluating a function_call (or the equivalent operator
invocation -- See section 6.6 Overloading of Operators,
-
the result of evaluating an aggregate;
-
a component, slice, or view conversion of another object.
-
An object is either a constant object or a variable object. The value of
a constant object cannot be changed between its initialization and its
finalization, whereas the value of a variable object can be changed.
Similarly, a view of an object is either a constant or a variable. All
views of a constant object are constant. A constant view of a variable
object cannot be used to modify the value of the variable. The terms
constant and variable by themselves refer to constant and variable views
of objects.
-
The value of an object is read when the value of any part of the object
is evaluated, or when the value of an enclosing object is evaluated. The
value of a variable is updated when an assignment is performed to any
part of the variable, or when an assignment is performed to an enclosing
object.
-
Whether a view of an object is constant or variable is determined by the
definition of the view. The following (and no others) represent
constants:
-
an object declared by an object_declaration with the reserved word
constant;
-
a formal parameter or generic formal object of mode in;
-
a discriminant;
-
a loop parameter, choice parameter, or entry index;
-
the dereference of an access-to-constant value;
-
he result of evaluating a function_call or an aggregate;
-
a selected_component, indexed_component, slice, or view conversion of a
constant.
-
At the place where a view of an object is defined, a nominal subtype is
associated with the view. The object's actual subtype (that is, its
subtype) can be more restrictive than the nominal subtype of the view;
it always is if the nominal subtype is an indefinite subtype. A subtype
is an indefinite subtype if it is an unconstrained array subtype, or if
it has unknown discriminants or unconstrained discriminants without
defaults See section 3.7 Discriminants, otherwise the subtype is a definite subtype (all
elementary subtypes are definite subtypes). A class-wide subtype is
defined to have unknown discriminants, and is therefore an indefinite
subtype. An indefinite subtype does not by itself provide enough
information to create an object; an additional constraint or explicit
initialization expression is necessary See section 3.3.1 Object Declarations. A component cannot
have an indefinite nominal subtype.
-
A named number provides a name for a numeric value known at compile
time. It is declared by a number_declaration.
NOTES
-
(5) A constant cannot be the target of an assignment operation, nor be
passed as an in out or out parameter, between its initialization and
finalization, if any.
-
(6) The nominal and actual subtypes of an elementary object are always
the same. For a discriminated or array object, if the nominal subtype is
constrained then so is the actual subtype.
- 3.3.1: Object Declarations
- 3.3.2: Number Declarations
Go to the first, previous, next, last section, table of contents.