3 ms·
What would this break, theoretically? It's clearly not as rigorous as something based on HM, but I'm curious what the specific disadvantages are.
by wyager 12y ago
What would this break, theoretically? It's clearly not as rigorous as something based on HM, but I'm curious what the specific disadvantages are.
- pcwalton 12y agoThe article gives an example of a program that fails to typecheck, based on function variance. Note that this algorithm is based on HM. You can't do plain old HM if you have subtyping; you have to do some algorithm based on it. This is just one of many possible algorithms.
- freyrs3 12y agoUnidirectional inference in the presence of subtyping is undecidable in the general case. Languages like Haskell and OCaml don't have this problem because they don't include subtyping precisely for this reason.
- gsg 12y agoOCaml has subtyping: it addresses the undecidability issue by requiring "cast" annotations for some use cases.