| > I don’t understand why… Because dynamic typing has its own advantages, which are worthy of experimentation even if you perceive absence of static typing as a weakness. Gradual typing can offer us the benefits of both worlds. > inferred typing is nearly as easy to use while being more robust. Implementing type inference can be fairly trivial if your types are all disjoint. Hindley-Milner type inference is well studied and there's plenty of literature. But as soon as you introduce subtyping, the traditional methods are not sufficient. It's only in the past decade that good solutions have been discovered, notably Dolan & Mycroft's MLsub[1], based on Dolan's Algebriac Subtyping thesis[2], and Parreaux & Chau's MLstruct[3], which uses a boolean algebra approach[4]. Type inference with subtyping is not a solved problem - these developments are big steps forward, but there are still open problems under research. Subtyping doesn't imply object-oriented. Structural typing (ie "static duck typing") is a form of subtyping. [1]:https://github.com/stedolan/mlsub [2]:https://www.cs.tufts.edu/~nr/cs257/archive/stephen-dolan/the... [3]:https://github.com/hkust-taco/mlstruct [4]:https://dl.acm.org/doi/pdf/10.1145/3563304 |
Gradual typing has much the same overhead as other kinds of dynamic typing. It's broadly appropriate as part of the interface between separately-developed software components, and not very much otherwise.