[Zope3-dev] Interface declaration API

Gary Poster gary@modernsongs.com
Tue, 11 Mar 2003 15:50:03 -0500


Jim Fulton wrote:
> Phillip J. Eby wrote:
>> I'm also curious whether the default interface spec for a class' 
>> instances should perhaps be the union of the interfaces specified by 
>> __bases__, rather than flat inheritance in __mro__-first order.
 >> ...snip...
> 
> There are several choices:
> 
> A. Don't inherit anything
> 
> B. Inherit the first set of declarations you find, if any
> 
> C. Inherit everything
> 
> D. Inherit what you say
> 
> Currently, we implicitly do B because:
> 
> - It's a compromise betwee A and C, and
> 
> - It's the easiest to implement.
> 
> My preference (ignoring implementation issues) would be to inherit
> nothing implicitly and to make it relatively easy to say you inherit
> everything.
> 
> Most people would prefer to inherit everything by default.
> I've had to discuss this so many times that I'm getting worn down. :)
> 
> Subclassing is done to reuse implementation. If interfaces were
> inherited, then you would be unable to subclass a class without
> also promising to implement the base class interfaces.  I've always
> viewed this as an undesireable requirement, but maybe I'm wrong,
> since so many people desire it, ;) So I'm willing to give on this.

FWIW, I'd greatly prefer what you prefer, Jim.  At one point, and maybe 
now, the event and object hub services code used this distinction, I 
believe.

 > ...snip...
 > I'll call YAGNI on doesNotImplement.

However, if the "inherit everything" behavior does become the default, 
this would no longer be a YAGNI, I think.

Gary