here is the same code but with named class instead...
# announcements
m
here is the same code but with named class instead of anonymous object
Copy code
interface Receiver<in T> {
    fun receive(t: T)
}

class RetranslatingReceiver<in T>(val to: Receiver<T>): Receiver<T> {
    override fun receive(t: T) {
        to.receive(t)
    }
}

interface Value<out T> {
    val src: T

    fun read(to: Receiver<T>) {
        val x2 = RetranslatingReceiver(to)
        x2.receive(src)
    }
}