When I do specific class I would like to have bett...
# codereview
e
When I do specific class I would like to have better names for the params, since I know the context
w
Maybe something like
Copy code
interface Merger<T1 : Any, T2 : Any, R : Any> : (T1, T2) -> R

class B : Merger<String, String, Int> {
    override fun invoke(asas1: String, asas2: String): Int = TODO()
}
Usage:
Copy code
fun asas() {
    val b = B()
    val result: Int = b("asas1", "asas2")
}
Or with the initial “interface”
Copy code
interface Merger1<T1 : Any, T2 : Any, R : Any> {
    val merge: (T1, T2) -> R
}

class A : Merger1<String, String, Int> {
    override val merge: (asas1: String, asas2: String) -> Int
        get() = TODO()
}

fun asasA() {
    val a = A()
    val result: Int = a.merge("asas1", "asas2")
}
e
Nice!
k
You could also avoid an interface altogether with typealiases. So it becomes something like:
Copy code
typealias Merger<T1, T2, R> = (in1: T1, in2: T2) -> R