Re: GInterfaces and API Stability



Alp Toker wrote:
> Matthias Clasen wrote:
>   
>> Well, I have certainly considered C ABI compatibility to be the main deciding
>> factor when  making such decisions. I'd say if C# interfaces are inflexible like
>> that then mapping GObject interfaces directly to C# interfaces was probably
>> wrong.
>>     
>
> This is totally missing the point. GObject interfaces exist to formalise 
> a pattern of design by contract. Even if the C compiler doesn't catch 
> and report incomplete interface implementations, that doesn't make it 
> correct to ship code that breaks the rules.
>
> Your argument is analogous to claiming that it's OK to change property 
> and signal names and parameters in an ABI-stable release because the C 
> compiler won't notice that anything has broken.
>   

I think it's not about "the compiler doesn't barf". It was a design
decision to be able to always extend interfaces. The only thing GTK+
(talking about the concrete additions) has to handle non-implementations
gracefully, which it easily can by NULL-checking before calling into the
interface implementation. Even a default implementation can be added to
be called if the interface function is not explicitly implemented.

This reminds me of the Microsoft API Design video that Philipp van Hoof
has blogged about. The speaker even claims that MS is extending their
.Net-interfaces in similar ways.

Regards,
  Sven


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]