News for hackers. Stuff that matters.
Re:Closures and Objects Are Equivalent (2013) by zozbot234 on Sunday November 20, 2022 @09:25AM (#33681111)
Not quite. Inheritance needs a "tying the knot" construction, because a base-class method can call a method that may have been overridden in a derived class. So you need an indirection step for any call to an overridable method, which cannot be modeled by simple delegation. Of course this is really a misfeature (outside of pure abstract base classes that, like interfaces or traits, don't implement their defined methods), which is at the root of the well-known "fragile base class" problem. It means implementation-inheritance is inherently non-modular, even though literally everything else in OOP was specifically intended to enable and promote modularity.

There are no comments on this comment yet.