CVS difference for ais/ai-00344.txt

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

--- ais/ai-00344.txt	2004/06/10 05:39:57	1.7
+++ ais/ai-00344.txt	2004/07/27 23:00:59	1.8
@@ -1,5 +1,16 @@
-!standard  3.09.01    (03)                             04-06-07  AI95-00344/03
+!standard  3.09    (04)                               04-07-01  AI95-00344/04
+!standard  3.09    (07)
+!standard  3.09    (12)
+!standard  3.09.01 (03)
+!standard  3.09.01 (04)
+!standard  4.08    (05)
+!standard  4.08    (07)
+!standard  6.05    (20)
+!standard  13.13.2 (31)
+!standard  13.13.2 (34)
 !class amendment 03-08-07
+!status Amendment 200Y 04-07-01
+!status ARG Approved 8-0-0  04-06-14
 !status work item 04-02-29
 !status received 03-04-21
 !priority Medium
@@ -145,8 +156,6 @@
     {Tags.Descendant_Tag(String'Input(Stream), S'Tag) which might raise
     Tag_Error} -- see 3.9) ...
 
-!example
-
 !discussion
 
 With the proposal to add a number of generic packages to provide
@@ -177,7 +186,7 @@
 To implement tag checks needed to ensure that all dynamically tagged
 controlling operands come from the same tagged type, we place additional
 requirements on the uniqueness of run-time tags. We considered defining
-a separate type called "extended tag."  However, this would add user
+a separate type called "extended tag." However, this would add user
 complexity, and would make existing user tests for tag equality using
 the preexisting tag type no longer sufficient to ensure that the
 tag check would succeed.
@@ -245,9 +254,224 @@
 "normal" register or per-task display used for that. This wrapper would
 be the natural place to perform this additional check.
 
