Re:The power of interoperability: Why objects are inevitable...
by lelanthran on Wednesday May 15, 2024 @09:15AM
(#40366498)
>> This interface has now been set in stone. Any additions that would be useful for the widget interface, say OnClick(), will require a breaking change.
> The idiomatic way to deal with this is to add a new interface with the extensions.
I also found that particular criticism weird in the GP, considering that the paper itself, with the widget example cited by the GP, performs the `extend` on an interface to add to existing interfaces without breaking existing code.
IOW, it uses the widget example, quoted by GP, to demonstrate how to add to an interface without breaking changes.
The idiomatic way to deal with this is to add a new interface with the extensions. This not only prevents old code from breaking but also gives you compile-time assurance that your clients and objects know how to communicate with each other.