> Casper, Java 8 lambdas are completely backwards compatible with Java 1.1 
> style lambda APIs. I don't see what else they could do without breaking 
> backward compatibility. The final requirement on outer variable capture is 
> there on purpose because it prevents a lot of common mistakes like this: 
> http://blog.roboblob.com/2012/09/30/dot-net-gotcha-nr2-loop-variables-and-closures/
>

Yeah I guess there's enough reflection code, relying on classpath discovery 
(even if an SPI approach is so much cleaner) that it would cause trouble - 
even for a compile target 1.8.

While I have often been annoyed at the hoist-to-heap tricks you have to go 
through in Java to close over a variable rather than a (copy of a) value, 
it makes sense for there to be two distinct mechanisms (close over value 
with Java 1.1 lambda's, close over variables with Java 1.8 lambdas). 
Ironically, C# went the other way and just recently added "close over 
value" support for the foreach idiom in 5.0.

-- 
You received this message because you are subscribed to the Google Groups "Java 
Posse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/javaposse?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to