Multiple alias this, what's the hold up?

user1234 user1234 at 12.de
Tue Jun 18 23:33:12 UTC 2019


On Tuesday, 18 June 2019 at 00:58:58 UTC, Exil wrote:
> On Sunday, 16 June 2019 at 22:14:19 UTC, Walter Bright wrote:
>> On 6/16/2019 7:39 AM, Timon Gehr wrote:
>>> On 16.06.19 08:08, Walter Bright wrote:
>>>> Multiple alias this is multiple inheritance.
>>> 
>>> No. It's multiple imports.
>>
>> D already has multiple imports with template mixins. If 
>> multiple imports is what people want, it's already there.
>
> Isn't there an entire thread arguing for the inclusion of 
> *single* inheritance. Not sure how you can say we have multiple 
> inheritance without even having inheritance (for structs).
>
>>>> 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.)
>>
>> Designing a decent object is hard enough, and most everybody 
>> (including me) do a lousy job of it. When people start using 
>> MI, the mess becomes incredible. Maybe in another 20 years ago 
>> I'll get good enough to be able to write a sensible MI object.
>
> I feel like without virtual functions it isn't really multiple 
> inheritance. Alias this is just syntactic sugar so that you 
> don't have to specify the variable to use it. Things like the 
> diamond problem don't exist because you can't override 
> functions in structs.

The diamond problem in theory is possible but the compiler 
implementation would error with recursion when making type 
semantic.


More information about the Digitalmars-d mailing list