[Zope3-dev] Ranking adapters (2nd try)
Phillip J. Eby
pje at telecommunity.com
Tue Sep 30 13:15:15 EDT 2003
At 07:52 PM 9/30/03 +0300, Steve Alexander wrote:
>Here's my rationale:
>
>* A112 disappears because it is a registration for exactly the same
>from->to as A212.
>
>* I put A111 before A110 because B1 is more specific than B0. A B1 can do
>all of what a B0 can do. Liskov substitutably etc.
Note that historically, Zope interface adapter registries have considered
an adapter for a more general interface to take precedence over an adapter
for a more specific interface. I originally questioned the wisdom of this,
but then later realized that it was a good idea, for reasons that currently
escape me. :( All I remember is that I found it to be a good idea in
practice, even though in theory I agreed with your assessment above. ;) I
then wrote PyProtocols to follow the same rule, on the basis of
"implication distance".
That is, although a B1 is substitutable for a B0, it is *not* a B0. If you
ask for a B0, and there is a B0 adapter declared, then that should take
preference over an adapter to B2.
More information about the Zope3-dev
mailing list