3 ms·
Along with that, the compiler is going to do less work too. That means faster compilation and better programmer experience with the language.
by simcop2387 8y ago
Along with that, the compiler is going to do less work too. That means faster compilation and better programmer experience with the language.
- rileymat2 8y agoHow is it less work for the compiler? It still needs to figure out the return type to make sure it matches.
- lifthrasiir 8y agoType inference algorithms generally have two operations, verification and inference. Verification is faster and more complete (i.e. never misses an existing suitable type) than inference because it works from the biggest assumption that is a (hopefully) suitable type for given expression. Hindley-Milner combined with Algorithm W is really brilliant because it makes inference as performant as verification as the constraint solver is integrated in the inference process, but it does not work for all type systems; inference continues to be inferior when H-M is not applicable as is.