[Zope3-dev] renaming MementoBags..conclusions?

Shane Hathaway shane@zope.com
Tue, 14 May 2002 21:06:12 -0400


Ken Manheimer wrote:
> On Tue, 14 May 2002, Jim Fulton wrote:
>>So, let's rename IMementoBag to IAnnotations.
>>
>>(Note that I sneaked an 's' on the end to reflect the collection (bag;)
>> nature of this thing.)
> 
> 
> I know i'm coming in a bit late, but want to add one other option to 
> consider: IIncidentals.
> 
> The problem i have with IAnnotations is that "annotations" connotes
> textual incidentals - notes, commentary.
> 
> "Incidentals" connotes secondary accompaniment - things that impinge on
> but aren't intrinsic parts of the subject.
> 
> Maybe the mementos are restricted to discussions or other things that are,
> in fact, commentary - in which case IAnnotations would be just right.  
> But if other kinds of things are also intended - registration of related
> resources - then i think IIncidentals is a lot better.

IMHO your insight actually leads me to believe even more that 
IAnnotations is the right name.  It's true that an annotation can be 
more than a string, but we learned from Zope 2 that we have to avoid 
storing objects of non-"core" types in annotations.  Otherwise, when the 
user uninstalls something that created complex annotations, Zope can no 
longer load the annotated objects.

The specific example I have is the "before traverse" hook in Zope 2. 
Initially, it was set up in such a way that you could register any 
object as a hook and the traversal machinery would call the hooks at the 
right time.  But unfortunately, if you ever uninstalled the product that 
created the hooks, Zope could no longer traverse to that point and 
beyond because ZODB couldn't unpickle the object, since a class was 
missing!  Then we allowed hooks to be registered by name rather than 
direct reference.   At least traversal could work, but the traversal 
machinery still had to work around the fact that it might sometimes try 
to call a deleted or broken object.

So an annotation can contain simple objects like lists and strings, as 
well as instances of core Zope classes, but an annotation should not 
contain instances of classes that could be uninstalled someday.  That 
rules out 3rd party classes.  The word annotation connotes brevity and 
limited expression, I think. (Unlike this discussion ;-) )

Shane