DIP66 - Multiple alias this

Mike slavo5150 at yahoo.com
Wed Sep 30 01:42:30 UTC 2020


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.


More information about the Digitalmars-d mailing list