Java 8 extension methods - why aren't they called mixins or traits?

As far as I know, Groovy already has mixins, Scala has traits. The C family has multiple inheritance. So, why is the new functionality in Java called "extension methods"? Is this a different name for the same, or was there a different reason? What are the differences between traits and mixins? what do they add and what do they lack?


Personaly I see them more as "implementation methods" than "extension methods".

+7
source share
1 answer

So, why is the new functionality in Java called "extension methods"?

AFAIK, This name comes from C #. Virtual extension methods are for methods only, while mixins and traits also apply to fields.

Developing an Interface Using Virtual Extension Methods Note: Brian calls them “Protective Methods,” but I believe that “Virtual Extension Methods” are more widely accepted.

JVM Language Summit 2011 - Brian Goetz I'm sure it is here that he talks about why he has this name.

+7
source

All Articles