CVS difference for ais/ai-30217.txt

Differences between 1.3 and version 1.4
Log of other versions for file ais/ai-30217.txt

--- ais/ai-30217.txt	2002/03/13 00:48:29	1.3
+++ ais/ai-30217.txt	2002/07/23 01:05:25	1.4
@@ -1,5 +1,15 @@
-!standard 03.10.01   (02)                           02-03-01  AI95-00217-04/02
+!standard 03.10.01   (02)                           02-07-11  AI95-00217-04/03
+!standard 03.10.01   (03)
+!standard 03.10.01   (04)
+!standard 03.10.01   (05)
+!standard 03.10.01   (08)
+!standard 03.10.01   (09)
+!standard 03.10.01   (10)
+!standard 03.10.01   (11)
+!standard J.10       (00)
 !class amendment 02-02-06
+!status Amendment 200Y 02-07-11
+!status ARG Approved 8-0-1  02-06-22
 !status work item 02-02-06
 !status received 02-02-06
 !priority Medium
@@ -133,9 +143,9 @@
 
         A type_stub includes a package_specifier which specifies the full
 	expanded name of the package in which its completion is expected to
-	occur. Certain uses (see below) of a name that denotes the type_stub or
-	a value of an access type that designates the type stub, require that
-	the completion exist. In these cases, the completion shall occur in the
+	occur. [Certain uses (see below) of a name that denotes the type_stub or
+	a value of an access type that designates the type_stub, require that
+	the completion exist.] In these cases, the completion shall occur in the
 	visible part of the specified package, and be a type_declaration other
 	than an incomplete_type_declaration; the package_specifier shall be the
 	full expanded name of this package (starting with a root library unit,
@@ -146,12 +156,16 @@
 
    Add a new first sentence:
 
-        If an incomplete_type_declaration includes the word TAGGED, then a
+        If an incomplete_type_declaration includes the keyword TAGGED, then a
 	type_declaration that completes it shall declare a tagged type.
 
-   Replace all occurrences of "full_type_declaration" with "type_declaration" in the remaining
-   sentences.
+   Replace all occurrences of "full_type_declaration" with "type_declaration"
+   in the remaining sentences.
 
+   Add a new last sentence:
+        In the case of a type_stub, these checks are performed no later than
+	when a construct requires the completion to be available.
+
 Replace 3.10.1(5-10):
 
         A name that denotes an incomplete_type_declaration may be used as
@@ -167,7 +181,7 @@
         * as the subtype_mark in an access_definition;
 
         A name that denotes an incomplete_type_declaration that includes the
-	word TAGGED may also be used as follows:
+	keyword TAGGED may also be used as follows:
 
         * as the subtype_mark defining the subtype of a parameter in a
 	  formal_part;
@@ -176,8 +190,8 @@
 	  Class; such an attribute_reference is restricted to the uses allowed
 	  above.
 
-[NOTE: I have moved the allowance for 'Class after a non-tagged incomplete type
-to Annex J. See below.]
+[NOTE: The allowance for 'Class after a non-tagged incomplete type has been
+moved to Annex J. See below.]
 
         If a name that denotes an incomplete_type_declaration is used in other
 	contexts, the incomplete_type_declaration shall be a type_stub, and the
@@ -203,26 +217,26 @@
         * in a place where the completion of D is available (see above);
 
         * in a context where the expected type is E and
-           o E is the same as D or its completion, or
-           o E is the same as D'Class or its completion, or
-           o E'Class is the same as D or its completion;
+           o E covers the completion of D,
+	   o E is tagged and covers D,
+           o E covers D'Class or its completion, or
+           o E'Class covers D or its completion;
 
         * as the target of an assignment_statement where the type of the value
 	  being assigned is V, and V or V'Class is the completion of D.
 
-        In these contexts, the incomplete type is considered the same type as
-	its completion, and its first subtype statically matches the first
-	subtype of its completion.
+        In these contexts, the incomplete type is defined to be the same
+        type as its completion, and its first subtype statically matches the
+        first subtype of its completion.
 
 Replace 3.10.1(11):
 
         An incomplete_type_declaration declares an incomplete type and its
-	first subtype; the incomplete type is tagged if the word TAGGED
+	first subtype; the incomplete type is tagged if the keyword TAGGED
 	appears; the first subtype is unconstrained if a
-	known_discriminant_part appears. The incomplete type is a type stub if
-	the word SEPARATE appears. Two type stubs are considered the same type
-	if they have the same defining identifier and same sequence of
-	identifiers in their package_specifiers; their first subtypes match
+	known_discriminant_part appears. Two type_stubs are defined to be the
+        same type if they have the same defining identifier and same sequence
+        of identifiers in their package_specifiers; their first subtypes match
 	statically as well.
 
 Add J.10:
@@ -412,6 +426,183 @@
         ...
     end Departments;
 
+!corrigendum 3.10.1(2)
+
+@drepl
+@xindent<@fa<incomplete_type_declaration ::= @b<type> defining_identifier [discriminant_part];>>
+@dby
+@xindent<@fa<incomplete_type_declaration ::= @b<type> defining_identifier [discriminant_part] [@b<is tagged>];@hr
+     | type_stub>>
+
+@xindent<@fa<type_stub ::= @b<type> defining_identifier [discriminant_part] @b<is> [@b<tagged>]@hr
+     @b<separate in> package_specifier;>>
+
+@xindent<@fa<package_specifier ::= identifier | package_specifier . identifier>>
+
+!corrigendum 3.10.1(3)
+
+@drepl
+An @fa<incomplete_type_declaration> requires a completion, which shall be a
+@fa<full_type_declaration>. If the @fa<incomplete_type_declaration> occurs
+immediately within either the visible part of a @fa<package_specification>
+or a @fa<declarative_part>, then the @fa<full_type_declaration> shall occur
+later and immediately within this visible part or @fa<declarative_part>. If
+the @fa<incomplete_type_declaration> occurs immediately within the private part
+of a given @fa<package_specification>, then the @fa<full_type_declaration>
+shall occur later and immediately within either the private part itself, or
+the @fa<declarative_part> of the corresponding @fa<package_body>.
+@dby
+An @fa<incomplete_type_declaration> other than a @fa<type_stub> requires a
+completion, which shall be a @fa<full_type_declaration>. If the
+@fa<incomplete_type_declaration> occurs immediately within either the visible
+part of a @fa<package_specification> or a @fa<declarative_part>, then the
+@fa<full_type_declaration> shall occur later and immediately within this
+visible part or @fa<declarative_part>. If the @fa<incomplete_type_declaration>
+occurs immediately within the private part of a given
+@fa<package_specification>, then the @fa<full_type_declaration> shall occur
+later and immediately within either the private part itself, or the
+@fa<declarative_part> of the corresponding @fa<package_body>.
+
+A @fa<type_stub> includes a @fa<package_specifier> which specifies the full
+expanded name of the package in which its completion is expected to
+occur. Certain uses (see below) of a name that denotes the @fa<type_stub> or
+a value of an access type that designates the @fa<type_stub>, require that
+the completion exist. In these cases, the completion shall occur in the
+visible part of the specified package, and be a @fa<type_declaration> other
+than an @fa<incomplete_type_declaration>; the @fa<package_specifier> shall be
+the full expanded name of this package (starting with a root library unit,
+and using no renaming declarations), and the package shall be a library
+package.
+
+!corrigendum 3.10.1(4)
+
+@drepl
+If an @fa<incomplete_type_declaration> has a @fa<known_discriminant_part>, then
+a @fa<full_type_declaration> that completes it shall have a fully conforming
+(explicit) @fa<known_discriminant_part> (see 6.3.1). If an
+@fa<incomplete_type_declaration> has no @fa<discriminant_part> (or an
+@fa<unknown_discriminant_part>), then a corresponding @fa<full_type_declaration>
+is nevertheless allowed to have discriminants, either explicitly, or inherited
+via derivation.
+@dby
+If an @fa<incomplete_type_declaration> includes the keyword @b<tagged>, then a
+@fa<type_declaration> that completes it shall declare a tagged type.
+If an @fa<incomplete_type_declaration> has a @fa<known_discriminant_part>, then
+a @fa<type_declaration> that completes it shall have a fully conforming
+(explicit) @fa<known_discriminant_part> (see 6.3.1). If an
+@fa<incomplete_type_declaration> has no @fa<discriminant_part> (or an
+@fa<unknown_discriminant_part>), then a corresponding @fa<type_declaration>
+is nevertheless allowed to have discriminants, either explicitly, or inherited
+via derivation. In the case of a @fa<type_stub>, these checks are performed no
+later than when a construct requires the completion to be available.
+
+
+!corrigendum 3.10.1(5)
+
+@drepl
+The only allowed uses of a name that denotes an @fa<incomplete_type_declaration>
+are as follows:
+@dby
+A name that denotes an @fa<incomplete_type_declaration> may be used as follows:
+
+!corrigendum 3.10.1(8)
+
+@drepl
+@xbullet<as the @fa<subtype_mark> in an @fa<access_definition>;>
+@dby
+@xbullet<as the @fa<subtype_mark> in an @fa<access_definition>.>
+
+A name that denotes an incomplete_type_declaration that includes the
+keyword @b<tagged> may also be used as follows:
+
+@xbullet<as the @fa<subtype_mark> defining the subtype of a parameter in a
+@fa<formal_part>;>
+
+
+!corrigendum 3.10.1(9)
+
+@drepl
+@xbullet<as the @fa<prefix> of an @fa<attribute_reference> whose
+@fa<attribute_designator> is Class; such an @fa<attribute_reference> is
+similarly restricted to the uses allowed here; when used in this way, the
+corresponding @fa<full_type_declaration> shall declare a tagged type, and the
+@fa<attribute_reference> shall occur in the same library unit as the
+@fa<incomplete_type_declaration>.>
+@dby
+@xbullet<as the @fa<prefix> of an @fa<attribute_reference> whose
+@fa<attribute_designator> is Class; such an @fa<attribute_reference> is
+restricted to the uses allowed above.>
+
+If a name that denotes an @fa<incomplete_type_declaration> is used in other
+contexts, the @fa<incomplete_type_declaration> shall be a @fa<type_stub>, and
+the completion shall be @i<available> at the place of use, as defined by
+either of the following conditions:
+
+@xbullet<the place of use is within the immediate scope of the completion of
+the @fa<type_stub>; or>
+
+@xbullet<the place of use is within the scope of a @fa<with_clause> that
+mentions the package specified by the @fa<package_specifier> of the
+@fa<type_stub>.>
+
+The completion of an @fa<incomplete_type_declaration> that is not a
+@fa<type_stub> is defined to be available throughout the (extended) scope
+of the completion. The completion of an incomplete class-wide type is
+available wherever the completion of the root of the class is available.
+
+!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 (implicit or explicit -- see 4.1) of a value of an access type
+whose designated type @i<D> is incomplete is allowed only in the following
+contexts:
+
+@xbullet<in a place where the completion of @i<D> is available (see above);>
+
+@xbullet<in a context where the expected type is @i<E> and>
+@xinbull<@i<E> covers the completion of @i<D>,>
+@xinbull<@i<E> is tagged and covers @i<D>,>
+@xinbull<@i<E> covers @i<D>'Class or its completion, or>
+@xinbull<@i<E>'Class covers @i<D> or its completion;>
+
+@xbullet<as the target of an @fa<assignment_statement> where the type of the
+value being assigned is @i<V>, and @i<V> or @i<V>'Class is the completion of
+@i<D>.>
+
+In these contexts, the incomplete type is defined to be the same type as
+completion, and its first subtype statically matches the first
+subtype of its completion.
+
+!corrigendum 3.10.1(11)
+
+@drepl
+An @fa<incomplete_type_declaration> declares an incomplete type and its first
+subtype; the first subtype is unconstrained if a @fa<known_discriminant_part>
+appears.
+@dby
+An @fa<incomplete_type_declaration> declares an incomplete type and its
+first subtype; the incomplete type is tagged if the keyword @b<tagged>
+appears; the first subtype is unconstrained if a @fa<known_discriminant_part>
+appears. Two @fa<type_stub>s are defined to be the same type if they have the
+same defining identifier and same sequence of identifiers in their
+@fa<package_specifiers>; their first subtypes match statically as well.
+
+!corrigendum J.10(1)
+
+@dinsc
+For the first subtype S of a type T declared by an
+@fa<incomplete_type_declaration> that is not tagged and is not a type stub, the
+following attribute is defined:
+
+@xhang<@xterm<S'Class>Denotes the first subtype of the incomplete class-wide
+type rooted at T. The completion of T shall declare a tagged type. Such an
+attribute reference shall occur in the same library unit as the
+@fa<incomplete_type_declaration>.
+
+
 !appendix
 
 [For discussion on the original version of this proposal, see AI-00217-03.]
@@ -1683,6 +1874,46 @@
 I'd rather avoid overloading the term, but given the options seem pretty lousy,
 I think it is OK. (Of course, if you had used "employable" for stream
 attributes, we wouldn't have this problem. :-)
+
+*************************************************************
+
+Editor's note:
+
+At the ARG meeting in Vienna, Austria (June 22, 2002), the question was raised
+as to how a dereference could occur where the expected type is a complete type
+without the original type having the completion available. (This is the
+first (sub)bulleted rule under the bullet "in a context where the expected type
+is E and".)
+
+It was mentioned that this can happen if the completion type is used as a
+parameter type, and we don't have the completion available at the site of a
+call. This satisfied the questioner, but how that can happen has confused
+everyone. So, here is an example of why this rule is needed:
+
+    package I is
+        type Obj is tagged separate in P;
+        type Acc is access all Obj;
+        O : Acc;
+    end I;
+
+    package P is
+        type Obj is tagged ...;
+    end P;
+
+    with P;
+    package R is
+        procedure Proc (Obj : in P.Obj);
+    end R;
+
+    with R, I;
+    procedure Main is
+    begin
+       Proc (I.all);
+    end Main;
+
+In Main, P.Obj is not "available" (there is no with of P). But clearly the
+type of the parameter Proc.Obj is complete, and the rule in question is
+triggered.
 
 *************************************************************
 

Questions? Ask the ACAA Technical Agent