CVS difference for ais/ai-00348.txt

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

--- ais/ai-00348.txt	2003/09/11 21:53:06	1.2
+++ ais/ai-00348.txt	2003/09/11 21:59:43	1.3
@@ -88,15 +88,20 @@
 
     A subprogram_default of null shall not be specified for a formal function.
 
-Add after 12.6(10)
+  Add after 12.6(10)
 
-    If a generic unit has a subprogram_default specified by a null, and the
-    corresponding actual parameter is omitted, then it is equivalent to
-    an explicit actual parameter that is an anonymous null procedure having
-    the profile given in the formal_subprogram_declaration. The anonymous null
-    procedure is implicitly declared immediately before the instantiation.
-    The anonymous null procedure is not a primitive subprogram of any type.
+    If a generic unit has a subprogram_default specified by the reserved word
+    null, and the corresponding actual parameter is omitted, then it is
+    equivalent to an explicit actual parameter that is a null procedure having
+    the profile given in the formal_subprogram_declaration.
+
+  Add after 12.6(16)
+
+    If a generic unit has a subprogram_default specified by the reserved word
+    null, and the corresponding actual parameter is omitted, then the calling
+    convention of the actual parameter is Intrinsic (see 6.3.1).
 
+
 !discussion
 
 Like an instantiation, a null procedure is not allowed as a completion.
@@ -322,6 +327,135 @@
 This seems overly complicated.  Why do we care where the actual
 is declared, or what is its name?  All we need to say is that
 it is a procedure whose body has no effect when invoked.
+
+****************************************************************
+
+From: Stephen W Baird
+Sent: Friday, September 5, 2003  2:02 PM
+
+Steve said:
+>>     A subprogram_default of null shall not be specified
+>>     for a formal function.
+
+Tuck said:
+> This probably belongs in the Syntactic rules rather than
+> in the Legality rules, since it requires no semantic
+> information.
+
+Out-mode parameters for functions are disallowed via a legality rule
+(6.1(18)). This could have been done as a syntax rule, but the solution
+that was chosen seems cleaner. I think the situation with null defaults
+for formal subprograms is similar.
+
+Steve said:
+>>     If a generic unit has a subprogram_default specified by a null, ...
+
+Tuck said:
+>    "... specified by the reserved word null, ..."
+
+Agreed.
+
+Steve said:
+>>     ... and the corresponding actual parameter is omitted, then it is
+>>     equivalent to
+>>     an explicit actual parameter that is an anonymous null procedure
+>>     having the profile given in the formal_subprogram_declaration. The
+>>     anonymous null procedure is not a primitive subprogram ...
+
+Tuck said:
+> This seems overly complicated.  Why do we care where the actual
+> is declared, or what is its name?  All we need to say is that
+> it is a procedure whose body has no effect when invoked.
+
+I think you are right, and these null subprograms should be treated more like
+subprogram-valued attributes (which don't really have a declaration point).
+
+I was concerned about something like
+
+    generic
+      with procedure Proc is null;
+    package G is
+      procedure Proc_Rename renames Proc;
+    end G;
+
+    type Ref is access procedure;
+
+    package I is new G;
+
+    Ptr : Ref := I.Proc_Rename'Access;
+
+where we would need to know the accessibility level of the
+procedure, but this is solved by noting that these null
+procedures have a convention of Intrinsic (see 6.3.1(7)).
+
+Below is a revised attempt. Is the note necessary? [This is version /03 - ED.]
+
+****************************************************************
+
+From: Tucker Taft
+Sent: Friday, September 5, 2003  3:24 PM
+
+> Out-mode parameters for functions are disallowed via a legality rule
+> (6.1(18)). This could have been done as a syntax rule, but the solution
+> that was chosen seems cleaner. I think the situation with null defaults
+> for formal subprograms is similar.
+
+It is not a big deal, but I didn't mean that you would write a BNF
+rule for it, but rather just put the exact same wording in a paragraph
+in the Syntax part of 12.6.  You may not be aware of this, but
+we do have narrative syntax rules.  Take a look at record aggregates,
+4.6.1.  You will see a couple of paragraphs after the BNF that
+are considered syntax rules.  In array aggregates (4.6.2), there
+is a similar syntax-rule paragraph.  Generally it was considered
+preferable to group such paragraphs under Syntax rules if they
+were truly independent of name resolution or other semantic
+considerations.
+
+
+>   Add after 12.6(10)
+>
+>     If a generic unit has a subprogram_default specified by the reserved word
+>     null, and the corresponding actual parameter is omitted, then it is
+>     equivalent to an explicit actual parameter that is a null procedure
+>     having the profile given in the formal_subprogram_declaration.
+
+I presume you have defined "null procedure" somewhere.
+
+
+> Notes
+>   Add after 12.6(16)
+>
+>     If a generic unit has a subprogram_default specified by the reserved word
+>     null, and the corresponding actual parameter is omitted, then the calling
+>     convention of the actual parameter is Intrinsic (see 6.3.1).
+
+It might be better to say that "... the reserved word null, then in
+an instance where the corresponding actual parameter is omitted, the
+formal subprogram has convention Intrinsic (see 6.3.1)."   (It is
+not possible to refer directly to the actual parameter.)
+
+****************************************************************
+
+From: Stephen W Baird
+Sent: Friday, September 5, 2003  4:20 PM
+
+> You may not be aware of this, but we do have
+> narrative syntax rules.
+
+I didn't know that. I agree, my proposed Legality
+Rule should be a Syntax Rule instead.
+
+> I presume you have defined "null procedure" somewhere.
+
+Yeah. We're discussing the tail end of a larger AI in
+which null procedures are defined.
+
+> It might be better to say that "... the reserved word null, then in
+> an instance where the corresponding actual parameter is omitted, the
+> formal subprogram has convention Intrinsic (see 6.3.1)."   (It is
+> not possible to refer directly to the actual parameter.)
+
+Ok by me.
 
 ****************************************************************
 

Questions? Ask the ACAA Technical Agent