Given the following function with optional parameters:
def foo(a:Int = 1, b:Int = 2, c:Int = 3) ...
I want to keep the default value of a>
A solution (far from pretty) could be Currying
You would need to change the method signature a little bit:
// Just for "a" parameter
def foo(a: Int = 1)(b: Int = 2, c: Int = 3)
foo()(2,3) // 6
foo(1)(2,3) // 6
foo(2)(2,3) // 7
For all the parameters:
def foo(a: Int = 1)(b: Int = 2)(c: Int = 3) = a + b + c
foo()()(3) // 6
foo()(2)(3) // 6
foo(2)()(3) // 7
foo(3)()(3) // 8