[Types-sig] QueryProtocol

Michel Pelletier michel@digicool.com
Fri, 23 Mar 2001 11:58:03 -0800 (PST)


On Fri, 23 Mar 2001, Clark C. Evans wrote:

> On Fri, 23 Mar 2001, Clark C. Evans wrote:
> > For "checking" this is one thing, and IMHO, you could
> > implement one or the other and they would both be useable.
> > However... I do think that a combination of *BOTH* methods
> > would be far more flexible.
>
> Just to clarify, when I mean *BOTH*, I mean if either
> of the following is true, then ClassX implements InterfaceY
> is true:
>
>    (a) ClassX is declared to implement InterfaceY
>    (b) InterfaceY decides that ClassX is an implementer.
>
> It's bi-directional, "or" style.

Mmm are you sure that's a good idea?  An interface is a contract, and (a)
is a good idea because class X is making a contract with the user
described in InterfaceY.  But in (b), you are assuming that the object has
a contract.  That's bad.  Would you want someone to just "assume" that you
are obligated to act a certain way under a certain contract without you
explicitly declaring that?

-Michel