3 ms·
No, this blocks a fundamental concept of OOP: Liskov Substitution Principle. The idea is that you should be able to use a derived object anywhere the base one
by fooker 3y ago
No, this blocks a fundamental concept of OOP: Liskov Substitution Principle.
The idea is that you should be able to use a derived object anywhere the base one is required.
- dagmx 3y agoIt impairs that principle, yes. But it doesn’t block similar patterns that give you similar end results. Swift has very flexible generics programming and type abstraction that still lets you use it with a little extra work. Yes, it won’t be as ergonomic as the ideal, but it’s better than many binding solutions from C++ to compiled languages, while providing most of the usability. Plus the footnote says that they plan to resolve this in future Swift versions.
- dwaite 3y agoIt does not import the relationship, but you can still model it via protocols.