Hacker News new | ask | show | jobs
by dagmx 1056 days ago
It still allows you to use them for interop. The only functionality that would be impaired is checking for inheritance with an `as?` type check/conform.
1 comments

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.

It 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.

It does not import the relationship, but you can still model it via protocols.