https://kotlinlang.org logo
Title
n

Nir

07/04/2019, 10:57 PM
Unrelated question: is there a way to forward arguments generically to another function in kotlin?
s

streetsofboston

07/04/2019, 11:06 PM
You mean currying?
n

Nir

07/04/2019, 11:22 PM
Not really no
Like as an example, suppose I have a class that wraps a DataClass
I went to expose the copy function outward
*want
but that would mean repeating its signature
which is a significant amount of boilerplate
I want to be able to write a member function whose signature basically says: i don't care what typse you give me, I accept anything, but whatever you give me I'll just forward to copy
If you're familiar with C++ you can do
template <class ... Ts> void foo(Ts&& ts);
k

karelpeeters

07/05/2019, 9:12 AM
No, there's nothing like that in Kotlin.
n

Nir

07/05/2019, 1:01 PM
Unfortunate, it solves a real problem
k

karelpeeters

07/05/2019, 1:31 PM
There's this feature request: https://youtrack.jetbrains.com/issue/KT-15471
n

Nir

07/05/2019, 2:38 PM
It's simlar but you'd still have the boilerplate of declaring the dataclass it seems like
I just want a pure forwarding mechanism