Extension methods vs arrays...

Neal Gafter neal at gafter.com
Mon Dec 14 07:38:28 PST 2009


The primary motivation for extension methods appears to be more convenient
expression of concurrent operations on aggregates.  Although I see much more
potential for them, I don't see how the current strawman can be used to
define (for example) a "reduce" operation on arrays.  That is, how would we
express this

*int reduce(int[] array, #int(int,int) combine) { ... }
*

as an extension method, so it could be used to sum the data in the array
*
*
*int[] data = ...;
int result = data.reduce(#(**int **x, **int **y)x+y);**
*

Cheers,
Neal


More information about the lambda-dev mailing list