From virtual extension methods to mixins
Brian Goetz
brian.goetz at oracle.com
Thu Jul 12 13:21:14 PDT 2012
I dislike the unqualified phrase "multiple inheritance" because it wraps
so many things together. Java has always had some form of multiple
inheritance (specifically of types, in that a class or interface can
inherit from multiple interfaces). Overall people seem to like
interfaces. So clearly the concept of multiple inheritance can't be so
fatally broken that some limited form makes a language unworkable.
Many of the problems of "multiple inheritance" come from multiple
inheritance of state. We've not gone there.
But simply saying "I think there is no good way, so don't do it" is not
really all that constructive, and besides this ship sailed a while ago.
Are we constrained by decisions of the past? Of course. But, we're a
victim of our own success. Well designed APIs may be useful for a long
time, but none is useful forever. APIs need a mechanism for evolving,
or they will become increasingly constraining to use, and replacing them
is expensive.
On 7/12/2012 4:04 PM, Tom Hawtin wrote:
> To be clear, I am saying there exists no good way to resolve the
> problems of multiple inheritance. The particular solution to colliding
> abstract methods from the existing specification is (presumably) going
> to have to do (although the whole defender method thing seems a perverse
> response to an old library design fault). Of course, multiple
> inheritance (of interface or interface with code) should be actively
> discouraged.
>
> Tom
>
More information about the lambda-dev
mailing list