+!example
+
+   package Pack is
+      type T is tagged record ...;
+      procedure Op (Obj : in out T);
+      type AT is access all T'Class;
+      procedure Do_Something (Obj : in T'Class);
+   end Pack;
+
+   package body Pack is
+      procedure Op (Obj : in out T) is
+      begin
+          ... -- (1)
+      end Op;
+
+      List : AT;
+      procedure Do_Something (Obj : in T'Class) is
+      begin
+         Op (Obj); -- (2)
+         ...
+         List := new T'Class'(Obj); -- (3)
+         ...
+      end Do_Something;
+   end Pack;
+
+   with Pack;
+   procedure Back is
+      type TT is new T with null record;
+      procedure Op (Obj : in out TT);
+      O : aliased TT;
+      function Get_It return T'Class is
+      begin
+         return T'Class(O); -- (4)
+      end Get_It;
+      procedure Op (Obj : in out TT) is
+      begin
+          ... -- (5)
+      end Op;
+   begin
+      Do_Something (O); -- (6)
+      Do_Something (Get_It); -- (7)
+   end Back;
+
+Type TT is more nested than it's parent type. The call at (6) is legal and needs
+no run-time check, because Do_Something must necessarily return before O and TT
+cease to exist. The dispatching call at (2) operates normally, so the body of
+the overriding routine at (5) is executed, not the original routine at (1).
+However, the allocator at (3) fails it's accessibility check and raises
+Constraint_Error, as it would create an object that could outlive its type.
+
+The return statement at (4) does not fail an accessibility check, because the
+object has the same accessibility as the function. Only a type nested within
+a function would fail an accessibility check. This makes sense, since the
+function Get_It can be used in similar ways to the object O, as illustrated by
+the call at (7). It would be odd if they behaved differently.
+
+!corrigendum 03.09(04)
+
+@drepl
+The tag of a specific tagged type identifies the @fa<full_type_declaration> of
+the type. If a declaration for a tagged type occurs within a
+@fa<generic_package_declaration>, then the corresponding type declarations in
+distinct instances of the generic package are associated with distinct tags.
+For a tagged type that is local to a generic package body, the language does
+not specify whether repeated instantiations of the generic body result in
+distinct tags.
+@dby
+The tag of a specific tagged type identifies the @fa<full_type_declaration> of
+the type, and for a type extension, is sufficient to uniquely identify the type
+among all descendants of the same ancestor. If a declaration for a tagged
+type occurs within a @fa<generic_package_declaration>, then the
+corresponding type declarations in distinct instances of the generic
+package are associated with distinct tags. For a tagged type that is local to a
+generic package body and with any ancestors also local to the generic body, the
+language does not specify whether repeated instantiations of the generic body
+result in distinct tags.
+
+!corrigendum 03.09(7)
+
+@dinsa
+@xcode<    @b<function> Expanded_Name(T : Tag) @b<return> String;
+    @b<function> External_Tag(T : Tag) @b<return> String;
+    @b<function> Internal_Tag(External : String) @b<return> Tag;>
+@dinss
+@xcode<    @b<function> Descendant_Tag(External : String; Ancestor : Tag) @b<return> Tag;
+    @b<function> Is_Descendant_At_Same_Level(Descendant, Ancestor : Tag)
+        @b<return> Boolean;>
+
+!corrigendum 03.09(12)
+
+@drepl
+The function Internal_Tag returns the tag that corresponds to the given
+external tag, or raises Tag_Error if the given string is not the external tag
+for any specific type of the partition.
+@dby
+The function Internal_Tag returns a tag that corresponds to the given
+external tag, or raises Tag_Error if the given string is not the external tag
+for any specific type of the partition.
+
+The function Descendant_Tag returns the (internal) tag for the type
+that corresponds to the given external tag and is both a descendant of the
+type identified by the Ancestor tag and has the same accessibility level as
+the identified ancestor. Tag_Error is raised if External is not the
+external tag for such a type.
+
+The function Is_Descendant_At_Same_Level returns True if Descendant tag
+identifies a type that is both a descendant of the type identified
+by Ancestor and at the same accessibility level. If not, it returns False.
+
+
 !corrigendum 03.09.01(03)
 
+@drepl
+The parent type of a record extension shall not be a class-wide type. If the
+parent type is nonlimited, then each of the components of the
+@fa<record_extension_part> shall be nonlimited. The accessibility level (see 3.10.2)
+of a record extension shall not be statically deeper than that of its parent
+type. In addition to the places where Legality Rules normally apply (see 12.3),
+these rules apply also in the private part of an instance of a generic unit.
+@dby
+The parent type of a record extension shall not be a class-wide type. If the
+parent type is nonlimited, then each of the components of the
+@fa<record_extension_part> shall be nonlimited.
+
+!corrigendum 03.09.01(04)
+
+@drepl
+A type extension shall not be declared in a generic body if the parent type is
+declared outside that body.
+@dby
+Within the body of a generic unit, or the body of any of its descendant
+library units, a tagged type shall not be declared as a descendant
+of a formal type of the generic unit.
+
+
+!corrigendum 04.08(05)
+
+@dinsa
+If the type of the @fa<allocator> is an access-to-constant type, the
+@fa<allocator> shall be an initialized allocator. If the designated type is
+limited, the @fa<allocator> shall be an uninitialized allocator.
+@dinst
+If the designated type of the type of the @fa<allocator> is class-wide, the
+accessibility level of the type determined by the @fa<subtype_indication> or
+@fa<qualified_expression> shall not be statically deeper than that of the type
+of the @fa<allocator>.
+
+!corrigendum 04.08(07)
+
+@drepl
+For the evaluation of an @fa<allocator>, the elaboration of the
+@fa<subtype_indication> or the evaluation of the @fa<qualified_expression> is
+performed first. For the evaluation of an initialized allocator, an object of
+the designated type is created and the value of the @fa<qualified_expression>
+is converted to the designated subtype and assigned to the object.
+@dby
+For the evaluation of an @fa<allocator>, the elaboration of the
+@fa<subtype_indication> or the evaluation of the @fa<qualified_expression> is
+performed first. For the evaluation of an initialized allocator, an object of
+the designated type is created and the value of the @fa<qualified_expression>
+is converted to the designated subtype and assigned to the object. If the
+designated type of the type of the @fa<allocator> is class-wide, then
+a check is made that the accessibility level of the type identified by
+the tag of the value of the @fa<qualified_expression> is not deeper than that
+of the type of the allocator. Constraint_Error is raised if this check fails.
+
+!corrigendum 06.05(20)
+
+@dinsa
+The exception Program_Error is raised if this check fails.
+@dby
+If the result type is class-wide, a check is made that the accessibility
+level of the type identified by the tag of the result is not deeper than
+that of the master that elaborated the function body. If this check fails,
+Program_Error is raised.
+
+!comment There is no change in the next one, but we'll need to put text
+!comment here in the integrated document. So we have to fool the tools.
+!corrigendum 13.13.2(28)
+
+@drepl
+For every subtype S'Class of a class-wide type @i<T>'Class:
+@dby
+For every subtype S'Class of a class-wide type @i<T>'Class:
+
+!corrigendum 13.13.2(31)
+
+@drepl
+@xindent<First writes the external tag of Item to Stream (by calling
+String'Output(Tags.External_Tag(Item'Tag) -- see 3.9) and then dispatches to
+the subprogram denoted by the Output attribute of the specific type identified
+by the tag.>
+@dby
+@xindent<First writes the external tag of Item to Stream (by calling
+String'Output(Tags.External_Tag(Item'Tag) -- see 3.9) and then dispatches to
+the subprogram denoted by the Output attribute of the specific type identified
+by the tag. Tag_Error is raised if the tag of Item identifies a type declared
+at an accessibility level deeper than that of S.>
+
+!corrigendum 13.13.2(34)
+
+@drepl
+@xindent<First reads the external tag from Stream and determines the
+corresponding internal tag (by calling Tags.Internal_Tag(String'Input(Stream))
+-- see 3.9) and then dispatches to the subprogram denoted by the Input
+attribute of the specific type identified by the internal tag; returns that
+result.>
+@dby
+@xindent<First reads the external tag from Stream and determines the
+corresponding internal tag (by calling
+Tags.Descendant_Tag(String'Input(Stream), S'Tag) which might raise Tag_Error --
+see 3.9) and then dispatches to the subprogram denoted by the Input attribute
+of the specific type identified by the internal tag; returns that result.>
+
 !ACATS test
+
+ACATS test(s) need to be constructed to check that this feature is supported,
+and that the restrictions on formal types are enforced.
 
 !appendix
 

Questions? Ask the ACAA Technical Agent