Contents   Index   Search   Related Documents   Previous   Next


8.5.1 Object Renaming Declarations

1
   An object_renaming_declaration is used to rename an object.

Syntax

2/2
object_renaming_declaration ::=
    defining_identifier : [null_exclusionsubtype_mark renames object_name;
  | defining_identifier : access_definition renames object_name;

Name Resolution Rules

3/2
     The type of the object_name shall resolve to the type determined by the subtype_mark, or in the case where the type is defined by an access_definition, to an anonymous access type. If the anonymous access type is an access-to-object type, the type of the object_name shall have the same designated type as that of the access_definition. If the anonymous access type is an access-to-subprogram type, the type of the object_name shall have a designated profile that is type conformant with that of the access_definition.

Legality Rules

4/2
     The renamed entity shall be an object. In the case where the type is defined by an access_definition, the type of the renamed object and the type defined by the access_definition:
4.1/2
4.2/2
4.3/2
       For an object_renaming_declaration with a null_exclusion or an access_definition that has a null_exclusion:
4.4/2
4.5/2
5/2
     The renamed entity shall not be a subcomponent that depends on discriminants of a variable whose nominal subtype is unconstrained, unless this subtype is indefinite, or the variable is constrained by its initial value. A slice of an array shall not be renamed if this restriction disallows renaming of the array. In addition to the places where Legality Rules normally apply, these rules apply also in the private part of an instance of a generic unit. These rules also apply for a renaming that appears in the body of a generic unit, with the additional requirement that even if the nominal subtype of the variable is indefinite, its type shall not be a descendant of an untagged generic formal derived type.

Static Semantics

6/2
     An object_renaming_declaration declares a new view of the renamed object whose properties are identical to those of the renamed view. Thus, the properties of the renamed object are not affected by the renaming_declaration. In particular, its value and whether or not it is a constant are unaffected; similarly, the null exclusion or constraints that apply to an object are not affected by renaming (any constraint implied by the subtype_mark or access_definition of the object_renaming_declaration is ignored).

Examples

7
   Example of renaming an object:
8
declare
   L : Person renames Leftmost_Person; -- see 3.10.1
begin
   L.Age := L.Age + 1;
end;

Contents   Index   Search   Related Documents   Previous   Next   Legal