News for hackers. Stuff that matters.
Re:Java Generics Are Turing Complete by MereInterest on Thursday May 26, 2016 @11:04PM (#11783620)
Type erasure also makes some forms of function overloading impossible.

    void func(List<ClassA> list);
    void func(List<ClassB> list);
Using type erasure, I cannot specify functions that are overloaded based on the generic type of an argument. To the runtime, both of these accept an argument of type List<Object>, and so it is ambiguous which one to call.

In C++, which does not use type erasure, this sort of function overloading works as expected.

There are no comments on this comment yet.