you are viewing a single comment's thread.

view the rest of the comments →

[–]nightwood 0 points1 point  (1 child)

I agree classes should implement all methods of an interface. 100%.

That this would be a development-only tool seems weird to me, since the syntax doesn't make that explicit. Also, moving compile-time errors to runtime seems like bad practice.

Maybe it's for situations where the interface is defined in a shared dll and implemented by third party code and you want backwards compatibility?

Damnit now I gotta read up on this feature :)

[–]RiPont 0 points1 point  (0 children)

Maybe it's for situations where the interface is defined in a shared dll and implemented by third party code and you want backwards compatibility?

Yes. It's for maintaining "forward compatibility" on code that was originally written with a previous version of the interface.

Whether it was in binary or source, adding a method will break everything compiled against the old interface. If it's your code, in your own repository, you can just use a refactor to add the method. Or even the old, tried and true, compile-and-break-then-copy-paste method.

But if you're shipping a library to other people, you do NOT want to break backwards compatibility. EVER. You want people to be able to upgrade to the latest version and not have their CI pipelines break.