Multiple alias this, what's the hold up?

Timon Gehr timon.gehr at gmx.ch
Sun Jun 16 14:39:54 UTC 2019


On 16.06.19 08:08, Walter Bright wrote:
> On 6/15/2019 6:21 PM, Timon Gehr wrote:
>> In terms of lookup, the issues with multiple alias this are the same 
>> as the issues with multiple import declarations. Implicit conversions 
>> could use the same lookup rules, but there would need to be a way to 
>> disambiguate. The code in the compiler that implements import 
>> declarations is unlikely to be easily reusable.
> 
> Multiple alias this is multiple inheritance.

No. It's multiple imports. You have no vtable to populate, so you can 
just throw a compile-time error if some lookup is ambiguous and require 
explicit disambiguation, like for imports.

> Generally, if you find 
> yourself wanting multiple inheritance, it's likely time to rethink the 
> data structures.

Only if your programming language gets MI wrong. C++ gets MI wrong. This 
is how to do multiple inheritance: 
https://www.eiffel.org/doc/eiffel/ET-_Inheritance

(Ignore the section about covariance. Eiffel gets that part totally wrong.)


More information about the Digitalmars-d mailing list