Defender methods and compatibility

Neal Gafter neal at gafter.com
Tue Nov 23 16:11:34 PST 2010


On Tue, Nov 23, 2010 at 11:31 AM, Brian Goetz <brian.goetz at oracle.com>wrote:

> While this restriction may be unsatisfying, this is really not all that
> different from the existing SC* behavior of add-meth.
>

Indeed this (binary incompatibility with mod-extn) is particularly
unsatisfying because the binary compatibility rules are designed
specifically to be insensitive to changes of implementation details.  The
code which implements an extension method is just such an implementation
detail.  The analogy to add-meth is inappropriate because add-meth is a
change to the public API (not merely implementation details).

Fortunately, you can do much better by removing the special rule about
allowing inheriting multiple extension methods with the same default
(without ambiguity).  Without this rule, programmers will explicitly resolve
the ambiguity at the point where multiple extensions with the same signature
are inherited.  In that case changing an extension method's default is both
source and binary compatible.

Given that a satisfying solution exists, there is no reason to settle for an
unsatisfying one.


More information about the lambda-dev mailing list