I'd like to summarize the options I've seen appear in the discussion so far.
We have the following options:
1) introduce a new method, such as "instance()" or "lookup()" on
instance. It unifies utilities with adapters. We can make it do whatever
we want without worrying about backwards compatibility.
2) introduce several new methods that distinguish between utility and
adapter lookup. We can make them do whatever we want without worrying
about backwards compatibility.
3) call the interface, which unifies adapter and utility lookups. Use
tuples for multi adaptation. We think could make this work without *too*
much backwards compatibility issues (pending research on how prevalent
tuple adaptation really is). In the long term we can even map out a
deprecation strategy that can smoothly migrate us to a "multi argument"
4) call the interface, which unifies adapter and utility lookups. Use
multiple arguments for multi adaptation. The backwards compatibility
obstacles are largest here as we already have the "default" argument.
We'd need to introduce multiple "modes" to selectively upgrade.
I'm in favor of calling the interface. I'm also in favor of unifying
adapter and utility lookup.
On the back end, I'm also in favor of allowing utility creation by
factory (or "null adaptation") and allowing instance lookup for
instances ("contextual utility lookup" or "adaptation to an instance").
I think four ways to retrieve an object of the right interface
(combining factory/registered instance and lookup globally/lookup for an
instance) is a good argument *against* distinguishing between creation
strategies or "connection to adapted object or not" in the API.
If I look up a utility I wouldn't want to care whether it happened to be
a previously registered instance or a factory created one. If I look up
an adapter I wouldn't care whether it happened to be a previously
registered instance either. In fact, returning a previously registered
instance can be very well implemented using a factory. (In fact, this
suggests to me we should actually explore implementing instance
registration in terms of special factories.)
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -