News for hackers. Stuff that matters.
Re:Pretending OOP Never Happened by dragonwriter on Friday May 15, 2020 @06:27PM (#23198260)
> the derived class itself (which has no way of knowing what invariants might be expected of it as part of base class code).

In principle, with a sufficiently-robust type system, the invariants expected by the base class would be encoded in the typing, and the derived class would only be able to narrow them.

(Of course, OOP languages tend to either be untyped or have insufficiently robust type systems for this; robust type systems are more frequently associated with functional languages.)

Re:Pretending OOP Never Happened by temac on Friday May 15, 2020 @09:24PM (#23199571)
If the type system already trivially enforces your custom invariants, aren't the types defined by your classes already in it?