CVS difference for ai12s/ai12-0360-1.txt

Differences between 1.1 and version 1.2
Log of other versions for file ai12s/ai12-0360-1.txt

--- ai12s/ai12-0360-1.txt	2020/02/05 06:33:49	1.1
+++ ai12s/ai12-0360-1.txt	2020/02/20 03:49:04	1.2
@@ -395,3 +395,63 @@
 OK, thanks for your feedback.
 
 ****************************************************************
+
+From: Randy Brukardt
+Sent: Wednesday, February 19, 2020  4:46 PM
+
+Some private discussion reminded me of a thought that I never wrote down on an older proposal...
+
+Back in December, Tucker Taft wrote:
+
+... 
+> While putting together some slides about the "procedural iterator" 
+> (http://www.ada-auth.org/standards/2xaarm/html/AA-5-5-3.html)
+> I realized that there is a very similar case which comes up very 
+> often, at least in my code, which might also benefit from the 
+> procedural iterator syntactic sugar.  In particular, I have many, many 
+> instances of generic (iterating) procedures that have exactly one 
+> generic formal parameter, which is a formal procedure.
+...
+> This is quite similar to the situation of calling an iterating 
+> procedure that has a single access-to-procedure parameter, plus  zero 
+> or more other parameters.  So perhaps the same syntactic sugar should 
+> apply.
+
+I think the basic idea is sound, but I'm rather dubious of letting it apply
+*only* to generics with *exactly* one generic formal parameter. This seems more
+like a hack than a considered feature.
+
+I've seen iterator generics with other formal parameters, and it would be 
+annoying to prevent the use of the "sugar" just because someone decided to use 
+a generic formal parameter rather than a subprogram parameter for setting 
+bounds:
+
+   generic
+      Low, High : in Key_Type;
+      with procedure Action (Key : Key_Type; Value : Value_Type);
+   procedure Search_Key_Range (Obj : Structure_Type);
+
+Here we have an iterator that returns all of the key, value pairs whose keys 
+are between the First and Last key values. But your proposed sugaring wouldn't
+work.
+
+Similarly, if the iterator was constructed outside of the structure's package, 
+one might have something like:
+
+   generic
+      with package Struct is new Structure_Generic (<>);
+      with procedure Action (Key : Struct.Key_Type; Value : Struct.Value_Type);
+   procedure Search_Key_Range (Obj : Struct.Structure_Type);
+
+If we don't allow some other parameters, then such iterators would necessarily 
+have to be inside of the package defining the structure; end users couldn't 
+create their own. Note that the access-to-subprogram iterator can have 
+arbitrary other parameters so end users can create there own with some care.
+
+So it seems to me that this sort of thing needs to (optionally) include a full 
+instance and <> parameter much like the existing form of this sort of iterator.
+
+Of course, that sort of requirement complicates the definition, but it seems 
+too special case without that.
+
+****************************************************************

Questions? Ask the ACAA Technical Agent