State of the Lambda
Brian Goetz
brian.goetz at oracle.com
Thu Jul 8 14:37:22 PDT 2010
>> I'm a little bit worried that method references with receiver variables do
>> an copy. ... A possible solution is to require such receiver
>> variables to be (implicitly) final.
>
> This is one of those times where syntax might imply something deep about an expression. Brian's sketch uses a prefix "#" to introduce a method lifted to a function (and perhaps partially applied to a receiver).
>
> The prefix looks like it might govern the evaluation of the expression to the right. An infix operator would much more clearly express that the left hand side of the expression (at least) is evaluated in the normal left-to-right order of Java expressions. (Some infix operators, ?:&& || have special rules for evaluation order, but it only applies to the right of the operator.)
My intention for method refs for non-static methods is that the receiver
reference is evaluated and copied (likely as part of the method handle
binding); this is a binding of a method handle with a specific receiver, not
syntactic sugar for "whatever the receiver happens to be at the time the
lambda is invoked, call it."
More information about the lambda-dev
mailing list