Hacker News new | ask | show | jobs
by tpxl 48 days ago
This already happens though without sealed classes in existing code. If you have an interface A with implementing classes B and C, you'll eventually run into an error if the library starts emitting class D.
1 comments

Not if you program to the interface. This kind of pattern matching is syntactic sugar for `instanceof` checks and down-casts. That’s fine within a module boundary (using “module” in a loose sense), but across module boundaries I think programming to an interface should still be the preferred solution.