Hey guys :slightly_smiling_face: I want to design ...
# announcements
f
Hey guys 🙂 I want to design a fluent interface but it seems as if the variance of Kotlin/JVM is not good enough for creating actual DRY code; or maybe I'm missing something?
Copy code
sealed class A {
    fun a() = apply { /* doSomething */ }
}

class B : A() {
    fun b() = apply { /* doSomething */ }
}

class C : A() {
    fun c() = apply { /* doSomething */ }
}

B().a().b() // cannot call b() now :(
C().a().c() // cannot call c() now :(
k
Does this work for you?
Copy code
B().apply { a() }.b()