Removal of function types
Reinier Zwitserloot
reinier at zwitserloot.com
Wed Jul 7 16:35:33 PDT 2010
How timely, I was just about to post with the same thing.
This latest round of lambda proposals obviously has my stamp of approval, as
it's a virtual carbon copy of a proposal I put out on the lombok mailing
list about a year ago, though I admit the inference of parameter types part
of it is nifty and in retrospect perhaps an obvious next move once one has
already accepted the burden of mandatory immediate conversion to an existing
SAM type.
The obvious solution to address situations such as the ParallelArrays.Ops
explosion is to allow primitives in generics.
This isn't _that_ difficult; I posted a proposal to this very list a while
ago with a relatively simple scheme, that would nevertheless fit both
primary requirements for PA.Ops:
- It allows you to eliminate the vast majority of PA.Ops's SAM types,
leaving only the basic set (Reducer, Filter, etc, no more specializations
such as LongReducer).
- Using a primitive PA with e.g. a Reducer<long> instead of LongReducer
will achieve roughly the same performance, both CPU and memory wise.
NB: And as I'm writing this, Brian chimes in that it would be way out of
scope for JDK7. Well, specialization might be, but specialization isn't
necessary. I'll reread my own proposal, update it where necessary, and
repost it.
--Reinier Zwitserloot
On Thu, Jul 8, 2010 at 1:17 AM, Nathan Bryant
<nathan.bryant at linkshare.com>wrote:
> Perhaps there is an alternative middle ground, that would provide
> function types but make them look like SAM's: variadic generics.
>
> Wink wink, nudge nudge.
>
>
> -----Original Message-----
> From: lambda-dev-bounces at openjdk.java.net
> [mailto:lambda-dev-bounces at openjdk.java.net] On Behalf Of Doug Lea
> Sent: Wednesday, July 07, 2010 7:06 PM
> To: lambda-dev at openjdk.java.net
> Subject: Re: Removal of function types
>
> On 07/07/10 13:18, Stephen Colebourne wrote:
> > I suggest using this thread to comment on the removal of function
> types :-)
> >
>
> As one of the instigators-by-counter-example of function types,
> I do wonder what the plan is for providing dozens if not
> hundreds of SAM types for (parallel) aggregate operations.
> As in my infamous workarounds at:
> http://gee.cs.oswego.edu/dl/jsr166/dist/extra166ydocs/extra166y/Ops.html
>
> -Doug
>
>
>
>
More information about the lambda-dev
mailing list