DIP66 - Multiple alias this

Walter Bright newshound2 at digitalmars.com
Tue Sep 29 03:53:02 UTC 2020


On 9/28/2020 12:55 PM, Andrei Alexandrescu wrote:
> I'd love to get a better idea about this, e.g. a few clear examples of bad uses 
> and other few good examples where it's a win. My intuition vaguely revolves 
> around "aliasing to an rvalue is bad and lvalue is good" but I year for clarity.

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.


More information about the Digitalmars-d mailing list