Is there a way to overload methods in Scala that take multiple parameter lists? E.g. I'd like to do this:
def foo(a: Int)(b: Int)(c: Int): Int
def foo(a: Int)(b: Int): Int
I can define it like this, but trying to call the second method like this:
foo(1)(1)
makes the compiler complain about "ambiguous reference to overloaded definition", which seems justified. Is there a way to achieve something like this? The last parameter might be considered optional in some cases, for example.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…