Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
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?

Adbot
ADBOT LOVES YOU

Hughlander
May 11, 2005

Not sure about the Scala component but that also sounds like a prime Kafka use case.

  • Locked thread