[Zope3-dev] N-Tuple Adapters
Leonardo Rochael Almeida
leo@hiper.com.br
02 Jun 2003 20:34:50 -0300
On Mon, 2003-06-02 at 18:42, Shane Hathaway wrote:
> I've been pondering the idea of "n-tuple adapters". The idea is that
> some adapters require multiple independent inputs. Steve came up with
> the good name.
>
> [...]
>
> Would three-tuple and four-tuple adapters be useful? Well, in thinking
> about all of this, I realized that n-tuple adapters are generic problem
> solvers. When querying the adapter registry, the application provides
> inputs and asks for a component that can solve some problem using those
> inputs. An n-tuple adapter registry is the digital version of
> MacGuyver: you have a chess board, a clothesline, a match, and shoes.
ROFL :-)
> How are you going to start that car? ;-) Adapters, especially adapters
> that accept multiple inputs, add a limited form of problem-solving
> intelligence to the system.
>
> With n-tuple adapter registries, we might begin to solve a whole new
> class of problems. There could be numerous applications not only for
> Zope, but computing in general.
This smells like prolog.
> There's just one snag: how would we search for n-tuple adapters in a
> scaleable way, taking interface hierarchy into account? A naive
> implementation would perform a multi-dimensional search, where the
> number of dimensions corresponds with the number of items in the input
> tuple. To find an adapter that accepts (IFooFolder, IHTTPRequest), we
> have to search for a registered adapter that requires a set of
> interfaces, in the following order:
>
> 1. (IFooFolder, IHTTPRequest)
> 2. (IFolder, IHTTPRequest)
> 3. (IFooFolder, IRequest)
> 4. (IFolder, IRequest)
And this smells like Java type-based Method Resolution...
Cheers, Leo
--
Ideas don't stay in some minds very long because they don't like
solitary confinement.