[Zope-dev] ZCA proposal

Gary Poster gary.poster at gmail.com
Wed Dec 2 21:14:42 EST 2009


I think I could get fully behind the following proposal that others have made (Shane I think was one of several?).

IFoo.adapt(...)

IFoo.utility(...)


= Why? =

- This is a significant improvement in terms of being memorable, as far as I'm concerned.  It's also briefer, which is related.

- It uses the terms we've already taught.

- It is entirely backwards compatible.  We don't have to poll the world and hope we didn't miss anyone.

- We can make the call syntax for ``adapt`` take multiple arguments.

- It is symmetric-ish.

- It would potentially allow a place to hang debug/analysis calls, as I showed earlier, but let's not have that debate yet.  I can put those somewhere else if I need to.


= Why not tuple multi-adaptation in the __call__? =

I'm somewhat surprised that some who have been loudest about not breaking backwards compatibility are OK with breaking this, given the two reports from the very small sample we have here of users.

I think it is unnecessarily risky for minimal gain, particularly when we have another reasonable option.


= But Gary, I thought you didn't like ``adapt``? =

No, I don't.  I think it is a hindrance to understanding, and I would prefer ``instance``, for example (or maybe ``create``?).  That said, people disagree with me.  Going along with ``adapt`` but getting this new syntax gets me a lot of improvements from my perspective.  I think people on the Launchpad team would be happy with this.  I would explain ``adapt`` as "look, it's a factory," but, oh well.  Progress usually means compromise.


= But Gary, I thought you didn't like ``utility``? =

No, I don't.  I already gave up on that one, since I didn't have an answer better than "singleton" and I acknowledge that it is not great (either, for different reasons).


Gary


More information about the Zope-Dev mailing list