Re:An Experimental New Type Inference Scheme for Rust
by wyager on Wednesday July 09, 2014 @09:09PM
(#8013070)
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.
[ Parent
| on HN ]
Re:An Experimental New Type Inference Scheme for Rust
by pcwalton on Wednesday July 09, 2014 @11:26PM
(#8013438)
The 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.
Re:An Experimental New Type Inference Scheme for Rust
by freyrs3 on Thursday July 10, 2014 @01:11AM
(#8013720)
Unidirectional 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.