https://kotlinlang.org logo
#announcements
Title
# announcements
c

Chris Cunningham

09/29/2019, 4:05 AM
is there a way to redefine the same class or interface multiple times with only its amount of generic types differing
Copy code
interface Event<out TS> { ... }
interface Event<out TS, out T0> { ... }
interface Event<out TS, out T0, out T1> { ... }
k

Kirill Zhukov

09/29/2019, 4:26 AM
I’m curious, what is your use case?
You can make your interface implement another common interface?
Copy code
interface E
interface EventA<out TS> : E
interface EventB<out TS, out T0> : E
interface EventC<out TS, out T0, out T1> : E
Depends on what you are trying to do.
c

Chris Cunningham

09/29/2019, 1:28 PM
Think I got it pretty sorted now. But was trying to make something similar to events in C#. Decided to just allow 1 arg since data classes make it easy to make something to hold more if I need more then one
l

LeoColman

09/29/2019, 3:54 PM
Not that I know of, no
I think you must create one version for each possibility. I did that in the past
#arrow-kt does that the same way