- Hughlander
- May 11, 2005
-
|
I'm working in an existing code base with a horrible method with 18 arguments, along the lines of:
code:def Foo(bar: Bar,
moo: Moo=null,
zoo: String=null,
bleh: String = null,
<repeat 15 times>)
I'd like to partially apply the function so that you specify the Bar as expected, but the zoo is fixed, while the callers could still apply moo/bleh et al. IE something like:
code:val myFoo = Foo(_: Bar, zoo="gently caress you")
val Something = myFoo(thisBar, bleh="Such poo poo")
Is there a way to do so or what would the approach be if I can't touch Foo?
|
#
¿
Nov 10, 2015 18:05
|
|
- Adbot
-
ADBOT LOVES YOU
|
|
#
¿
May 11, 2024 18:07
|
|
- Hughlander
- May 11, 2005
-
|
Not sure about the Scala component but that also sounds like a prime Kafka use case.
|
#
¿
Dec 22, 2015 03:34
|
|