[Python-3000] Abilities / Interfaces: why not adapt()?
Guido van Rossum
guido at python.org
Tue Nov 21 17:24:11 CET 2006
On 11/21/06, tomer filiba <tomerfiliba at gmail.com> wrote:
> adapt() is a "casting" mechanism, whereas generic functions are
> dispatch mechanism (multimethods)... i'd guess there are some
> overlapping characteristics, but they are different by concept. [1]
You're wasting everybody's time. We went over this last time. Please
read the archives.
Quick summary: using generic functions, you can trivially implement
adapt() or anything like it -- and lots of other things. Either way,
interfaces or abilities add hugely to the usability -- without them,
you're bound to dispatch only on concrete classes, which have severe
limitations for this purpose. There's a reason Zope has interfaces
*and* adapt -- they go together. So do generic functions and
interfaces.
References (these don't mention interfaces yet, but they explain how
having generic functions makes it unnecessary to have adapt as a
central mechanism):
http://www.artima.com/weblogs/viewpost.jsp?thread=155123
http://www.artima.com/weblogs/viewpost.jsp?thread=155514
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list