[ZODB-Dev] Re: [Zope3-dev] Persistent module notes and proposal

Jim Fulton jim at zope.com
Mon Jan 5 13:53:32 EST 2004


Tres Seaver wrote:
> Casey Duncan wrote:
> 
>> On Sat, 03 Jan 2004 11:02:57 -0500
>> Jim Fulton <jim at zope.com> wrote:
>>
>>> One particular issue has to do with the scope of persistent modules.
>>> I propose that, at least for Zope 3, persistent modules should contain
>>> only software and that the state of persistent modules should be fully
>>> expressed by their source. This implied that persistent modules in 
>>> Zope 3
>>> should not contain any objects that are mutated outside of the execution
>>> of the modules, such as registries, counters, etc.
>>
>>
>>
>> This certainly sounds reasonable. We need to make sure this is
>> enforced at some level though, preferrably through software (disallowing
>> mutating globals in the module somehow) or at least through very strong
>> documentation (such as a comment at the top of the module that appears
>> by default or an electrostatic charge administered to the chair of the
>> respective programmmer). Otherwise I sense an endless barrage of newbie
>> FAQs re this in our future...
> 
> 
> Surely we can replace the __dict__ of the PM with something "frozen", 
> thawing it only when recompiling the source.  I wouldn't want anything 
> "advisory" at all, here;  that would be just a bug magnet (FAQs too).

But what about mutable instances in the dictionary, or mutable objects
in class objects?  People who violate the design guidelines/limitation
are far more likely to do so with mutable objects in the module.

I think that enforcing non-mutability of modules could be really hard.
I'm certainly willing to entertain it.  I think the only way to do it would
be to be very restrictive about what sorts of objects could be in the module,
or in classes.

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 ZODB-Dev mailing list