3 ms·
I'd be interested to understand how / what types of proposals exist to solve this very real ergonomic issue. As I stated in my original post, the implementatio
by caspper69 2y ago
I'd be interested to understand how / what types of proposals exist to solve this very real ergonomic issue.
As I stated in my original post, the implementations of interfaces/composition that I have used (primarily C# and Rust) are stateless, so you must always re-implement. And honestly, if Rust were to say, allow the specification of struct members in trait definitions, one could argue that their structs are really sealed/final classes, just using different keywords.
I am genuinely curious, because I do believe that people have a valid point that composition does tend to lead to less object spaghetti than inheritance, even if I can't quite pinpoint why from a purely theoretical standpoint (my belief is that they're "holding it wrong").
- int_19h 2y agoFor example, Kotlin has syntactic sugar specifically to implement interfaces by delegating to an inner object (with overrides etc): https://kotlinlang.org/docs/delegation.html https://kotlinlang.org/docs/delegation.html