Multiple Overloaded Alternatives and Default Arguments

Looking at the section of the Scala spec for default arguments, we see that it explains how default arguments are encoded as methods named <methodname>$default$<position>. In order to have multiple overloads with defaults you would need to overload the magic default methods, which would only work if they had distinct types.

Probably someone decided that allowing the cases that wouldn’t actually cause conflicts would yield complicated rules that would be hard to understand, while just limiting default arguments to a single instance of an overloaded method is much easier to explain.

1 Like