On Tuesday 13 August 2002 02:10 pm, [EMAIL PROTECTED] wrote:
> On Tue Aug 13, 2002, Jim Penny wrote:
> > There is a large problem looming with Moneky Patches. The problem is
> > that monkey patches are so Highlander. "There can be Only One".
> > 
> > For example, there are at least five or six products that monkey patch
> > manage_main. Each simply replaces whatever manage_main exists at the
> > time of instantation, and blows away any previous monkey patch. Some
> > coordinated way of dealing with this problem needs to be arrived at.
> >
> 
> And if you upgrade Zope, the patched version of manage_main will discard
> any changes made in the new version of Zope.

That is why it would be beneficial to make the thing being patched extensible 
in the first place thereby alleviating the need to patch it.

> > Proposal:
> [ideas on how to check for previous changes and what to do about it]
> 
> Here is a more surgical option for small changes: Instead of
> indiscriminately replacing the whole function or method, decompile and
> look for and replace only that part of the code that you want to change.
> In that way, as long as that part of the code remains valid between
> versions, the change probably remains valid, and you apply it. If you
> can't find the part of the code that you want to change, then some other
> change you are not aware of happened, so do not apply your change. I use
> decompyle and re to do the work. Here is an example:

[snip example]

I thought about an approach like this, but I think it is susceptible to subtle 
bugs. It is very hard to predict the interaction of products independently 
changing the same template. As a product author, trying to support such a 
thing is not very attractive.

I would prefer to make the template itself more flexible then try to jam new 
code into it sideways at run-time.

-Casey

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to