CVS difference for ais/ai-50217.txt

Differences between 1.11 and version 1.12
Log of other versions for file ais/ai-50217.txt

--- ais/ai-50217.txt	2003/11/27 02:01:16	1.11
+++ ais/ai-50217.txt	2004/01/23 04:59:29	1.12
@@ -1,8 +1,21 @@
-!standard 10.01.02   (04)                           03-11-05  AI95-00217-06/06
+!standard 10.01.01   (12)                           04-01-09  AI95-00217-06/07
+!standard 10.01.01   (26)
+!standard 10.01.02   (04)
 !standard 10.01.02   (06)
-!standard 10.01.04   (02)
+!standard 10.01.02   (08)
 !standard 10.01.04   (03)
+!standard 10.01.04   (06)
+!standard 10.02      (06)
+!standard  3.10.01   (10)
+!standard  4.01      (09)
+!standard  8.03      (20)
+!standard  8.04      (05)
+!standard  8.04      (07)
+!standard  8.04      (08)
+!standard  8.05.03   (03)
 !class amendment 03-02-04
+!status Amendment 200Y 04-01-09
+!status ARG Approved 11-0-1  03-12-11
 !status work item 03-02-04
 !status received 03-02-04
 !priority High
@@ -70,8 +83,8 @@
 
 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 that view
-is the designated subtype T, unless T is an incomplete type, in which case the
-nominal subtype is the completion of T.
+view is the designated subtype D of T, unless D is an incomplete type, in which case
+the nominal subtype is the completion of D.
 
 <Author's note: same comment as for 3.10.1(10), above.>
 
@@ -115,7 +128,7 @@
 
 Add after 10.1.1(12):
 
-For each library_package_declaration in the environment, there is
+For each library package_declaration in the environment, there is
 an implicit declaration of a *limited view* of that library package. The
 limited view of a package contains:
 
@@ -127,16 +140,21 @@
    If the type_declaration is tagged, then the incomplete_type_declaration is
    tagged incomplete.
 
-The limited view of a library_package_declaration is private if that
-library_package_declaration is immediately preceded by the reserved word
+<Author's note: this wording is provisional; final wording will be provided by
+AI 326, which is expected to define incomplete types in terms of views. This
+wording would have problems with types that have multiple views (such as
+private types), as incomplete_type_declarations would exist for both views.>
+
+The limited view of a library package_declaration is private if that
+library package_declaration is immediately preceded by the reserved word
 *private*.
 
 [There is no syntax for declaring limited views of packages, because they are
 always implicit.] The implicit declaration of a limited view of a package is
-_not_ the declaration of a library unit (the library_package_declaration is);
+_not_ the declaration of a library unit (the library package_declaration is);
 nonetheless, it is a library_item.
 
-A library_package_declaration is the completion of its limited view
+A library package_declaration is the completion of its limited view
 declaration.
 
 The elaboration of the limited view of a package has no effect.
@@ -159,7 +177,7 @@
 
 A library_item is *named* in a with_clause if it is denoted by a
 library_unit_name in the with_clause. A library_item is *mentioned* in a
-limited_with_clause if it is named in the with_clause or if it is denoted by a
+with_clause if it is named in the with_clause or if it is denoted by a
 prefix in the with_clause.
 
 
@@ -191,18 +209,13 @@
 The mechanisms for adding a unit mentioned in a limited_with_clause within an
 environment are implementation defined.
 
-
-Add at the end of 10.1.4(6):
-
-Before a compilation unit can be mentioned in a limited_with_clause, the
-implementation may require that it comply with:
 
-o  the syntax rules of the language; and
+Change 10.1.4(6):
 
-o  the legality rule which forbids two non-overloadable homographs declared
-   immediately within the same declarative region.
+The implementation may require that a compilation unit be legal before {it can
+be mentioned in a limited_with_clause or it can be inserted} [inserting it]
+into the environment.
 
-
 Add after 10.2(6):
 
 o  If the limited view of a unit is needed, then the full view of the unit is
@@ -449,10 +462,284 @@
 
 !example
 
