Frontend @ahrefs • Previously @webflow • Passionate about The Web, JavaScript, and now OCaml. He / him.
Jan 8, 2019 • 11 tweets • 3 min read
One of the most useful ways to categorize type systems is:
- is it Hindley-Milner based? (Rust, Haskell, OCaml)
- or does it support implicit subtyping (TypeScript, Flow, C#)?
The first: 1 expression <-> at most 1 type.
The second: 1 expression <-> multiple types.
A thread 👇
Implicit subtyping works well for languages that have support for inheritance, and that's why (I guess) it made sense for Flow and TypeScript to adopt it, as JavaScript has prototype inheritance.