State of the Lambda

Brian Goetz brian.goetz at oracle.com
Thu Jul 8 14:57:01 PDT 2010


> No, I think he means the difference between the unbound String#length() which is of type (String)->int and the bound "myString"#length(), which is of type ()->int.  The latter is derived by a partial-application operation from the former.  John's example uses the unbound version, while other use cases (event handlers, e.g.) would use the bound version.
>
>>      select<Person>({ p ->   p.getName() }, { p ->   p.getAge() }).from(persons)
> =>
>      select<Person>(Person#getName(), Person#getAge()).from(persons)

Ah, I see.  Nice idea.

> Requiring the trailing parens makes it slightly more clear that a method is being mentioned, since identifier-followed-by-paren is a cue Java programmers know very well.  I chose a wildcard-like notation Foo#bar(...) to mean "find the unique 'bar' method".  But that's a relatively unimportant detail, compared to getting the bound-vs.-unbound distinction right.

Yep, and not too burdensome.


More information about the lambda-dev mailing list