Reuse 'do' keyword instead of hash sign (#)

Brian Goetz brian.goetz at oracle.com
Mon Jun 20 06:38:38 PDT 2011


 > I think you misunderstood me, I suppose it really depends on whether
 > you conceptually consider lambda expressions to be objects and thus
 > typed, or you don't. Which I, for right or wrong do.

I would say that intuition will work against you in the long run.

Lambda expressions are not objects.  They don't have an object identity. 
  The 'this' keyword, if it means anything in the context of a lambda, 
is the *enclosing* object, not the target of the SAM conversion.

Lambda expressions are *converted to* an object -- an instance of a SAM 
type.  (A reasonable analogy is the type of 'null' -- null is 
assignment-compatible with multiple reference types, but is not 
intrinsically of type Object.)  The object-nature of this converted 
value is not discernable from within the lambda -- and eventually will 
be optimized away by the VM.

In a future possible version of Java that has reified function types, 
lambda expressions will be function-typed, and functions are not 
(necessarily) objects.




More information about the lambda-dev mailing list