I would like something like the following:
typealias CanCompare = Comparable<Self>
So that I can use it like so:
fun <T: CanCompare> sortStuff(comparable: T) {
}
Currently, the best option I know of is:
typealias CanCompare<T> = Comparable<T>
fun <T: CanCompare<T>> sortStuff(comparable: T) {
}
Since there are some generic classes which I generally only use self-referential generic type parameters in, it seems redundant to keep having to write out the full T: CanCompare<T>
, when T: CanCompare
would convey the same information to me in certain cases.