CVS difference for ais/ai-00317.txt

Differences between 1.5 and version 1.6
Log of other versions for file ais/ai-00317.txt

--- ais/ai-00317.txt	2003/09/30 02:01:13	1.5
+++ ais/ai-00317.txt	2003/10/29 00:41:22	1.6
@@ -1,5 +1,9 @@
-!standard  12.07 (03)                                  03-09-28  AI95-00317/03
+!standard  12.07 (03)                                  03-10-23  AI95-00317/04
+!standard  12.07 (05)
+!standard  12.07 (10)
 !class amendment
+!status Amendment 200Y 03-10-23
+!status ARG Approved 8-0-2  03-10-04
 !status work item 02-10-06
 !status received 02-10-06
 !priority Medium
@@ -13,9 +17,9 @@
 !problem
 
 When a generic has more than one formal package parameter, it is often
-important to link the two packages via their actuals.  However, the
+important to link the two packages via their actuals. However, the
 only way to link the packages is to specify one with no actuals, and
-specify the other with all of its actuals.  For example:
+specify the other with all of its actuals. For example:
 
     generic
         with package Inst1 is new Gen1(<>);
@@ -24,9 +28,9 @@
     package GP is ...
 
 The problem is that there may be some actuals of the second formal
-package which are *not* linked to the first one.  The only way to
+package which are *not* linked to the first one. The only way to
 deal with this is to add more formal parameters to the generic GP to
-specify the values for the remaining actual parameters.  For example:
+specify the values for the remaining actual parameters. For example:
 
     generic
         type T1 is private;
@@ -43,7 +47,7 @@
 !proposal
 
 A formal package parameter may specify some, but not all, of its actual
-parameters.  For example:
+parameters. For example:
 
     generic
         with package Inst1 is new Gen1(<>);
@@ -52,15 +56,15 @@
     package GP is ...
 
 The parameters which are not specified may be referenced by name as
-expanded names using the formal package as its prefix.  For example,
+expanded names using the formal package as its prefix. For example,
 Inst2.FT3 and Inst2.FT4 may be used later in the formal generic part
-of GP or within the spec or body of GP.  By contrast, the specified
+of GP or within the spec or body of GP. By contrast, the specified
 actuals may not be so named, to avoid confusion between the properties
 of the actual and those of the formal.
 
 Similarly, any implicit declarations associated with a given parameter
 of the formal package may be named using the formal package as a
-prefix may only when the actual for the parameter is *not* specified.
+prefix only when the actual for the parameter is *not* specified.
 
 With this proposal, the notation "(<>)" for its actual part is essentially
 a short-hand for "(others => <>)."
@@ -79,7 +83,7 @@
 
 Replace 12.7(5) with the following:
 
-  The actual shall be an instance of the template.  If the
+  The actual shall be an instance of the template. If the
   formal_package_actual_part is (<>) or (OTHERS => <>), then the actual
   may be any instance of the template; otherwise, certain of the actual
   parameters of the actual instance shall match the corresponding actual
@@ -98,7 +102,7 @@
 Replace 12.7(10) with the following:
 
   The visible part of a formal package includes the first list of
-  basic_declarative_items of the package_specification.  In addition,
+  basic_declarative_items of the package_specification. In addition,
   for each actual parameter that is not required to match, a copy of the
   declaration of the corresponding formal parameter of the template is
   included in the visible part of the formal package. If the copied
@@ -106,10 +110,6 @@
   of the primitive subprograms of the formal type are also included in
   the visible part of the formal package.
 
- [NOTE: I was supposed to fix something in this paragraph to allow
-  formal.formal.xxx to work, but I can't remember the problem or
-  the solution anymore!  Does anyone have an example?]
-
 !discussion
 
 This is intended to be a natural generalization of the two capabilities
@@ -133,7 +133,7 @@
     generic
         ...
         with package FP is new GP (T1, others => <>);
-            -- Can use FP.U, canŐt use FP.T.
+            -- Can use FP.U, cannot use FP.T.
 
 So FP.F2 is OK, and FP.F1 is illegal. Thus the 12.7(10) wording has been
 adjusted so as to include copies of primitive operations.
@@ -166,9 +166,9 @@
 ---------
 
 Note that this exact situation came up while I was
-working on the physical units AI.  I wanted to pull
+working on the physical units AI. I wanted to pull
 out some of the nested generics from the large "System_Of_Units"
-generic.  This would require the Unit_Signature generic
+generic. This would require the Unit_Signature generic
 signature to have at least one additional parameter,
 the Names_Of_Dimensions:
 
@@ -193,7 +193,7 @@
 end Product_Unit;
 
 I would need to be sure that the Names_Of_Dimensions types were