+Here is the classic case of mutual dependence, where an employee belongs to a
+particular department, and a department has a manager who is an employee. The
+use of anonymous access types where possible eases the burden of type
+conversions on subprogram calls.
+
+    limited with Departments;
+    package Employees is
+        type Employee is tagged private;
+        procedure Assign_Employee(E : in out Employee;
+                                  D : access Departments.Department'Class);
+        type Dept_Ptr is access all Departments.Department'Class;
+        function Current_Department(D : in Employee) return Dept_Ptr;
+        ...
+    end Employees;
+
+    limited with Employees;
+    package Departments is
+        type Department is tagged private;
+        procedure Choose_Manager(D : in out Department;
+                                 Manager : access Employees.Employee'Class);
+        ...
+    end Departments;
+
 !ACATS test
 
 ACATS tests need to be created for this feature.
 
+--Note: The following change is undone by AI-326. I don't have a way to
+--eliminate changes (they can only be overridden) in the creation program, so
+--I've just commented this one out. Put it back in the unlikely event that
+--AI-326 is killed. (It's first because the program doesn't recognize comments,
+--either.]
+--
+--!corrigendum 4.1(9)
+--
+--@drepl
+--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 @i<nominal subtype> of the
+--view being the designated subtype of T.
+--@dby
+--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 @i<nominal subtype> of that
+--view is the designated subtype D of T, unless D is an incomplete type, in which case
+--the nominal subtype is the completion of D.
+
+!corrigendum 3.10.1(10)
+
+@drepl
+A dereference (whether implicit or explicit -- see 4.1) shall not be
+of an incomplete type.
+@dby
+A dereference (whether implicit or explicit -- see 4.1) is only allowed to be
+of an incomplete type T if it does not occur in the immediate scope of [the
+incomplete type] T and:
+
+@xbullet<it occurs in the scope of a @fa<nonlimited_with_clause> that mentions
+the library package in which that completion is declared; or>
+
+@xbullet<its expected type is the completion of T.>
+
+!corrigendum 8.3(20)
+
+@drepl
+@xbullet<The declaration of a library unit (including a
+@fa<library_unit_renaming_declaration>) is hidden from all visibility except at
+places that are within its declarative region or within the scope of a
+@fa<with_clause> that mentions it. For each declaration or renaming of a generic
+unit as a child of some parent generic package, there is a corresponding
+declaration nested immediately within each instance of the parent. Such a
+nested declaration is hidden from all visibility except at places that are
+within the scope of a @fa<with_clause> that mentions the child.>
+@dby
+@xbullet<The declaration of a library unit (including a
+@fa<library_unit_renaming_declaration>) is hidden from all visibility except at
+places that are within its declarative region or within the scope of a
+@fa<nonlimited_with_clause> that mentions it. The limited view of a library
+package is hidden from all visibility except at places that are within the
+scope of a @fa<limited_with_clause> that mentions it but not within the scope
+of a @fa<nonlimited_with_clause> that mentions it. For each declaration or
+renaming of a generic unit as a child of some parent generic package, there is
+a corresponding declaration nested immediately within each instance of the
+parent. Such a nested declaration is hidden from all visibility except at
+places that are within the scope of a @fa<with_clause> that mentions the
+child.>
+
+!corrigendum 8.4(5)
+
+@drepl
+A @i<package_>@fa<name> of a @fa<use_package_clause> shall denote a package.
+@dby
+A @i<package_>@fa<name> of a @fa<use_package_clause> shall denote a non-limited view of a
+package.
+
+!corrigendum 8.4(7)
+
+@dinsa
+For a @fa<use_clause> immediately within a declarative region, the scope is the
+portion of the declarative region starting just after the @fa<use_clause> and
+extending to the end of the declarative region. However, the scope of a
+@fa<use_clause> in the private part of a library unit does not include the
+visible part of any public descendant of that library unit.
+@dinst
+A package is @i<named> in a @fa<use_package_clause> if it is denoted by a
+@i<package_>@fa<name> of that clause. A type is @i<named> in a
+@fa<use_type_clause> if it is determined by a @fa<subtype_mark> of that clause.
+
+!corrigendum 8.4(8)
+
+@drepl
+For each package denoted by a @i<package_>@fa<name> of a
+@fa<use_package_clause> whose scope encloses a place, each declaration that
+occurs immediately within the declarative region of the package is
+@i<potentially use-visible> at this place if the declaration is visible at this
+place. For each type @i<T> or @i<T>'Class determined by a @fa<subtype_mark> of
+a @fa<use_type_clause> whose scope encloses a place, the declaration of each
+primitive operator of type @i<T> is @i<potentially use-visible> at this place
+if its declaration is visible at this place.
+@dby
+For each package named in a @fa<use_package_clause> whose scope encloses a
+place, each declaration that occurs immediately within the declarative region
+of the package is @i<potentially use-visible> at this place if the declaration
+is visible at this place. For each type @i<T> or @i<T>'Class named in a
+@fa<use_type_clause> whose scope encloses a place, the declaration of each
+primitive operator of type @i<T> is @i<potentially use-visible> at this place
+if its declaration is visible at this place.
+
+!corrigendum 8.5.3(3)
+
+@drepl
+The renamed entity shall be a package.
+@dby
+The renamed entity shall be a non-limited view of a package.
+
+
+!corrigendum 10.1.1(12)
+
+@dinsa
+A @fa<library_unit_declaration> or a @fa<library_unit_renaming_declaration> is
+@i<private> if the declaration is immediately preceded by the reserved word
+@b<private>; it is otherwise @i<public>. A library unit is private or public
+according to its declaration. The @i<public descendants> of a library unit are
+the library unit itself, and the public descendants of its public children. Its
+other descendants are @i<private descendants>.
+
+@dinss
+For each library @fa<package_declaration> in the environment, there is
+an implicit declaration of a @i<limited view> of that library package. The
+limited view of a package contains:
+
+@xbullet<For each nested @fa<package_declaration>, a declaration of the
+limited view of that package, with the same @fa<defining_program_unit_name>.>
+
+@xbullet<For each @fa<type_declaration> in the visible part, an
+@fa<incomplete_type_declaration> with the same @fa<defining_identifier>,
+whose completion is the @fa<type_declaration>. If the @fa<type_declaration> is
+tagged, then the @fa<incomplete_type_declaration> is tagged incomplete.>
+
+The limited view of a library @fa<package_declaration> is private if that
+library @fa<package_declaration> is immediately preceded by the reserved word
+@b<private>.
+
+There is no syntax for declaring limited views of packages, because they are
+always implicit. The implicit declaration of a limited view of a package is
+@i<not> the declaration of a library unit (the library package_declaration is);
+nonetheless, it is a @fa<library_item>.
+
+A library @fa<package_declaration> is the completion of its limited view
+declaration.
+
+The elaboration of the limited view of a package has no effect.
+
+!corrigendum 10.1.1(26)
+
+@drepl
+A @fa<library_item> depends semantically upon its parent declaration. A subunit
+depends semantically upon its parent body. A @fa<library_unit_body> depends
+semantically upon the corresponding @fa<library_unit_declaration>, if any. A
+compilation unit depends semantically upon each @fa<library_item> mentioned in
+a @fa<with_clause> of the compilation unit. In addition, if a given compilation unit
+contains an @fa<attribute_reference> of a type defined in another compilation unit,
+then the given compilation unit depends semantically upon the other compilation
+unit. The semantic dependence relationship is transitive.
+@dby
+A @fa<library_item> depends semantically upon its parent declaration. A subunit
+depends semantically upon its parent body. A @fa<library_unit_body> depends
+semantically upon the corresponding @fa<library_unit_declaration>, if any.
+The implicit declaration of the limited view of a library package depends
+semantically upon the implicit declaration of the limited view of its parent.
+The declaration of a library package depends semantically upon the implicit
+declaration of its limited view. A
+compilation unit depends semantically upon each @fa<library_item> mentioned in
+a @fa<with_clause> of the compilation unit. In addition, if a given compilation unit
+contains an @fa<attribute_reference> of a type defined in another compilation unit,
+then the given compilation unit depends semantically upon the other compilation
+unit. The semantic dependence relationship is transitive.
+
+!corrigendum 10.1.2(4)
+
+@drepl
+@xcode<@fa<with_clause ::= >@ft<@b<with> @i<library_unit_>>@fa<name {, >@ft<@i<library_unit_>>@fa<name};>>
+@dby
+@xcode<@fa<with_clause ::= limited_with_clause | nonlimited_with_clause
+limited_with_clause ::= >@ft<@b<limited with> @i<library_unit_>>@fa<name {, >@ft<@i<library_unit_>>@fa<name};
+nonlimited_with_clause ::= >@ft<@b<with> @i<library_unit_>>@fa<name {, >@ft<@i<library_unit_>>@fa<name};>>
+
+!corrigendum 10.1.2(6)
+
+@drepl
+A @fa<library_item> is @i<mentioned> in a @fa<with_clause> if it is denoted by
+a @i<library_unit_>@fa<name> or a @fa<prefix> in the @fa<with_clause>.
+@dby
+A @fa<library_item> is @i<named> in a @fa<with_clause> if it is denoted by a
+@i<library_unit_>@fa<name> in the @fa<with_clause>. A @fa<library_item> is
+@i<mentioned> in a @fa<with_clause> if it is named in the
+@fa<with_clause> or if it is denoted by a @fa<prefix> in the @fa<with_clause>.
+
+!corrigendum 10.1.2(8)
+
+@dinsa
+If a @fa<with_clause> of a given @fa<compilation_unit> mentions a private
+child of some library unit, then the given @fa<compilation_unit> shall be either
+the declaration of a private descendant of that library unit or the body
+or a subunit of a (public or private) descendant of that library unit.
+@dinss
+A @fa<library_item> mentioned in a @fa<limited_with_clause> shall be a
+@fa<package_declaration>[, not a @fa<subprogram_declaration>,
+@fa<generic_declaration>, @fa<generic_instantiation>, or
+@fa<package_renaming_declaration>].
+
+A @fa<limited_with_clause> shall not appear on a @fa<library_unit_body> or
+@fa<subunit>.
+
+A @fa<limited_with_clause> which names a @fa<library_item> shall not appear:
+
+@xbullet<in the same @fa<context_clause> as a @fa<nonlimited_with_clause> which
+mentions the same @fa<library_item>; or>
+
+@xbullet<in the same @fa<context_clause> as a @fa<use_clause> which names an
+entity declared within the declarative region of the @fa<library_item>; or>
+
+@xbullet<in the scope of a @fa<nonlimited_with_clause> which mentions the same
+@fa<library_item>; or>
+
+@xbullet<in the scope of a @fa<use_clause> which names an entity declared
+within the declarative region of the @fa<library_item>.>
+
+!corrigendum 10.1.4(3)
+
+@drepl
+The mechanisms for creating an environment and for adding and replacing
+compilation units within an environment are implementation defined.
+@dby
+The mechanisms for creating an environment and for adding and replacing
+compilation units within an environment are implementation defined. The
+mechanisms for adding a unit mentioned in a @fa<limited_with_clause> within an
+environment are implementation defined.
+
+!corrigendum 10.1.4(6)
+
+@drepl
+The implementation may require that a compilation unit be legal before
+inserting it into the environment.
+@dby
+The implementation may require that a compilation unit be legal before it can
+be mentioned in a @fa<limited_with_clause> or it can be inserted
+into the environment.
+
+!corrigendum 10.2(6)
+
+@drepl
+@xbullet<If a compilation unit with stubs is needed, then so are any
+corresponding subunits.>
+@dby
+@xbullet<If a compilation unit with stubs is needed, then so are any
+corresponding subunits;>
+@xbullet<If the limited view of a unit is needed, then the full view of the
+unit is needed.>
+
 !appendix
 
 From: Pascal Leroy
@@ -3596,7 +3883,7 @@
 -----------------
 Thoughts on the implementation of "limited with" in AdaMagic
 
-          $Revision: 1.11 $ $Date: 2003/11/27 02:01:16 $
+          $Revision: 1.12 $ $Date: 2004/01/23 04:59:29 $
 
 The "limited with" clause makes a "limited view"
 of a package visible in the compilation unit
@@ -5405,7 +5692,7 @@
 -----------------
 Thoughts on the implementation of "limited with" in AdaMagic
 
-          $Revision: 1.11 $ $Date: 2003/11/27 02:01:16 $
+          $Revision: 1.12 $ $Date: 2004/01/23 04:59:29 $
 
 The "limited with" clause makes a "limited view"
 of a package visible in the compilation unit

Questions? Ask the ACAA Technical Agent