DIP66 - Multiple alias this
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Sep 30 05:54:39 UTC 2020
On Wed, Sep 30, 2020 at 12:48:56AM -0400, Steven Schveighoffer via Digitalmars-d wrote:
> On 9/30/20 12:12 AM, H. S. Teoh wrote:
> > > On Wednesday, 30 September 2020 at 02:08:17 UTC, Andrei Alexandrescu wrote:
> > [...]
> > > > I'd love it if interfaces could implement methods. (All MI
> > > > related issues are related to state, not implementation of
> > > > methods.)
[...]
> > Don't we already have this in D?
> >
> > interface I {
> > void method1(); // overridable method
> > final void method2() {} // default method
> > }
> > class C : I {
> > void method1() {}
> > }
> >
> > Of course, currently method bodies in interfaces are only allowed
> > when it's final. This may or may not correspond with what C# does.
>
> It looks like default method bodies are virtual and can be overridden.
>
> I sort of remember at least having discussions about doing something
> like this, but I don't think it ever happened.
[...]
If we allow virtual non-abstract methods in interfaces, that would
certainly be MI. Though I'm guessing some people won't be happy until
interfaces also carry state... :-P
T
--
You are only young once, but you can stay immature indefinitely. -- azephrahel
More information about the Digitalmars-d
mailing list