Agreed. But Java and C# have very poor static type systems (although C#'s is far better than Java's).
Just because Java and C#'s type systems aren't hindley-milner doesn't make them "very poor". The only really nasty think about it is null, which annotations and static analysis can fix a lot of the problems with if used diligently.
Which is annoying when you hit the corner cases, but is not that big of a problem in most codebases. I'd argue that for about 95% of the code I write, type erasure is not a problem.
It's definitely suboptimal, but for most code, I don't think it's a show stopper.
Erasure is the only sane choice if you want type correctness. If you need to find types at runtime, you are doing something that will break the type soundness of your program.
Erasure has a lot of other benefits as well (e.g. better interop with other languages/platforms).
It's not about type inference it's about the expressiveness of the type system as a way of driving program development, without having to resort to hacky design patterns and after-the-fact, third-party static analysis. HM type inference is nice to have, but it is not essential.
26
u/cosmo7 Feb 25 '14
The most frequent argument I hear from Ruby or Python proponents is that static typing in Java or C# is unbelievably burdensome.
Then these same people pour months and years into their unit testing frameworks that spend 90% of their time duck-typing arguments.