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

Differences between 1.6 and version 1.7
Log of other versions for file ai12s/ai12-0190-1.txt

--- ai12s/ai12-0190-1.txt	2018/03/02 03:17:49	1.6
+++ ai12s/ai12-0190-1.txt	2018/03/30 07:55:08	1.7
@@ -1811,3 +1811,66 @@
 /04 of the AI - ED.]
 
 ****************************************************************
+
+From: Brad Moore
+Sent: Friday, March 2, 2018  11:32 PM
+
+I like the idea of function expressions overall. I have just a couple of
+comments.
+
+>> We are only supporting defining anonymous functions using this 
+>> proposed "function_expression" construct.  Anonymous procedures are 
+>> nicely handled with the loop-body proposal (AI12-0189).
+
+Not really. The loop-body proposal only applies to a limited subset of cases
+where anonymous procedures could be used. Those where the anonymous procedure
+is the body of the loop. Not all anonymous procedures fit this use case.
+
+For example, for 'Reduce we were talking about allowing a reducer in the form
+of a procedure of the form;
+    procedure Reduce (L : in out Item, R : Item);
+
+which might be appropriate when Item is a large matrix type.
+
+It might be nice to write a combiner function as a function expression in some
+cases, for instance, which I presume would be allowed by the AI, (for
+combiners that are functions). Similarly, I presume one could use function 
+expressions for generic actuals when instantiating a generic. 
+
+eg. See below
+
+>> In any case, mixing
+>> statements inside expressions seems like a bad idea.  Also, we don't 
+>> have "expression procedures" so it doesn't seem so bad that we don't 
+>> have "procedure expressions" ;-).
+
+This seems like the better argument.
+
+>> !example
+>> 
+>>    --  Replace control chars with '?'
+>>    Ada.Strings.Fixed.Translate
+>>      (Str, (function (C) return (if C < ' ' then '?' else C)));
+>> 
+>>    --  Procedure for plotting a function
+>>    procedure Plot_Graph
+>>      (Fun : access function (X : Float) return Float;
+>>       Start, Stop : Float);
+>> 
+>>    ...
+>> 
+>>    --  Plot a graph of X-squared from 1 to 20
+>>    Plot_Graph (Fun => (function (Z) return Z**2),
+>>                Start => 1.0, Stop => 20.0);
+>> 
+
+I have another example for consideration.
+
+   subtype Degrees is Integer;
+
+   -- Instantiate a list of degree values of a circle, eg. -1 = 359 = 720
+   package Degree_Lists is new
+     Ada.Containers.Doubly_Linked_Lists (Element_Type => Degrees,
+                                         "="          => (function (L, R) return (L mod 360 = R mod 360)));
+
+****************************************************************

Questions? Ask the ACAA Technical Agent