State of the Lambda

Brian Goetz brian.goetz at oracle.com
Thu Jul 8 12:44:12 PDT 2010


> One question wrt method references: do you intend to support "unbound"
> references to to instance methods? The use case being a shorter syntax
> to define expression lists in query like expression. I.e. With the
> current proposal I guess I could have an expression like this:
>
>      select<Person>({ p ->  p.getName() }, { p ->  p.getAge() }).from(persons)
>
> A use case I imagine won't be to uncommon. F.ex. in our system we have
> resorted to strings and reflection to select properties from objects.
>
>      select("name","age").from(persons)
>
> By "unbound" method reference I thus mean any syntactic sugar that
> shortens the syntactic distance between the two expressions.

What I think you are asking for is something like "field references" to go 
along with "method references".  I can definitely see the utility of such a 
thing.  We did indeed consider this when we considered method references, but 
chose to leave it out at this time and revisit in the future.



More information about the lambda-dev mailing list