Multiple alias this, what's the hold up?
Exil
Exil at gmall.com
Wed Jun 19 02:50:25 UTC 2019
On Tuesday, 18 June 2019 at 23:33:12 UTC, user1234 wrote:
> 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.
It's not possible, that's why the compiler would give an error.
It wouldn't even be recursion, it would see both available.
That's if it is even implemented that way. With classes the only
"alias this" that are checked are of the type being used. It
doesn't check the "alias this" of the base class.
https://run.dlang.io/is/EqliF5
More information about the Digitalmars-d
mailing list