Design for collections upgrades
brian.goetz at oracle.com
Tue Mar 8 10:36:48 PST 2011
> Very nice. I'm curious about the exception declaration in the
> streaming model.
This is an open issue. There is an outline for Exception Transparency
linked from the latest State of the Lambda that outlines one possible
approach which would play nicely with checked exceptions, at the cost of
some complexity (in the form of more pointy-bracket craziness (though
hopefully mostly inferred by the compiler)). An alternative that some
have suggested is to define the standard SAM types to throw nothing, and
let lambdas use unchecked exceptions. (The difference between the two
is the age-old checked-vs-unchecked exceptions debate.)
Both are credible alternatives; most filter/map/reduce lambdas will not
throw checked exceptions (though forEach lambda arguments might well,
since that relies on side-effects to do anything.) Stay tuned.
> Also, would you consider adding list comprehension syntax, which would
> de-sugar to the serial/eager version:
I'll be honest: no chance of this for Java 8. And not on the radar for
after that, either. Our approach to language evolution here is to add
the features needed to support library evolution.
More information about the lambda-dev