Parallel collections (was Re: Exception transparency)

Alessio Stalla alessiostalla at gmail.com
Tue Jun 8 10:34:59 PDT 2010


On Tue, Jun 8, 2010 at 7:12 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> What can we do to help programmers keep track of which closures are
> "parallel-safe" and which not?

How can you do that in the general case? Does today's Java (or any
other language) help programmers keep track of which
methods/functions/classes/whatever are "parallel-safe"? For example,
is a closure accessing and mutating a shared ConcurrentMap
parallel-safe or not?

In short: don't do that. Make it simple for programmers to write
closures and to map them over collections, sequentially or in
parallel. Let the programmers figure by themselves if they got the
parallelism wrong, and how to fix it. Too much magic will only
boomerang on you. Imho, of course :)

Cheers,
Alessio


More information about the lambda-dev mailing list