Re: improving the utility and adapter lookup APIs

Hanno Schlichting <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On Wed, Nov 25, 2009 at 9:52 PM, Tres Seaver <[email protected]> wrote:
> Hmm, I may be missing something here, but if Foo implements IFoo, then
> the getAdapter lookup for it will short circuit, leading you into
> infinite recursion.  Except that it doesn't:

[snip example]

> which strikes me as wildly disjoint:  the IFoo behavior is "expected"
> (short-circuit the lookup if the object already provides the interface),
> while the getAdapter behavior is a puzzlement.

This has been mentioned numerous times as one of those odd and
unexpected differences between the IFoo vs. get/queryAdapter semantic.
IIRC the only use-case I ever heard of for the getAdapter semantic,
was the possibility to override the behavior promised by the interface
with a different adapter without touching the class that implements
the interface directly.

I think changing this falls into the category of: Small backwards
incompatibly that seem worthwhile to make the behavior consistent and
expected.

Hanno
_______________________________________________
Zope-Dev maillist  -  [email protected]
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 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.