Bitten by the lambda parameter name
esko.luontola at gmail.com
Sat Sep 7 09:54:02 PDT 2013
Brian Goetz wrote on 7.9.2013 1:36:
> True. But also realize that lambdas that declare locals are already
> veering into corner-case territory. I did a quick search through lambda
> expressions in the JDK source base (which is a significant fraction of
> the lambda expressions in Java code worldwide, at this point), and found
> NO instances of lambdas that declare locals.
> I'm not saying it can't or won't happen, I'm saying it will be rare.
> So, this "but its also an issue for local variables in lambdas" argument
> doesn't really change the balance on this subject at all. Next case!
Here is an example of using local variables in lambdas: testing frameworks.
If you look at Scala's testing frameworks (ScalaTest, specs, specs2),
they wrap test code into lambdas (instead of methods) and there local
variables are very common. And already now the Specsy testing framework
 supports Java and results in lots of nested lambdas . I believe
that after JDK 8 is released, lambdas will change the way Java code is
written and there will be lots of new use cases and libraries.
 http://specsy.org/ - written by me
 Its Java syntax is
More information about the lambda-dev