Hacker News new | ask | show | jobs
by seanmcdirmid 3666 days ago
No one has really figured out nominal subtyping + type parameters with good type inference support. The best we can achieve seems to be scala, which still requires more type annotations than many are comfortable with.
1 comments

I'm not sure what you're talking about. Can you please elaborate?
The real issue is not nominal vs structural typing. Its the subsumption rule (which says that you can freely use a subtype anywhere a supertype would be expected).

Mixing subtyping with subsumption and parametric polymorphism (type parameters) is really very difficult though. From a theoretic point of view, type inference and type checking are harder. From an usability perspective, the programmer now has to deal with variance annotations (for example, in Java `class List[+T]` means the T parameter is covariant) and bounded polymorphism (for example, things like <? extends T> in Java).