3 ms·
> var a = 0 This is not a type inference. It is a mere type propagation.
by sklogic 11y ago
> var a = 0
This is not a type inference. It is a mere type propagation.
- hacker_9 11y agoWell, no, the term 'type inference' is used to describe var. See here for more: http://stackoverflow.com/questions/479883/how-good-is-the-c-sharp-type-inference http://stackoverflow.com/questions/479883/how-good-is-the-c-...
- lpw25 11y agoIt is, but it is worth noting that when OCaml or Haskell programmers talk about type inference they are usually referring to global type inference which allows an argument's type to be inferred from its uses. For example: let f x = x + x will be inferred as int -> int.
- sklogic 11y agoThey can call it any way they fancy, something like "Majestic Royal Type Procession" would have been equally ambitious. But in a context of ML, type inference is a Hindley-Milner inference or an equally powerful equation solving system, and not just a pathetic "assign the RHS type to LHS blindly" as it is in C++ and C#.