3 ms·
The only thing better than unification is semi-unification. The fact that semi-unification is a lot harder than unification has meant that imperative OO languag
by seanmcdirmid 12y ago
The only thing better than unification is semi-unification. The fact that semi-unification is a lot harder than unification has meant that imperative OO languages get the shaft with poorer type inference support: both assignment and subtyping are inequalities! What Scala has done with least-upper bounds is absolutely heroic in that context even if it does work better for its functional parts.
- tomp 12y agoI'm not sure if "better" is appropriate in this context; in general, semi-unification is undecidable. Type checking in presence of subtypes is decidable for simple cases (where types form a lattice), but the presence of polymorphism/generics makes it undecidable (Java [1], OCaml[2]). The type inference algorithms for subtyping are not that performant (an algorithm is described in [3]). [1] http://stackoverflow.com/questions/23939168/is-c-sharp-type-system-sound-and-decidable http://stackoverflow.com/questions/23939168/is-c-sharp-type-... [2] http://caml.inria.fr/pub/old_caml_site/caml-list/1507.html http://caml.inria.fr/pub/old_caml_site/caml-list/1507.html [3] http://www.normalesup.org/~simonet/publis/simonet-aplas03.pdf http://www.normalesup.org/~simonet/publis/simonet-aplas03.pd...