Are there any proposals for variadic type paramete...
# language-proposals
d
Are there any proposals for variadic type parameters? Along the lines of
fun <...Types> doThing(block: (Types...)->Unit, args: Types...){ block(*args) }
?
h
How do you use it? How should the compiler check the erased generics at runtime?
c
This use case is usually solved by creating overloads with the number of types you need
It’s boilerplate but variadic types is a bit of a niche use case
d
I'm only asking if there was a proposal for it, not suggesting it would be easy and that there are no other alternatives 😉
The one use-case that is common is for N length Tuples.
c
Ok that I don’t know
m
There is only an issue for now: https://youtrack.jetbrains.com/issue/KT-31427/Support-variadic-generics Feel free to drop your use-case there. Variadic generics could be a really nice extension of the language, it's a natural generalisation of our
kotlin.Function(N)
functions. However, variadic generics require support of tuples as well, or "multiple returns", so we're kind of limited right now on JVM. We even had a small prototype in the language a few years ago. Here is an [example](https://github.com/KirpichenkovPavel/kotlinx.coroutines/commit/59ac8ac84587a4bc082f72b529620c139735289e#diff-b89b26a9a072f15[…]5f302fea0536d44d0R319) of variadic generics in kotlinx.corourintes