i propose that delegation could be expanded to do ...
# language-proposals
i propose that delegation could be expanded to do more with vtable dispatch using a simple z-axis analogy. this may be delegation by some other keyword or name. https://youtrack.jetbrains.com/issue/KT-37346
for argument's sake, lets say ArrayList calls this.get() when returning a sublist As delegation is not inheritance ArayList's this reference is in no way related to the BackwardsList. If this.get() would magically call into the BackwardsList's get implementation you would have inheritance, not delegation
Probably possible. But it looks like the semantics would be at least as complex as c++ multiple inheritance and kotlin deliberately chose not to have such a beast in it's language
we're talking about keywords to do event routing which intellij provides for java-lang delegates manually. when the keyword is slightly stronger than
, the proxied object should examine whether get() is abstract on the declaration, and service that
methods/properties which are not. there would be a third flat vtable proxying for the delegate when the declaration is referenced. should MI, and interface colllisions be illegal? I would say yes, why not. I don't really think this is full-on c++ vtable level of magic. I think it is crafting proxies, and delegation is already doing the same work of building proxy methods for the declaration vtable.