3 ms·
Isn't what Rich Hickey defense the same as the Liskov substitution principle? Or at least very similar.
by alexmolas 3y ago
Isn't what Rich Hickey defense the same as the Liskov substitution principle? Or at least very similar.
- codebje 3y agoSomewhat related. The subclass relationship isn't very rigorous, you're free to have completely different behaviours out of the same methods in a subclass. Liskov says don't do that: if B is a subclass of A it should behave like an A. When it comes to types, a subtype is one that can be transparently substituted for its super type. If S <: T, a term of type S can be used where a T was expected just fine. For union types, it's a given that T <: T|a for any type a, and a T will behave exactly like a T|a whose value is a T. The Liskov principle states that a subclass should be a subtype.