4 ms·
> Type inference in the presence of OOP-style subtyping was largely considered to be impossible in 2005 Type inference in a OO language is still considered, if
by tomp 11y ago
> Type inference in the presence of OOP-style subtyping was largely considered to be impossible in 2005
Type inference in a OO language is still considered, if not impossible, at least very impractical. Swift, Scala and Rust avoid most algorithmic complexity and ambiguity by mostly supporting only type propagation instead of type inference, and thus require annotations on function parameters.
- nostrademons 11y agoThe big innovation there is in realizing that's enough. When I was into language design from 2004-2007, language designers usually assumed people wanted full global type inference. It turns out that local type propagation is an effective 80/20 solution for most practical programming tasks, which opened up a lot of hybrid type systems that would've been far too complex before.
- pshc 11y agoYes. A blessing in disguise. In hindsight, global type inference seems too unstable. Too much action at a distance; it's hard to evolve a codebase when local changes cascade. Type annotations keep things grounded.
- jeltz 11y agoWhat about Crystal? It has quite extensive type inference.
- yokohummer7 11y agoUnfortunately they also had to narrow down the scope of type inference recently. IIRC type annotations are now mandatory for class-level variables (member variables). This hindered the "Ruby-like" feeling, but they had to give up global type inference because it costed too much memory in some cases. I got an impression that global type inference is difficult (or, costly) in general.
- sklogic 11y agoNemerle had quite an interesting solution to this problem back then. http://research.microsoft.com/en-us/um/people/moskal/pdf/msc.pdf http://research.microsoft.com/en-us/um/people/moskal/pdf/msc...
- mietek 11y agoYes. It’s worth pointing out that this is the author’s MSc thesis, submitted in 2005.
- humanrebar 11y agoI'm not sure I consider Rust to be object oriented.