Is there a way, either currently or with anticipated features, to extend an existing class by delegating the members of an interface to a specified object?
I can declare a new class that delegates to a specified object, i.e.
class IntervalRange(interval: Interval) : ClosedRange<Int> by interval.a..interval.b
And I can extend and existing class by individually delegating members to a specified object, i.e.
operator fun Interval.iterator() = (a..b).iterator()
Is there a way to delegate all of the ClosedRange<Int>
members to a..b
? Something like,
Interval : ClosedRange<Int> by a..b