Default implementations in inherited interfaces
Jonathan Marler via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 24 00:54:11 PDT 2016
On Thursday, 21 July 2016 at 13:37:30 UTC, Saurabh Das wrote:
> On Thursday, 21 July 2016 at 12:42:14 UTC, Adam D. Ruppe wrote:
>> On Thursday, 21 July 2016 at 09:41:27 UTC, Saurabh Das wrote:
> Java 8 has a 'default' keyword that allows interfaces to
> provide a default implementation and sub-classes can optionally
> override it if needed. The rationale behind it was extending
> interfaces without causing old code to faill. (called "virtual
> extension methods" or "defender methods"). The use case is
> similar to above.
>
> Is there a way to achieve an equivalent functionality in D?
>
> Thanks,
> Saurabh
What an interesting technique. I've never seen this before. Maybe
a DIP is in order? I think it would be low priority relative to
the current work being done, but this technique seems like a good
thing to support in the language.
More information about the Digitalmars-d-learn
mailing list