News for hackers. Stuff that matters.
Re:Inheritance Often Doesn't Make Sense by jdmichal on Saturday March 17, 2018 @03:48PM (#16608724)
Absolutely, and that's another excellent way to explain the problem and come to the same conclusion. The mathematical relationship between rectangles and squares is covariant, because squares have more specific constraints than rectangles. But when you make rectangles mutable, those mutations are contravariant, because they only guarantee to preserve less specific constraints. So you can't make squares from mutable rectangles!

There are no comments on this comment yet.