[Zope-dev] implementing zope.component 4.0

Joachim König him at online.de
Tue Dec 1 11:15:50 EST 2009


Martin Aspeli wrote:
> Clearly, it could. But that's not the way we went. Changing it now would 
> be really damaging, and I'm not sure what would be gained.
>
> I can imagine use cases where getting a new instance each time would be 
> useful.
But that is under the full controll of the __call__ of the utility, it 
could return whatever
it wants, as long as what it returns implements the requested interface 
of course (
imagine a pool of utilities implementing the interface, some being "busy")

If you'd like to check (as a user of the ZCA) if you got a singleton for 
a utility,
then compare the lookup() against the utility returned, e.g. __call__ 
returned  self.

The distinction between utility and adapter only burdens  the ZCA with  
no gain. The
only reason for ZCA to know about it today is to decide if to return the 
registered
object or to call it. And a lot of discussion is necessary to explain 
the difference.



More information about the Zope-Dev mailing list