[Interface-dev] Tagged values

Jim Fulton jim at zope.com
Mon Aug 22 18:09:43 EDT 2005


Stephen Waterbury wrote:
> Zope Interface gurus:
> 
> So far, I've read some of the z.i source, the introductory docs, and
> played with it.  Right now I'm only concerned with Attribute
> and Interface, and as far as I can see, no harm is done by giving
> them direct attributes instead of tagged values for such things as
> are shown in the README example ('author', 'date-modified').
> 
> Is there some side-effect that I haven't thought of, or were
> tagged values introduced mainly to avoid possible user confusion
> of a direct attribute of an Interface with a contained Attribute
> instance?

I don't know what you mean by a "contained attribute instance".

> 
> Also, in reading the UML spec, it appears to me that the UML intent
> for tagged values (which z.i's docs says is the model for z.i's use
> of them) is to be "semantically significant" extensions -- by which
> I think they mean semantically significant at the same meta-level
> as the interface specification.  But such things as the "author"
> and "date-modified" of an Interface or an Attribute are not
> semantically significant at the level of the Interface's
> specification, so I don't think the concept (at least as it's
> illustrated in the z.i README example) is the same as the UML
> tagged value concept.

The only use of tagged values that I know of is to store invariants,
which certainly seems to be the same level.

> My main question here is whether there are any known gotcha's to
> giving Interface and Attribute (and other Elements) direct
> attributes.

In general, I think it's a bad idea to add extra attributes to objects
that you don't control.  Interfaces could grow an attribute/method with
the same name as one you picked.

I don't expect to prohibit setting extra attributes on interfaces, but I
don't promise to support it either.  Certainly, IInterface makes no such
promise. :)

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 Interface-dev mailing list