3 ms·
As the sibling comment points out, this has been a feature of many functional programming languages for a long time. If you infer everything, though, it becomes
by ghusbands 3y ago
As the sibling comment points out, this has been a feature of many functional programming languages for a long time. If you infer everything, though, it becomes a little unfriendly in use.
When you make a change in one location and accidentally use the wrong type for something, it can affect global type inference and you get error messages in other locations. In essence, if you use only type inference, a change anywhere in the program can turn up as an error due to a type mismatch anywhere else in the program.
Most languages with powerful type inference aim for a middle ground where important types are declared and mostly-local types are inferred.