Declaring defaults for generic type parameters - i...
# language-proposals
g
Declaring defaults for generic type parameters - it’s a nice little feature I miss in Kotlin, e.g.:
Copy code
interface Foo<T, U = Unit, V = Unit>
or even:
Copy code
interface Foo<T, U = Unit, V = T>
This way, if you don’t care about some parameters, you could write:
Copy code
class Bar : Foo<Int>
instead of:
Copy code
class Bar : Foo<Int, Unit, Unit>
So far I’ve seen it in C++ and TypeScript, and it seems to work well. What do You think?
1
g
Someone already asked about this feature. As I remember JB guys said that have that in plans
s
Is there issue in youtrack to vote and track it?
g
I don’t know such issue, maybe make sense to create it
g
I’ve searched for the issue on YT, but didn’t find one
Shall I create one @dmitry.petrov? Or is it not necessary, since you’re already working on it?
g
I think so, In the worst case issue will be marked as a duplicate
g
Yeah. Maybe Dmitry can tell some more details
@gildor Thanks for pointing me to the right place 😉
k
s
a
If I remember correctly, one of JB guys wrote here that it’s planned for 1.3. Can’t find it in the channel’s history, which is apparently a paid feature now.
s
In this thread Andrey Mischenko post link to archive [1 day ago]: https://kotlinlang.slackarchive.io/language-proposals/page-65/ts-1508774988000003