| ▲ | JBits 7 hours ago | |
If CLU only supported composition, was the Liskov substitution principle still applicable to CLU? | ||
| ▲ | ebiederm 5 hours ago | parent | next [-] | |
CLU implemeted abstract data types. What we commonly call generics today. The Liskov substitute principle in that context pretty much falls out naturally. As the entire point is to substitute in types into your generic data structure. | ||
| ▲ | mannykannot 5 hours ago | parent | prev | next [-] | |
Yes it is, as it is about the semantics of type hierarchies, not their syntax. If your software has type hierarchies, then it is a good idea for them conform to the principle, regardless of whether the implementation language syntax includes inheritance. It might be argued that CLU is no better than typical OO languages in supporting the principle, but the principle is still valid - and it was particularly relevant at the time Liskov proposed it, as inheritance was frequently being abused as just a shortcut to do composition (fortunately, things are better now, right?) | ||
| ▲ | jerf 7 hours ago | parent | prev [-] | |
No, because the LSP is specifically about inheritance, or subtyping more generally. No inheritance/subtyping, no LSP. It is true that an interface defines certain requirements of things that claim to implement it, but merely having an interface lacks the critical essence of the LSP. The LSP is not merely a banal statement that "a thing that claims to implement an interface ought to actually implement it". It is richer and more subtle than that, though perhaps from an academic perspective, still fairly basic. In the real world a lot of code technically violates it in one way or another, though. | ||