First-class generic functions (or Rank-N Polymorph...
# language-proposals
y
First-class generic functions (or Rank-N Polymorphism) This would allow passing generic functions around, and more importantly write generic lambdas. Existential types somewhat fit this hole already, but they have multiple issues, including brittle support by type inference, and the fact that there's no way to associate 2 parameters with each other without using a wrapper class. What I mean by that is that we can't give a type to the following function:
Copy code
fun <T> add(first: T, second: T)
Nor this function:
Copy code
context(t: T) fun <T> foo(list: MutableList<T>)