-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Gary Poster wrote: > On Nov 25, 2009, at 11:17 AM, Thomas Lotze wrote: > >> Martijn Faassen wrote: >> >>> Adapter: >>> >>> IFoo(x) >> [...] >> >>> Multiadapter: >>> >>> IFoo.multi(x, y) >> [...] >> >>> Utility: >>> >>> IFoo.utility() >>> >>> [or possibly IFoo() instead?] >> What about a simple and consistent API for all components including >> utilities, adapters and multiadapters: >> >> IFoo() >> IFoo(x) >> IFoo(x, y)
You can't use an arbitrary number of positional arguments for the contexts, because we need to support the named / default cases too. >> I seem to remember there had been some discussion at some point about >> dropping or at least loosening the distinction between utilities and >> adapters anyway, so this would be the opportunity to do so at the API >> level. > > That was discussed and rejected near the very beginning of the Z3 > effort, in my memory. They are too different. Our use of adapters > generally involves looking something up and automatically calling it. > Our use of utilities generally involves simply looking something up > and returning it. It doesn't matter *to the caller* how the adapter / utility lookup works, which is why making the spelling regular for the caller is a good idea. The caller doesn't know any different in the zope.component API: getUtility(IFoo) getAdapter(context, IFoo) They are both lookups, from the caller's perspective. Why should the caller care that the adapter lookup finds a factory and calls it, while the utility lookup (typically) finds a global singleton? Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@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 iEYEARECAAYFAksNeLcACgkQ+gerLs4ltQ6F9gCfXooovAG8fAKZtxL06++hPP/9 8H4AoITGogG8Mv4rg2M/FR1cyyOUZwFk =b2h1 -----END PGP SIGNATURE----- _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )