What should default interfaces be for?

Rémi Forax forax at univ-mlv.fr
Thu Mar 15 16:17:15 PDT 2012


On 03/15/2012 10:42 PM, Richard Warburton wrote:
>>> It's too bad Odersky doesn't say HOW the defender method spec falls
>>> short of supporting Scala traits.
>> On Twitter Odersky said: "In essence, Java 8 default methods only work for
>> traits that do not override methods in base classes."
> I presume he's referring to the way the method call resolution prefers
> methods in the concrete class hierarchy to default methods whenever
> there is a choice between the two.
>
> regards,
>
>    Richard
>

Yes, the 'with' operator in Scala prefers Trait method to Class method.
see Scala Reference section 5.1.2.

Rémi



More information about the lambda-dev mailing list