CVS difference for ais/ai-00202.txt

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

--- ais/ai-00202.txt	1999/03/22 18:22:07	1.3
+++ ais/ai-00202.txt	1999/04/01 23:30:32	1.4
@@ -1,19 +1,20 @@
-!standard 12.05.01 (21)                               99-03-21  AI95-00202/02
+!standard 12.05.01 (21)                               99-04-01  AI95-00202/03
 !class binding interpretation 98-03-27
+!status ARG Approved (with changes) 9-0-1  99-03-25
 !status work item 98-10-02
 !status received 98-03-27
 !priority Medium
 !difficulty Hard
 !subject Primitives of formal type derived from another formal type
 
-!summary 99-03-21
+!summary
 
 In an instance of a generic unit having a formal derived type whose ancestor
 is itself a formal type, the copies of the implicit subprogram declarations
 of the formal derived type declare views of the corresponding copies of the
 primitive subprograms of the formal ancestor type.
 
-!question 99-03-21
+!question
 
 In an instance of a generic with a formal derived type whose ancestor type
 is another formal type, the rules regarding the meanings of the implicit
@@ -22,69 +23,63 @@
 Consider the following example:
 
    package P1 is
-      type R1 is record .. end record;
-      procedure S (x : R1);                  -- (1)
+      type R1 is record ... end record;
+      procedure S (x : R1);                  -- [1]
    end P1;
    use P1;
 
    generic
       type F2 is new R1;
-      -- implicit: procedure S (x : F2);     -- (2)
+      -- implicit: procedure S (x : F2);     -- [2]
       type F3 is new F2;
-      -- implicit: procedure S (x : F3);     -- (3)
+      -- implicit: procedure S (x : F3);     -- [3]
    procedure G (o2 : F2; o3 : F3);
    procedure G (o2 : F2; o3 : F3) is
    begin
       S(o2);
-      S(o3);                                 -- Peculiar result: Calls S (5)?
+      S(o3);        -- Peculiar result: Calls S [5] in instance I?  [No.]
    end G;
 
    package P2 is
       type R2 is new R1;
-      -- implicit: procedure S (x : R2);     -- (4)
-      procedure S (x : out R2);              -- (5) Overriding with mode out
+      -- implicit: procedure S (x : R2);     -- [4]
+      procedure S (x : out R2);              -- [5] Overriding with mode out
    end P2;
-   use P2;
 
    package P3 is
-      type R3 is new R2;
-      -- implicit: procedure S (x : R3);     -- (6)
-      procedure S (x : R3);                  -- (7)
+      type R3 is new P2.R2;
+      -- implicit: procedure S (x : R3);     -- [6]
+      procedure S (x : R3);                  -- [7]
    end P3;
-   use P3;
 
-   procedure I is new G(R2, R3);
+   procedure I is new G (P2.R2, P3.R3);
 
 In the instance I, the implicit declarations of S which operate on F2 and F3,
-respectively are the corresponding primitive subprograms of the ancestor
+respectively, are the corresponding primitive subprograms of the ancestor
 types of each type, as stated in RM95 12.5.1(21).  The ancestor type of F2 is
-R1, so the implicit declaration of S that operates on F2 (2) is a view of the
-corresponding primitive subprogram of R1 (1).
+R1, so the implicit declaration of S that operates on F2 [2] is a view of the
+corresponding primitive subprogram of R1 [1].
 
 The ancestor type of F3 is the type of the subtype denoted by the name F2 in
 the instance, which is R2.  So, the implicit declaration of S that operates
-on F3 (3) is a view of the corresponding primitive subprogram of R2 (5).
+on F3 [3] is a view of the corresponding primitive subprogram of R2 [5].
 But, the annotation in AARM 12.5.1(21.a) indicates that the reason the
 primitives of a formal derived type in an instance are views of its
 ancestor's primitives is because the primitives of its actual type might not
 be subtype conformant with those of its ancestor type.  This intention could
-be violated if the primitive S (3) is a view of the primitive S (5).
+be violated if the primitive S [3] is a view of the primitive S [5].
 
-Is it the intent that the primitive S (3) should declare a view of S (1)?
+Is it the intent that the primitive S [3] should declare a view of S [1]?
 [Yes.]
 
 In general, when the ancestor type of a formal derived type is itself
 another formal type, then within an instance does the derived type
 acquire the primitive operations of the formal ancestor type or the
 primitive operations of the ancestor type's corresponding actual type?
+[The primitive operations of the formal ancestor.]
 
-[Within the instance, the copies of the implicit operations of the formal
-derived type declare views of the corresponding copied operations of the
-formal ancestor type, not views of the operations of the ancestor's actual
-type.]
+!recommendation
 
-!recommendation 99-03-21
-
 The copies of the implicitly declared primitive subprograms of a formal
 derived type in an instance are defined to be views of the ancestor type's
 corresponding operations (12.5.1(21)).  In the case of a formal type whose
@@ -94,10 +89,10 @@
 operations of the ancestor type's actual type.
 
 It is essential to ensure that such copied implicit operations are always
-views of a parent type known at the point of the generic formal type's
-declaration, since using the operations of the ancestor's actual type can
-lead to inconsistencies because the operations of an actual (untagged) type
-may not be subtype conformant with those of the formal type.
+views of some ancestor known at the point of the generic formal type's
+declaration, since using the operations of the formal ancestor's actual
+type can lead to inconsistencies because the operations of an actual
+(untagged) type may not be subtype conformant with those of the formal type.
 
 This AI amends the rule of 12.5.1(21) to correct this problem.  The copies
 of a formal derived type's operations in an instance are defined to be
@@ -106,13 +101,13 @@
 simply those of "the ancestor type" (which in an instance would denote
 the actual type associated with the formal type's ancestor).
 
-Note that in the case where the ancestor type is a formal derived type,
-the copied operations of the ancestor type in the instance are themselves
-views of operations coming from the ancestor type's own ancestor (so the
-new rule applies transitively for arbitrary levels of derivation from formal
-derived types).
+Note that in the case where the formal ancestor type is a formal derived
+type, the copied operations of the ancestor type in the instance are
+themselves views of operations coming from the ancestor type's own ancestor
+(so the new rule applies transitively for arbitrary levels of derivation
+from formal derived types).
 
-!wording 99-03-21
+!wording
 
 The second sentence of 12.5.1(21) should be corrected to cover the case
 where the formal derived type has a formal ancestor type declared in
@@ -120,7 +115,7 @@
 derived type must be defined to declare views of the corresponding
 copied operations of the ancestor.
 
-!discussion 99-03-21
+!discussion
 
 Paragraph 12.5.1(21) defines the implicit operations that are declared
 for a formal derived type, as well as the meaning of the copies of those

Questions? Ask the ACAA Technical Agent