Does anyone know why you're unable to use multiple varargs as parameters in a constructor in Kotlin and if there might be a possible workaround?
r
Ruckus
02/17/2019, 1:08 AM
It would often be ambiguous.
s
snowe
02/17/2019, 1:10 AM
you could use currying maybe?
a
amanda.hinchman-dominguez
02/17/2019, 1:13 AM
currying? As in passing higher-order functions in?
s
snowe
02/17/2019, 1:13 AM
yeah, make your constructor accept a HOF with varargs (not sure if that's possible in kotlin, I've never tried it), and call the HOF in the constructor?
a
amanda.hinchman-dominguez
02/17/2019, 1:15 AM
Hmmmm, for now, the workaround I found involves taking advantage of TornadoFX dependency injection by creating the injector in a Controller - but this could but another item to look at
s
snowe
02/17/2019, 1:16 AM
if you could post a larger code sample we might be able to help a little better.