|
|
|
|
|
by bad_user
5916 days ago
|
|
Java's Generics are awful because they are useless, while being the most complex feature added to Java. Templates in C++ or the generic types from Haskel enable parametric polymorphism which is a lot more elegant for certain problems than subtype-polymorphism (i.e. OOP). Java's generics is only a hack to make it look as though some piece of code that's using subtype-polymorphism is parametric ... but it only saves you explicit type-casts, which are also useless. dotNet's generics are different ... while sharing the same limitations (i.e. no late binding and not implicit interfaces), because the types are available at runtime the runtime dispatches being made aren't just hacks and you can use the reflection mechanism to workaround many of the problems associated. |
|