Parallel-safe lambdas
Mark Thornton
mthornton at optrak.co.uk
Thu Feb 11 02:12:10 PST 2010
Olivier Allouch wrote:
> Ouch !
>
> I, like Stephen Colebourne, am surprised. I thought the goal was to add
> closures to the language, not to a single library.
>
I'm not sure why you are surprised given that the closures exercise was
restarted with this:
http://blogs.sun.com/mr/entry/closures
The motivation is clearly to aid use of parallelism. Now this doesn't
mean that many ordinary programmers will be writing parallel code, but
that more API may use parallel implementations. So if someone uses
Collections.sort or Arrays.sort, the implementation may be parallel if
the size warrants it.
For API taking lambda parameters it would be desireable to be able to
mark such parameters as 'restricted' in some way. Or perhaps have
lambdas that satisfy appropriate concurrency rules implement some marker
interface. The API could then use a parallel implementation for such
marked lambdas. The user can then be largely oblivious to the
concurrency issues, while leaving the likes of Doug Lea to provide high
performance implementations.
Mark Thornton
More information about the lambda-dev
mailing list