[Zope3-dev] "Sub interface"

Jim Fulton jim at zope.com
Mon Mar 1 10:05:08 EST 2004


Terry Hancock wrote:
> On Sunday 29 February 2004 11:19 am, Jim Fulton wrote:
> 
>>I forgot to mention that Zope 2.8 will make this easier by
>>including Zope 3 interfaces and replacing the Zope 2 interfaces
>>package to use the facade.  We will also update the software than
>>is includes with Zope 2 to use zope.interface.
> 
> 
> That sounds like the right thing to do then.  I suspect (though I have
> not had time to prove it to myself), that Zope 3 will allow me to
> cut my product down considerably, so I'm probably going to
> be migrating to Zope 3.

Great.

> But it's not time yet.  Thanks for the installation instructions to use
> Zope 3 interfaces in Zope 2, as that's clearly what I need to do.
> 
> I gotta say though, I recoil at the distinction between "schemas"
> and "interfaces".  IMHO, they're still "interfaces" -- the idea that
> attributes shouldn't be part of an interface seems unnatural
> to me, like some idea grafted from another language.   I approve
> of the fact that they're integrated in Zope 3, though.  I guess I
> can lie with it as a synonym.

As Martijn pointed out, schema are interfaces. There aren't separate
schema objects. Schemas are just interfaces that have fields. The main
contribution of the schema package is new attribute descriptions, called
fields.

There is a separate schema package because schema are much newer than
interfaces. It's a packaging issue, not a technical issue.  I'm open
to merging the schema package into the interface package at some point.

> But I personally reserve the word "schema" for relational databases
> and XML schemas -- that's a word getting too overloaded. ;-)

A schema is used to model information.  Thus, I think that the meaning
is consistent across Zope, XML, and database schema.

> One question about the schema module -- when we specify that
> a field is, say, a "Tuple" are we requiring that it literally "is-a" tuple,
> or that it merely "acts-like-a" tuple? (I.e. are we testing "type" or
> "interface"?).  I really prefer the latter. 

Tuple constrains the value to be a Python tuple. If you want something
more general, use Sequence.

> Does that mean I should *always* use the "Object" field and
> specify the interface as "schema",

We need to change the name of that keyword argument.  I'm
inclined to use "type" and allow any interface *or* class there.

 > or is that merely duplicating
> the schema module's code?

I don't understand the last part. What code do you think you'd be
duplicating.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list