Endre Deak
09/23/2021, 8:38 PM// this delegation works
interface A { fun foo() }
interface B { fun bar() }
class AImpl() : A { override fun foo() = println("default foo") }
class BImpl(private val a: AImpl) : B, A by a { override fun bar() = println("bar") }
// ==============
// how could I do a delegation for an inherited interface?
interface A { fun foo() }
interface B : A { fun bar() }
class AImpl() : A { override fun foo() = println("default foo") }
// no idea how to delegate
class BImpl(private val a: AImpl) : B by a { override fun bar() = println("bar") } // ?
Ruckus
09/23/2021, 8:53 PMclass BImpl(private val a: AImpl): B, A by a { ... }
Endre Deak
09/24/2021, 3:26 PMEndre Deak
09/24/2021, 3:26 PMRuckus
09/24/2021, 3:43 PMEndre Deak
09/24/2021, 3:48 PMBImpl
to have an explicit inheritance from A
, I’d like to achieve that through B
if possible. And therefore, a partial delegation would be requiredRuckus
09/24/2021, 3:55 PMa
parameter is.Stephan Schroeder
09/27/2021, 9:46 AMBImpl
to implement A
, it has to be explicit about it). Ruckus' solution to generate default proxy calls to a parameter is as close as you can get to what you want.Endre Deak
09/27/2021, 2:45 PM