Virtual extension methods -- a strawman design

Howard Lovatt howard.lovatt at gmail.com
Mon May 24 15:48:10 PDT 2010


If you recompile AB then you get an error. If you don't recompile AB
and call m then you get an Exception. As I said, this is reasonable
behaviour and so is a load error, i.e. either option fine by me.

On Monday, May 24, 2010, Neal Gafter <neal at gafter.com> wrote:
> On Mon, May 24, 2010 at 1:06 AM, Howard Lovatt <howard.lovatt at gmail.com> wrote:
>> Just to clarify my reading of the spec:
>>
>> If we initially have:
>>
>> interface IA {}
>> interface IB {}
>> class A implements IA {}
>> class B implements IB {}
>> class AB implements IA, IB {}
>>
>> Then modify:
>>
>> interface IA { extension int m() default IAs.m; }
>> interface IB { extension int m() default IBs.m; }
>>
>> And we don't recompile the classes A, B, and AB then A and B will work
>> just fine and as expected, however AB will throw an exception if m is
>> called.
>>
>> I think that this combination of:
>>
>> 1. Adding the same extension method signature to multiple interfaces
>> 2. Not recompiling classes that implement more than one of these interfaces
>> 3. Calling the extension method on the non re-compiled classes
>
> I would expect a compile-time ambiguity when compiling the invocation
> in this case.
>

-- 
  -- Howard.


More information about the lambda-dev mailing list