[Zope-dev] implementing zope.component 4.0

Lennart Regebro regebro at gmail.com
Sat Nov 28 10:55:34 EST 2009


On Sat, Nov 28, 2009 at 16:39, Charlie Clark
<charlie.clark at clark-consulting.eu> wrote:
> So adapters are reduced to type conversion?

That's what adapters are. They aren't reduced to it, it's what they
do. They adapt one object with one interface to have another
interface. That can indeed be seen as a type conversion.

> Thanks for the comparison but it is semantically so different and
> interfaces can be used for things other than adapters that I disagree.

Yes but adapters can only be used as adapters, and the topic was the
syntax for adapting an object.

> The
> most common example I know of the syntax is with INameChooser() which
> brings us back to the differences (real or imaginary) between utilities
> and adapters.

I agree that calling an interface like that is a strange thing to do.
I don't know what that would do, even. I have however never ever seen
that done.

> It's quite likely that I'm wrong in this but I see great potential using
> adapters for delegation rather than straight conversion.

But the delegation is adaptation. There is no difference.

> I have very much
> come to appreciate the power of this delegation in, say, BrowserViews;
> even if it did take me several months to understand the multiadapter
> pattern!

I hear this a lot, so this is apparently something that is common to
take a while to grasp. Any ideas of what to make multi-adapters more
understandable would probably be a good thing.

-- 
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64


More information about the Zope-Dev mailing list