CVS difference for ai22s/ai22-0027-1.txt
--- ai22s/ai22-0027-1.txt 2022/01/25 02:27:52 1.1
+++ ai22s/ai22-0027-1.txt 2022/01/28 07:06:50 1.2
@@ -1,4 +1,4 @@
-!standard 3.4.1(5) 22-01-24 AI22-0027-1/01
+!standard 3.4.1(5) 22-01-27 AI22-0027-1/03
!standard 4.5.2(28.1/5)
!class binding interpretation 22-01-24
!status work item 22-01-24
@@ -32,6 +32,12 @@
!wording
+[Editor's note: We present two options for this fix, a simple fix that just patches
+the problem and a more complex fix that is more consistent with the rest of the
+language.]
+
+--- Simple option:
+
Modify 3.4.1(5):
The set of values for a class-wide type T'Class is the discriminated union
@@ -40,11 +46,60 @@
types have no primitive subprograms of their own. However, as explained in
3.9.2, operands of a class-wide type T'Class can be used as part of a
dispatching call on a primitive subprogram of the type T. {When a
- language rule references a given primitive operation of a type, in the case
- of a class-wide type T'Class, this is to be interpreted as a dispatching
- call on the corresponding primitive operation of T.} The only components
- [(including discriminants)] of T'Class that are visible are those of T. If
- S is a first subtype, then S'Class is a first subtype.
+ language rule references a call on a given primitive operation of a type,
+ in the case of a class-wide type T'Class, this is to be interpreted as a
+ dispatching call on the corresponding primitive operation of T.} The only
+ components [(including discriminants)] of T'Class that are visible are
+ those of T. If S is a first subtype, then S'Class is a first subtype.
+
+[Editor's note: The above fix is weird in that it only defines a "call on
+a primitive operation of a class-wide type". That's all we need to fix this
+particular problem, but it does not answer the question of what a primitive
+operation of a class-wide type is itself (it needs to be some sort of
+operation, not a call). So this could leave holes in other places in the
+language.]
+
+--- Better fix: (Borrowing from 12.5.1(23.2/2)):
+
+Add after 3.4.1(5):
+
+ When a language rule references a given primitive operation of a type,
+ in the case of a class-wide type T'Class, this is equivalent to a
+ subprogram (with an intrinsic calling convention — see 6.3.1) whose body
+ consists of a dispatching call upon the corresponding operation of T, with
+ its formal parameters as the actual parameters. If it is a function, the
+ result of the dispatching call is returned.
+
+Add after AARM 4.5.2(28.a/5):
+
+ AARM Ramification: If the tested type is class-wide, "primitive equality"
+ is interpreted as described in 3.4.1. Specifically, it is implemented by a
+ dispatching call on the primitive equality of the specific type associated
+ with the class-wide type.
+
+[The following modifications are to take existing explicit descriptions and
+change them to depend on the general description now added to 3.4.1:]
+
+Modify 12.5.1(23.2/2):
+
+ * For the purposes of defining the primitive operations of the formal type,
+ each of the primitive operations of the actual type is considered to be a
+ subprogram {as described in 3.4.1 for primitive operations of a class-wide
+ type}[(with an intrinsic calling convention — see 6.3.1) whose body
+ consists of a dispatching call upon the corresponding operation of T, with
+ its formal parameters as the actual parameters. If it is a function, the
+ result of the dispatching call is returned.]
+
+Modify 12.6(9.2/3):
+
+ For each primitive subprogram of T that is directly visible at the point
+ of the instantiation, and that has at least one controlling formal
+ parameter, a corresponding implicitly declared subprogram with the same
+ defining name, and having the same profile as the primitive subprogram
+ except that T is systematically replaced by T'Class in the types of its
+ profile, is potentially use-visible. The body of such a subprogram is as
+ defined in {3.4.1}[12.5.1] for primitive subprograms of a [formal type
+ when the actual type is ]class-wide{ type}.
!discussion
Questions? Ask the ACAA Technical Agent