[Python-3000] PEP 3100 Comments
Phillip J. Eby
pje at telecommunity.com
Tue May 9 18:46:04 CEST 2006
At 09:35 AM 5/9/2006 -0700, Bill Janssen wrote:
>Phillip Eby writes:
> > In Haskell, interfaces are defined using "typeclasses". A typeclass is
> > basically a collection of generic functions. For example, you could
> define
> > ...
> > Further, Haskell has a concept of "typeclass instances" which basically
> > give you adaptation. For example, suppose I have some generic functions
>
>Thanks, Phillip. That's essentially what I'm talking about with CL
>mixins, as well (though instead of typeclass instances you usually
>have mixin implementations which are "mixed" into the class which
>wishes to provide the interface, to give it the methods).
Unless this can be done by a third party, it's not at all the same
thing. Currently in Python for a third party to add a mixin, they would
have to hack the class's __bases__, which I am not suggesting here at all.
In fact, it's pretty much the opposite of what I'm suggesting -- you
shouldn't *have* to make such declarations, let alone monkeypatch a class's
__bases__.
>That's what
>I think Py3K should be using, too, instead of "duck typing", which for
>some reason has come to be thought of (wrongly) as a "feature".
I don't see that discussion as being even remotely related to what I'm
talking about, so please don't count my comments as being against duck
typing or supporting its removal.
Indeed, I consider my suggestion to be support for *extending* duck typing,
and a vote *against* typing by inheritance. You seem to be very confused
about what I said.
More information about the Python-3000
mailing list