Fun with method references

Neal Gafter neal at gafter.com
Fri Aug 6 20:11:04 PDT 2010


Why are you sending pointers to a proposal that has been shown to be unsound?

-Neal

On Aug 6, 2010, at 9:13 PM, Howard Lovatt <howard.lovatt at gmail.com> wrote:

> @Rémi,
> 
>> Not a good example, in my opinion.
>> using SAM interfaces instead:
>> 
>> interface Foo1 {...}
>> interface Foo2 {...}
>> 
>> void foo(Foo1 foo) { ... }
>> void foo(Foo2 foo) { ... }
> 
> But this is easily resolved with a cast
> 
>> interface Handler<A> {
>>   public int handle(A a);
>> }
>> 
>> void foo(Handler<String> stringHandler) { ... }
>> void foo(Handler<Bar> barHandler) { ... }
> 
> This is the exactly the same problem that happens with erased function types
> and I assume that we don't want is more of these problems. The only way out
> of this problem for function types (and generics) is to reify them:
> 
> http://www.artima.com/weblogs/viewpost.jsp?thread=278567
> 
>  -- Howard.
> 


More information about the lambda-dev mailing list