Thinking a bit about this, I think it is just a matter of not adding too much complexity, suppose you have
def f(a: A, xs: X* = Seq(x0, x1)) = ???
Now the caller uses like this: f(a)
.
How do we know if the caller intended to pass a zero-length list of X*
or wanted to trigger the default arguments by not providing a X*
? In your example you assume that the second alternative is the only case that will ever be and that the compiler needs to supply the default argument value. But an empty Seq()
is already a perfectly valid value provided by the caller. I guess the caller could write f(a, Seq(): _*)
but it is cumbersome.