Get the latest tech news
How the OCaml type checker works (2022)
A short guide on OCaml type checker, describing the surprisingly elegant algorithm for generalization, which generalizes to first-class polymorphism, MLF and local types. Polymorphism and regions have much in common.
More promising is ownership tracking: associating an allocated resource with an owner, an object or a function activation. A similar strategy is regions, which are areas of heap memory created by a lexically-scoped so-called letregion primitive. Its code differs only in small, but significant, details from the toy Hindley-Milner inferencer from the previous section.
Or read this on Hacker News