Exception transparency
Nathan Bryant
nathan.bryant at linkshare.com
Tue Jun 8 08:21:41 PDT 2010
Brian Goetz wrote:
> Consider a method like List.forEach(). If forEach() has to assume the
worst
> (impurity), then forEach() must be sequential. But that is terrible!
Adding
> closures and not allowing the possibility of parallel iteration? Not
OK.
A nice idea but not workable. Sometimes we really do want to parallelize
things that either affect shared state, perform I/O, or both. Such
operations can frequently encapsulate the state in such a way that they
are -relatively- pure, but adding static type checking of such
"relative" pureness is not going to be workable at least not in a way
that the average programmer can understand.
Views are the way:
Iterable.par().forEach()
Iterable.seq().forEach()
More information about the lambda-dev
mailing list