2 ms·
In practice, not really. A good type inference system like Hindley-Milner infers the most general type of any expression you give it. This usually makes your co
by yawaramin 7y ago
In practice, not really. A good type inference system like Hindley-Milner infers the most general type of any expression you give it. This usually makes your code more polymorphic i.e. generic than if you would have manually written down the types.
You talk about cognitive load of looking up type info but there's also a cognitive load to having to parse every type annotation over and over again whenever you read the code. And since code is read more often than it's written, that's really just optimizing for the wrong load. As you re-read a codebase over time you'll get familiar with its types. And then the annotations start to get in the way. This is in fact one of the reasons people prefer dynamic typing.
> My response? Go refactor your hideous code.
To what? Would be very interesting to see your suggested refactor of that code.
> Before every language designer blindly accepts type inference as a good thing, I propose that some research be conducted.
What would be the research question(s) specifically?