DIP66 - Multiple alias this
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Sep 30 02:08:50 UTC 2020
On 9/29/20 10:08 PM, Andrei Alexandrescu wrote:
> On 9/29/20 9:42 PM, Mike wrote:
>> On Wednesday, 30 September 2020 at 01:36:59 UTC, Mike wrote:
>>
>>> So, here are a couple of proposals off the top of my head. I imagine
>>> someone more talented than I can think of a few more:
>>>
>>> 1. Deprecate `alias this` for classes, and implement multiple `alias
>>> this` for structs. That will give users the composition feature they
>>> need, and in addition, because structs cannot inherit, it removes the
>>> complexity Walter spoke of.
>>>
>>> 2. Add `opImplicit`, implicit copy constructors, or something of
>>> that ilk. Then users only need to forward members using D's
>>> metaprogramming facilities. Both uses of `alias this` are covered,
>>> but no `alias this` is required. `alias this` can then be deprecated
>>> entirely.
>>>
>>> 3. Add struct inheritance like C++.
>>
>> 4. Somehow allow structs to implement interfaces.
>
> I'd love it if interfaces could implement methods. (All MI related
> issues are related to state, not implementation of methods.)
BTW forgot to mention - this is from the category of removing limitations.
More information about the Digitalmars-d
mailing list