Syntax for method references

Dan Smith daniel.smith at oracle.com
Wed Oct 26 15:48:13 PDT 2011


Even worse (or maybe just as bad -- I'm not immediately seeing the generic thing as catastrophic), it's ambiguous:

x->y

Is this a lambda expression or a method reference?

—Dan

On Oct 26, 2011, at 1:38 PM, Brian Goetz wrote:

> It is perfect, until you realize it is unworkable; you need room for generic type arguments on both sides:
> 
>  foo-><T>bar
> 
> or
> 
>  foo<T>->bar
> 
> At which point you give up on that approach.  
> 
> 
> 
> On Oct 26, 2011, at 12:39 PM, Serge Boulay wrote:
> 
>> I liked the syntax shown at the 2011 JVM language summit
>> 
>> Predicate<> p = String->isEmpty
>> 
>> http://www.wiki.jvmlangsummit.com/images/a/a1/2011_Goetz_Extension_Slides.pdf
>> 
>> On Wed, Oct 26, 2011 at 3:17 PM, Bob Foster <bobfoster at gmail.com> wrote:
>> 
>>> On Tue, 25 Oct 2011 15:01:21 -0700 (whew!) Brian Goetz wrote:
>>> 
>>> Oh, good. The dreaded :: from C++. :)
>>> 
>>> Bob
>>> 
>>>> This is the current front-runner.
>>> 
>>>> On Oct 25, 2011, at 9:26 AM, Stephen Colebourne wrote:
>>>>> Is this now decided? Or just an experiment?
>>>>> 
>>> http://www.ibm.com/developerworks/java/library/j-ldn3/index.html?ca=drs-
>>>>> 
>>>>> Collections.sortBy(people, Person::getLastName);
>>>>> people.sortBy(Person::getLastName);
>>>>> 
>>>>> Stephen
>>>>> 
>>> 
>>> 
>> 
> 
> 



More information about the lambda-dev mailing list