News for hackers. Stuff that matters.
Re:Inheritance was invented as a performance hack by AstralStorm on Thursday May 08, 2025 @02:26AM (#43923593)
They just cannot access any field in the class itself. Which means... the default implementations fail to actually implement anything but the simplest methods or you need to expose API-private things via getters violating open-closed principle.

(If you merge multiple interfaces, the implementations of the methods have to match. You end up with even more special getters for each one sometimes.)

Re:Inheritance was invented as a performance hack by int_19h on Thursday May 08, 2025 @03:02AM (#43923805)
In C# interface members can be implemented explicitly, which means that: 1) they are not visible on the object itself, only on interface-typed references to it, and 2) implementations of methods from multiple interfaces don't need to match since they live in separate namespaces.

It's true that you can't access private members (not just fields) on `this` from the mixin interface. But explicit implementations of members mean that only someone explicitly downcasting the object will get access to those members, so accidental access is not an issue.