On 2019-02-27 the LDM met to make some decisions about the default interface methods feature.
[Plan A]: We decided that the best design for the base(I).M feature would be that we lookup M in the interface type I, and the result must be accessible. Moreover, there is a requirement that if the found member is abstract, the type I must have a unique most specific (concrete) implementation in the type I. The compiler would emit IL that identifies the method found, and the type I, and the runtime would select the most specific (concrete) implementation in the type I and invoke it (or throw an exception if there is no unique most specific implementation at runtime). There is no IL defined today that would serve this purpose, so we would have to design it. (One option would be to generate a "constrained" prefix with the interface type I). The IL should not assume or require that the implementing method is accessible to the caller (e.g. it could be private), but it does require that the declared method named in the IL is accessible.
Unfortunately, we do not believe we have the resources to design and implement the feature in this form (plan A) before we'd like to deliver its first implementation (hopefully in C# 8.0). So initially, we'll ship a language feature that is more constrained. This is our plan B for C# 8.0:
[Plan B]: We lookup M in the interface type I, and the result must be accessible. Moreover, there is a requirement that the found member must have an implementation directly in the type I, and that implementation method must be accessible. The compiler will produce IL that directly (non-virtually) invokes that method.
We expect to ship plan B in C# 8.0.
This issue is for moving to plan A in a subsequent language version.
Update: LDM 04-29-2019 cut base() from C# 8.0.
On 2019-02-27 the LDM met to make some decisions about the default interface methods feature.
[Plan A]: We decided that the best design for the
base(I).Mfeature would be that we lookupMin the interface typeI, and the result must be accessible. Moreover, there is a requirement that if the found member is abstract, the typeImust have a unique most specific (concrete) implementation in the typeI. The compiler would emit IL that identifies the method found, and the typeI, and the runtime would select the most specific (concrete) implementation in the typeIand invoke it (or throw an exception if there is no unique most specific implementation at runtime). There is no IL defined today that would serve this purpose, so we would have to design it. (One option would be to generate a "constrained" prefix with the interface typeI). The IL should not assume or require that the implementing method is accessible to the caller (e.g. it could be private), but it does require that the declared method named in the IL is accessible.Unfortunately, we do not believe we have the resources to design and implement the feature in this form (plan A) before we'd like to deliver its first implementation (hopefully in C# 8.0). So initially, we'll ship a language feature that is more constrained. This is our plan B for C# 8.0:
[Plan B]: We lookup
Min the interface typeI, and the result must be accessible. Moreover, there is a requirement that the found member must have an implementation directly in the typeI, and that implementation method must be accessible. The compiler will produce IL that directly (non-virtually) invokes that method.We expect to ship plan B in C# 8.0.
This issue is for moving to plan A in a subsequent language version.
Update: LDM 04-29-2019 cut
base()from C# 8.0.