DIP66 - Multiple alias this

12345swordy alexanderheistermann at gmail.com
Tue Sep 29 13:17:50 UTC 2020


On Tuesday, 29 September 2020 at 03:53:02 UTC, Walter Bright 
wrote:
> On 9/28/2020 12:55 PM, Andrei Alexandrescu wrote:
>> [...]
>
> There are several bugzilla issues on alias this that aren't 
> fixed because there was no clear way to do it that both made 
> sense and did not break existing code.
>
> If a class hierarchy has alias this, when does the compiler go 
> looking down the alias this, and when does it go looking at the 
> base class and interfaces? (Of course the base class can have 
> an alias this, and an alias this can have a base class.) You 
> have essentially *two* multiple inheritance systems in play at 
> the same time, each obeying different rules.
>
> Couple that with the current arbitrary random rules about how 
> alias this behaves for classes, and any coherent MI alias this 
> scheme would randomly break existing code.

You could take Manu Evans advice and allow structs to inherent 
from other structs traditionally like in c++ and deprecate alias 
this.

That would solve 80 percent of the problem.

- Alex


More information about the Digitalmars-d mailing list