CVS difference for ais/ai-00326.txt

Differences between 1.7 and version 1.8
Log of other versions for file ais/ai-00326.txt

--- ais/ai-00326.txt	2003/11/27 02:01:16	1.7
+++ ais/ai-00326.txt	2004/01/08 04:16:39	1.8
@@ -1,4 +1,4 @@
-!standard 03.10.01   (02)                            03-11-21  AI95-00326/04
+!standard 03.10.01   (02)                            03-12-11  AI95-00326/05
 !standard 03.10.01   (04)
 !standard 03.10.01   (05)
 !standard 03.10.01   (08)
@@ -68,8 +68,8 @@
   very restricted usage, providing support for recursive data structures. A
   private type or private extension represents a partial view (see 7.3) of a
   type, providing support for data abstraction. The full view (see 3.2.1) of a
-  type provides its complete declaration. An incomplete or partial view is a
-  composite type.
+  type provides its complete declaration. An incomplete or partial view is
+  considered a composite type.
 
 AARM: Only the first and last sentences really define anything; the real
   definitions of the views are in the referenced paragraphs.
@@ -92,40 +92,11 @@
   should reflect that. Since full views cannot have unknown_discriminant_parts,
   "view of a type" is enough here.
 
-Modify 3.9.2(2):
-
-  Add the the end of the second sentence:
-
-  controlling formal parameter{, and the type T is called the controlling type}.
-
-Add after 3.9.2(8):
-
-  The view of the controlling type of a dispatching call shall not be an
-  incomplete view.
-
-AARM Note: This prevents dispatching when the position of the tag may not be
-  known, and fixes a hole in Ada 95. (Then give the example from the
-  !discussion section below.)
-
 Replace 3.10.1(2):
 
    incomplete_type_declaration ::=
       TYPE defining_identifier [discriminant_part] [IS TAGGED];
 
-Modify 3.10.1(3):
-
-Replace the first sentence by:
-
-  An incomplete_type_declaration declares an incomplete view of the type; such
-  a declaration requires a completion, which shall be a type_declaration other
-  than an incomplete_type_declaration.
-
-In the other sentences, replace "full_type_declaration" with "type_declaration".
-
-AARM Changes: We define "incomplete view" here. Completions can now be private
-  types. That means that the completing view can be either a partial view or a
-  full view.
-
 Modify 3.10.1(4):
 
 Add two new first sentences:
@@ -138,19 +109,15 @@
 
 Replace 3.10.1(5-9):
 
-  The only allowed uses of a name that denotes an incomplete view are as
-  follows:
+  A name that denotes an incomplete view of a type may be used as follows:
 
     * as the subtype_mark in the subtype_indication of an
       access_to_object_definition; the only form of constraint allowed in
       this subtype_indication is a discriminant_constraint;
 
-    * as the subtype_mark defining the subtype of a parameter or result of
-      an access_to_subprogram_definition;
-
     * as the subtype_mark in an access_definition;
 
-  In addition, a tagged incomplete view may be used as follows:
+  If such a name denotes a tagged incomplete view, it may also be used:
 
     * as the subtype_mark defining the subtype of a parameter in a
       formal_part;
@@ -159,16 +126,53 @@
       Class; such an attribute_reference is restricted to the uses allowed
       above for tagged incomplete views.
 
+  If such a name occurs within the list of declarative_items containing
+  the completion of the incomplete view, it may also be used:
+
+    * as the subtype_mark defining the subtype of a parameter or result of
+      an access_to_subprogram_definition;
+
+  If any of the above uses occurs as part of the declaration of a primitive
+  subprogram of the incomplete view, and the declaration occurs immediately
+  within the private part of a package, then the completion of the incomplete
+  view shall also occur immediately within the private part; it may not be
+  deferred to the package body.
+
+AARM: This fixes a hole in Ada 95 where a dispatching operation with an access
+parameter could be declared in a private part and a dispatching call on it
+could occur in a child even though there is no visibility on the full type,
+requiring access to the controlling tag without access to the representation of
+the type.
+
+Replace 3.10.1(10):
+
+  The prefix of a name shall not be of an incomplete view.
+
+AARM: We used to disallow all dereferences of an incomplete type.
+Now we only disallow such dereferences when used as a prefix.  Dereferences
+used in other contexts do not pose a problem since normal type matching
+will preclude their use except when the full type is "nearby" as context
+(e.g. as the expected type).
+
+TBD: What about assignment statements?  Is an incomplete type limited
+or nonlimited?
+
 Replace 3.10.1(11):
 
-  A subtype_mark that denotes an incomplete_type_declaration for a type T
-  provides an incomplete view of T except when:
+   An incomplete_type_declaration declares an incomplete view of a type,
+   and its first subtype; the first subtype is unconstrained if a
+   known_discriminant_part appears.
+
+AARM Change: We define "incomplete view" here.
+
+  Given an access type A whose designated type T is an incomplete view,
+  a dereference of a value of type A is also of this incomplete view
+  except when:
     * it occurs in the immediate scope of the completion of T, or
     * it occurs in the scope of a nonlimited_with_clause that mentions
-      the library package in which the completion of T is declared, where not
-      within the immediate scope of the incomplete_type_declaration of T.
+      a library package in whose visible part the completion of T is declared.
 
-AARM Note: We need the "where not within in the immediate scope" rule so that
+AARM Note: We need the "in whose visible part" rule so that
   the second rule doesn't trigger in the body of a package with a with of a
   child unit:
 
@@ -179,15 +183,15 @@
    end P;
 
    private package P.C is
-      P : AT;
+      Ptr : AT;
    end P.C;
 
    with P.C;
    package body P is
-       -- P.all is not legal here, but it is in the scope of a non-limited
+       -- Ptr.all is not legal here, but it is in the scope of a non-limited
        -- with_clause for P.
        type T is ...
-       -- P.all is legal here.
+       -- Ptr.all is legal here.
    end P;
 
 AI-217 Note: The above rules comes from AI-217-06. Note that here we say that

Questions? Ask the ACAA Technical Agent