New answers tagged

2

Because it's ambiguous. Using C# as an example: var foo = method(42); Which overload should we use? Ok, perhaps that was a bit unfair. The compiler can't figure out what type to use if we don't tell it in your hypothetical language. So, implicit typing is impossible in your language and there goes anonymous methods and Linq along with it... How about ...


9

It complicates type checking. When you only permit overloading based on argument types, and only permit deducing variable types from their initialisers, all of your type information flows in one direction: up the syntax tree. var x = f(); given f : () -> int [upward] given () : () [upward] therefore f() : int [upward] ...


-4


0

All language features add complexity, so they have to provide enough benefit to justify the inevitable gotchas, corner cases, and user confusion that every feature creates. For most languages, this one simply doesn't provide enough benefit to justify it. In most languages, you would expect the expression method1(2) to have a definite type and a more or less ...



Top 50 recent answers are included