[Zope3-dev] schema initial documentation

Jim Fulton jim@zope.com
Mon, 22 Apr 2002 17:27:34 -0400


"Phillip J. Eby" wrote:
> 
> At 09:13 PM 4/20/02 +0200, Martijn Faassen wrote:
> 
> >   * Jim seemed to have the idea you shouldn't mix fields with methods.
> >     So based on that, I figured we should have separate schema interfaces. :)
> >     But Jim should jump in and explain his thinking here.
> 
> Hm.  Yes.

Hm. Well, I don't really care. When using schemas as formulator forms, 
the form machinery could just ignore non fields.

...

> > > One thing that's rather interesting here; an opportunity for overlap with
> > > Features in TransWarp...
> > >
> > > In TransWarp, a "feature" is a class attribute that can export methods to
> > > its containing class, possibly in addition to being a property of that
> > > class' instances.
> >[snip]
> >
> >Interesting. I'm not entirely sure I see the overlap with schema, however.
> >Do you mean to indicate a parallel between Field and Feature objects, in
> >that they're both rather 'intelligent' part of an interface (as opposed to
> >simple methods and attributes)?
> 
> Sorry, I guess I wasn't expressing myself clearly.  What I meant was that
> I'd like to be able to specify a feature in an interface, and have it imply
> the existence of methods and/or fields in the interface.  Thus, if I added
> a "limbs" feature to "IPerson", it would automatically add the "addLimb()"
> and "removeLimb()" methods to the interface signature. 

So a feature is kinda like a macro.  Did you mean something like:

  class IPerson(Interface):

    arms = Limbs()
    legs = Limbs()

implies:

  class IPerson(Interface):

     def addArm(arm): ...
     def removeArm(arm): ...

     def addLeg(arm): ...
     def removeLeg(arm): ...

???

Otherwise, what do features provide that a base interface
doesn't.  

> Here, I'm
> considering that Interface.Attribute and Interface.Method are actually in
> some sense subclasses of Interface.Feature (which doesn't exist yet), that
> signify the addition of only a single method or attribute to the signature.

Or maybe it's just a different beast altogether.
 
> Of course, I can do this now using an explicit '__metaclass__' specifier to
> build the interfaces, but it'd be nice to have the notion as a standard
> part of documenting interface semantics. 

I'm afraid to ask what meta classes have to do with this.

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