[Feature Request] allow classes in by clauses


#1

The by clause allows us to simulate multiple inheritance using compiler generated delegation. But Kotlin limits delegation in by clauses to interfaces, not classes. This places a severe limit on the utility of the feature because we may wish to specify classes from libraries which do not provide interfaces as bases.

I can’t think of a technical reason NOT to allow specifying classes in by clauses. Indeed, instances of classes must be passed to the subclass we will instantiate in order for the compiler to have objects of the base types to forward function calls to.


#2

Please vote/follow KT-21955.


#3

Thank you Alexey, voted! Hope we see this in Kotlin soon.