[Zope3-dev] Interface declaration API

Jim Fulton jim@zope.com
Mon, 10 Mar 2003 16:53:56 -0500


Barry A. Warsaw wrote:
>     JF> - A proposal that makes a distinction between declaration and
>     JF> query functions.  Declaration functions use the word
>     JF> "implements" and query functions use the word "interfaces".
> 
> What about using a specific "get" prefix for the query functions?  I
> find getInterfaces() clearer than just interfaces().

That would be OK with me.  This reminds me of another issue.
When you want to say that you implement what one of your base classes
implement:

   class C(A, B):

      implements(IFoo,
                 getClassInstanceInterfaces(A),
                 getClassInstanceInterfaces(B),
                 )

it would be much nicer to have a more concise way to say this.
(The "get" prefix really doesn't make matters much worse than
they already were.) Phillips proposal does a quite bit better
here:

   class C(A, B):

      implements(IFoo, implementedBy(A), implementedBy(B))

Steve suggested that if you used a class where an interface
specification was expected that you'd get it's instance
interface declaration:

   class C(A, B):

      implements(IFoo, A, B)

I worry that this is too magic.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org