-the same.  With the Ada 95 rule, I would have to pass in all of the
+the same. With the Ada 95 rule, I would have to pass in all of the
 other parameters separately to be able to force a match on
 just one of them:
 
@@ -216,9 +216,68 @@
 four additional formal parameters and then a largely redundant
 signature instance as well.
 
+!corrigendum 12.7(3)
+
+@drepl
+@xcode<@fa<formal_package_actual_part ::=
+    (<@>) | [generic_actual_part]>>
+@dby
+@xcode<@fa<formal_package_actual_part ::=
+    (<@>)
+  | [generic_actual_part]
+  | ([generic_association {, generic_association},] >@ft<@b<others>>@fa< =@> <@>)>>
+
+Any positional @fa<generic_association>s shall precede any named
+@fa<generic_association>s.
+
+!corrigendum 12.7(5)
+
+@drepl
+The actual shall be an instance of the template. If the
+@fa<formal_package_actual_part> is (<@>), then the actual may be any instance
+of the template; otherwise, each actual parameter of the actual instance shall
+match the corresponding actual parameter of the formal package (whether the
+actual parameter is given explicitly or by default), as follows:
+@dby
+The actual shall be an instance of the template. If the
+@fa<formal_package_actual_part> is (<@>) or (@b<others> =@> <@>), then the
+actual may be any instance of the template; otherwise, certain of the actual
+parameters of the actual instance shall match the corresponding actual
+parameter of the formal package, determined as follows:
+
+@xbullet<If the @fa<formal_package_actual_part> includes
+@fa<generic_association>s as well as "@b<others> =@> <@>", then only the
+actual parameters specified explicitly in these @fa<generic_associations> are
+required to match;>
+
+@xbullet<Otherwise, all actual parameters shall match, whether the actual
+parameter is given explicitly or by default.>
+
+The rules for matching of actual parameters between the actual instance
+and the formal package are as follows:
+
+!corrigendum 12.7(10)
+
+@drepl
+The visible part of a formal package includes the first list of
+@fa<basic_declarative_items> of the @fa<package_specification>. In addition,
+if the @fa<formal_package_actual_part> is (<@>), it also includes the
+@fa<generic_formal_part> of the template for the formal package.
+@dby
+The visible part of a formal package includes the first list of
+@fa<basic_declarative_items> of the @fa<package_specification>. In addition,
+for each actual parameter that is not required to match, a copy of the
+declaration of the corresponding formal parameter of the template is
+included in the visible part of the formal package. If the copied
+declaration is for a formal type, copies of the implicit declarations
+of the primitive subprograms of the formal type are also included in
+the visible part of the formal package.
+
 
 !ACATS test
 
+Create an ACATS test to check this feature.
+
 !appendix
 
 From: Tucker Taft
@@ -236,3 +295,65 @@
 [Editor's note: This is version /03 of the AI.]
 
 ****************************************************************
+
+From: Mario Amado Alves
+Semt: Tuesday, September 30, 2003 1:04 PM
+
+In Ada 95 the formal_package_actual_part is either the box or it must
+list *all* the type parameters (Note 1). But sometimes a partial list
+would be useful:
+
+generic
+  type Formal_1 is private;
+  type Formal_2 is private;
+  ...
+package Template is ... end;
+
+type Special_Actual is ...;
+
+generic
+  with package Special_Template is
+    new Template
+      (Formal_1 => Special_Actual); -- PARTIAL LIST HERE (NOTE 2)
+  ...
+package Generic_Special_Unit is ... end;
+
+package Special_Template is
+  new Template
+    (Formal_1 => Special_Actual, Formal_2 => ..., ...);
+
+package Special_Unit is
+  new Generic_Special_Unit
+    (Special_Template, ...);
+
+This only requires modification to 12.7. If there is interest I'll try
+to formalize an AI. Thanks.
+
+NOTES
+
+1. See RM 12.7 (3). I don't find this required completness a clear
+ramification, but that is another story.
+
+2. Not Ada 95. Alternate syntaxes (also not Ada 95):
+  (Formal_1 => Special_Actual, <>);
+  (Formal_1 => Special_Actual, others => <>);
+
+****************************************************************
+
+From: Randy Brukardt
+Semt: Tuesday, September 30, 2003  5:53 PM
+
+This is AI-317. Please check for existing AIs before starting new
+discussions; it just makes more work for me. (Of course, comments on
+existing AIs are fine.)
+
+****************************************************************
+
+From: Mario Amado Alves
+Semt: Tuesday, September 30, 2003  6:27 PM
+
+Indeed it is! Thanks. I do search the AIs before posting, but on this
+case it seems I missed it for some reason. Sorry.
+
+****************************************************************
+

Questions? Ask the ACAA Technical Agent