CVS difference for ai05s/ai05-0071-1.txt

Differences between 1.5 and version 1.6
Log of other versions for file ai05s/ai05-0071-1.txt

--- ai05s/ai05-0071-1.txt	2008/09/24 18:35:01	1.5
+++ ai05s/ai05-0071-1.txt	2008/10/25 04:53:14	1.6
@@ -1,4 +1,4 @@
-!standard 12.5.1(23.1/2)                                 08-08-08    AI05-0071-1/04
+!standard 12.5.1(23.1/2)                                 08-10-22    AI05-0071-1/05
 !standard 12.6(10)
 !class binding interpretation 08-06-21
 !status ARG Approved  6-0-2  08-06-21
@@ -11,8 +11,9 @@
 !summary
 
 An equivalence is defined for the purposes of formal subprogram
-default matching so that the class-wide type can make a similar
-substitution that it does inside of the generic.
+default matching so that a similar substitution is made for the
+class-wide type as would be made for an inherited subprogram
+inside of the generic.
 
 !question
 
@@ -31,8 +32,6 @@
 
 (See summary.)
 
-There seem to be two ways to fix this:
-
 !wording
 
 Modify 12.5.1(23.1/2):
@@ -47,7 +46,7 @@
    to an explicit actual parameter that is a usage name identical to the
    defining name of the formal. {If a subtype_mark in the profile of the
    formal_subprogram_declaration denotes a formal private or formal derived
-   type, and the actual type for this formal type is a class-wide type
+   type and the actual type for this formal type is a class-wide type
    T'Class, then for the purposes of resolving this default_name at the
    point of the instantiation, for each primitive subprogram of T that has
    a matching defining name, that is directly visible at the point of the
@@ -67,12 +66,16 @@
 there is no "=" automatically available. It is necessary to explicitly
 declare an "Equal" function on the class-wide type, and pass it in. The
 body of the "Equal" function would simply make a dispatching call on the
-"=" for the correspnding specific type.  E.g.:
+"=" for the corresponding specific type.  Such as:
 
      function Equal(Left, Right : T'Class) return Boolean;
      package T_Vectors is new
        Ada.Containers.Indefinite_Vectors(
          Positive, T'Class, Equal);
+     function Equal(Left, Right : T'Class) return Boolean is
+     begin
+         return Left = Right;
+     end Equal;
 
 It is important not to actually name it "=" because
 if so named, it would create ambiguity at every call.
@@ -87,13 +90,13 @@
 and to refer to 12.5.1 for the definition of the semantics of the body.
 
 The change to the wording in 12.5.1(23.1/2) is to eliminate the word
-"tagged," because the formal need not be tagged for the actual to be
+"tagged", because the formal need not be tagged for the actual to be
 class-wide, in the case of a formal private type with unknown
 discriminants.
 
 The addition to the wording of 12.6 should allow instantiations with
 class-wide types to work as the user would expect. That is, by adding
-in to a generic formal part:
+the following to a generic formal part:
 
     with function "="(Left, Right : T)
       return Boolean is <>;
@@ -106,8 +109,8 @@
 class-wide type.
 
 An alternative approach would be to change the rules for matching
-"expected profiles," which might imply having a new kind of conformance
-between profiles, such as "call conformance." That is "call
+"expected profiles", which might imply having a new kind of conformance
+between profiles, such as "call conformance". That is "call
 conformance" would include the matching allowed between formal parameter
 types and actual parameter types in a call (8.6(20/2-25.1/2)). This
 would obviously be a bigger change, and we have chosen to go with the
@@ -118,10 +121,10 @@
    generic
        type Priv(<>) is private;
        
+       X, Y : Priv;
+
        with function "="(Left, Right : Priv)
         return Boolean is <>;
-        
-       X, Y : Priv;
    package GP is
        Are_Equal : constant Boolean := (X = Y);  -- use "="
    end GP;
@@ -134,7 +137,8 @@
        package P is new GP(T'Class, U, V);
           -- This instantiation should work, without
           -- our having to declare and pass in explicitly
-          -- an equality operator for T'Class
+          -- an equality operator for T'Class. But this
+          -- is illegal without the changes.
    begin
        if P.Are_Equal then
            ...
@@ -162,7 +166,7 @@
 actual parameter that is a usage name identical to the defining name of the formal.
 If a @fa<subtype_mark> in the profile of the
 @fa<formal_subprogram_declaration> denotes a formal private or formal derived
-type, and the actual type for this formal type is a class-wide type
+type and the actual type for this formal type is a class-wide type
 @i<T>'Class, then for the purposes of resolving this @fa<default_name> at the
 point of the instantiation, for each primitive subprogram of @i<T> that has
 a matching defining name, that is directly visible at the point of the

Questions? Ask the ACAA Technical Agent