DIP66 - Multiple alias this

IGotD- nise at nise.com
Wed Sep 30 09:08:14 UTC 2020


On Wednesday, 30 September 2020 at 01:36:59 UTC, Mike wrote:
>
> 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. Remove "alias this" completely, use mixin templates instead. I 
originally misunderstood template mixins believing it was more or 
less just expansion into the scope. It turns out that there is a 
lot more going on under the hood, which makes the template mixin 
work like inheritance. This currently badly documented which 
makes people believe that template mixins are more limited.



More information about the Digitalmars-d mailing list