[Zope-dev] implementing zope.component 4.0

Tres Seaver tseaver at palladion.com
Mon Nov 30 11:10:39 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gary Poster wrote:
> On Nov 27, 2009, at 6:32 AM, Martijn Faassen wrote:

>> Utility lookups versus adapter lookups
>> --------------------------------------
>>
>> There was some discussion on whether utility lookups are really 
>> something fundamentally different than adaptation as adaptation 
>> *creates* a new instance while utility lookup uses a registered 
>> instance. I think the essential part here is however: "give me an 
>> instance that implements IFoo", and utility lookup fits there. We could 
>> even envision a way to create utilities that *does* instantiate them on 
>> the fly - it shouldn't affect the semantics for the user of the utility.
> 
> As above, I disagree.

The root of the disagreement here is that you seem to want the *caller*
to care about something which is important only to the person who
*registers* the thing being looked up.  From the caller's perspective,
the call site needs an object implementing IFoo, looked up using some
number N of context arguments, where N could be 0 (no context required
to find the object).  The fact that, under the hood, an adapter lookup
happens to call a factory, passing the context args, is not relevant *to
the caller*.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksT7n8ACgkQ+gerLs4ltQ6vZwCfTT8aWbm4WO7Ba6nQiNPohM3Y
QWsAnRUtVRFFQlDRbpnyRao0NZA/mjo3
=VfyQ
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list