The main reason is compilation performance. When we look at a method call, it helps a lot to have explicit parameter types which don’t need to be inferred. Inferring the parameter type from a string constant is trivial, but if you have fun foo(a = bar())
and bar()
also has an inferred return type, understanding the actual parameter type of a
becomes very expensive.
1 Like