is it possible to design a recursive default funct...
# stdlib
r
is it possible to design a recursive default function on an interface to operate on the super type until it "hits" itself? I'm thinking something like this (semi-pseudocode):
Copy code
interface Foo {
    val selfValue: String

    fun doSomething(): String {
        if (this::class == Foo::class) {
            return "Foo"
        } else {
            return "${super.doSomething()}.$selfValue"
        }
    }
}
j
Don't think this relates to the standard library.
r
I guess it depends if the reflection parts of kotlin is right for the job? Unless I misunderstand the cut for when it is stdlib? Anyway, where would be a better place to ask then?
c
#C0B8Q383C is for changing the standard library #C0B8MA7FA is for asking how to do things