Ada Conformity Assessment Authority      Home Conformity Assessment   Test Suite ARGAda Standard
 
Annotated Ada Reference Manual (Ada 2022 with Amendment 1)Legal Information
Contents   Index   References   Search   Previous   Next 

8.5.3 Package Renaming Declarations

1
[A package_renaming_declaration is used to rename a package.] 

Syntax

2/3
{AI05-0183-1} package_renaming_declaration ::= 
    package defining_program_unit_name renames package_name
       [aspect_specification];

Legality Rules

3
The renamed entity shall be a package.
3.1/2
 {AI95-00217-06} {AI95-00412-01} If the package_name of a package_renaming_declaration denotes a limited view of a package P, then a name that denotes the package_renaming_declaration shall occur only within the immediate scope of the renaming or the scope of a with_clause that mentions the package P or, if P is a nested package, the innermost library package enclosing P
3.a.1/2
Discussion: The use of a renaming that designates a limited view is restricted to locations where we know whether the view is limited or nonlimited (based on a with_clause). We don't want to make an implicit limited view, as those are not transitive like a regular view. Implementations should be able to see all limited views needed based on the context_clause.

Static Semantics

4
A package_renaming_declaration declares a new view [of the renamed package].
4.1/2
 {AI95-00412-01} [At places where the declaration of the limited view of the renamed package is visible, a name that denotes the package_renaming_declaration denotes a limited view of the package (see 10.1.1).]
4.a.1/2
Proof: This rule is found in 8.3, “Visibility”. 

Examples

5
Example of renaming a package: 
6
package TM renames Table_Manager;

Wording Changes from Ada 95

6.a/2
{AI95-00217-06} {AI95-00412-01} Uses of renamed limited views of packages can only be used within the scope of a with_clause for the renamed package. 

Extensions to Ada 2005

6.b/3
{AI05-0183-1} An optional aspect_specification can be used in a package_renaming_declaration. This is described in 13.1.1

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe