Preparing for the 0.2 draft

Alex Buckley Alex.Buckley at Sun.COM
Fri Jan 29 00:56:46 PST 2010


Many thanks for everyone's comments on the 0.1 draft. The "foo.()" 
invocation syntax looks like a winner, and I am seriously considering 
rearranging the function type syntax to have argument types first. 
Requiring a lambda expression to denote its return type is also 
increasingly appealing. SAM classes are staying for now.

The discussion of transparent 'this' v. non-transparent 'this' comes 
down to the question of what a lambda in Java is for. (Zdenek Tronicek 
ably made this point earlier.) Part of the answer lies in understanding 
when to use an anonymous inner class and when to use a lambda 
expression. A step towards that understanding would be knowing how 
anonymous inner classes are used today.

It would be very interesting if list members could provide the following 
statistics for codebases with which they are familiar:

- What %age of anonymous inner classes declare a single non-Object method?
- What %age of single-method anonymous inner classes declare fields?
- What %age of single methods in anonymous inner classes use 'this'?
- What %age of single methods in anonymous inner classes recurse?
- Are the %ages different for anonymous inner classes that implement an 
interface v. that extend a class ?

(As well as anonymous inner classes, any utility class that 
implements/extends a SAM type is of interest, such as this nested class 
from the extra166y.ParallelArray Javadoc:
   static final class IsSenior implements Predicate<Student> {
      public boolean op(Student s) { return s.credits > 90; }
    }
)

Alex


More information about the lambda-dev mailing list