Conversation

While shit posting, it dawned on me: Rust doesn't do inference in fn signatures because of possible bugs, ease of analysis and how big of a semver foot gun it would be. But if the fn is crate private, then the last problem is not a consideration.
16
67
I remember "global analysis is bad" being also cited as a concern. Though your proposal is somewhat limited. (Can Haskell infer a return type based on call sites?)
4
10
The bigger problem (which we learned in Standard ML and successors) is that inferring types on function arguments tends to make type errors blame the caller rather than the code.
2
23
So, if you have a function f that takes an int and has 5 correct call sites but change something in the body of f such that inference determines it's now a char, the call sites will be blamed, not the function!
3
10
The developer has to already "know" about this problem, use go to definition to go to the function, and change it. This probably sounds small, but especially as types and the call paths get significantly more complicated, this can become totally bewildering for non-experts.
2
10