Contents   Index   Search   Previous   Next

10.1.2 Context Clauses - With Clauses

   A context_clause is used to specify the library_items whose names are needed within a compilation unit.


context_clause ::= {context_item}
context_item ::= with_clause | use_clause
with_clause ::= with library_unit_name {, library_unit_name};

Name Resolution Rules

   The scope of a with_clause that appears on a library_unit_declaration or library_unit_renaming_declaration consists of the entire declarative region of the declaration, which includes all children and subunits. The scope of a with_clause that appears on a body consists of the body, which includes all subunits.
   A library_item is mentioned in a with_clause if it is denoted by a library_unit_name or a prefix in the with_clause.
   Outside its own declarative region, the declaration or renaming of a library unit can be visible only within the scope of a with_clause that mentions it. The visibility of the declaration or renaming of a library unit otherwise follows from its placement in the environment.

Legality Rules

   If a with_clause of a given compilation_unit mentions a private child of some library unit, then the given compilation_unit shall be either the declaration of a private descendant of that library unit or the body or subunit of a (public or private) descendant of that library unit.
3  A library_item mentioned in a with_clause of a compilation unit is visible within the compilation unit and hence acts just like an ordinary declaration. Thus, within a compilation unit that mentions its declaration, the name of a library package can be given in use_clauses and can be used to form expanded names, a library subprogram can be called, and instances of a generic library unit can be declared. If a child of a parent generic package is mentioned in a with_clause, then the corresponding declaration nested within each visible instance is visible within the compilation unit.

Contents   Index   Search   Previous   Next   Legal