Expected distribution of lambda sizes (Re: Syntax poll, take 2)

Brian Goetz brian.goetz at oracle.com
Wed Jun 15 10:25:09 PDT 2011


Exactly right.  There are multiple competing ideas of what the 
abbreviated method reference #foo should mean.  For now, we're just not 
going to assign any meaning to it.  When we get to the point that the 
meaning of the shorthand form #foo is the most important thing to work 
out, we'll truly be justified in declaring victory!

On 6/15/2011 11:37 AM, Maurizio Cimadamore wrote:
> On 15/06/11 16:00, John Nilsson wrote:
>> On Wed, Jun 15, 2011 at 4:13 PM, Maurizio Cimadamore
>> <maurizio.cimadamore at oracle.com>   wrote:
>>> <T, V extends Comparable<T>>   List<V>   schwarz(List<T>   x, Function<T,
>>> Pair<T,V>>   f) {
>>>         return map(#{ w ->   f.apply(w) }, x)
>>>            .sort( Pair<T,V>#fst() )
>>>            .map( Pair<T,V>#snd() );
>>>      }
>> Could this become the following even?
>>
>> <T, V extends Comparable<T>>
>> List<V>   schwarz(List<T>   x, Function<T,Pair<T,V>>   f) {
>>         return x.map(f).sort(#fst).map(#snd);
>>      }
> I see where you are headed, you want to use the target type in order to
> infer the receiver type of the method reference; while this seems a nice
> idea in principle, a problem I see with this is the potential ambiguity
> with this#foo (which people might want to be able to shorten to just #foo).
>
> Maurizio
>>
>> BR,
>> John
>
>


More information about the lambda-dev mailing list