DIP66 - Multiple alias this

IGotD- nise at nise.com
Mon Sep 28 19:01:44 UTC 2020


On Monday, 28 September 2020 at 18:44:51 UTC, H. S. Teoh wrote:
> [...]
>
> `alias this` is one of the things that seemed like a good idea 
> at the time, but is turning out to be something that leads to 
> code smells.  If anything, we'd like to get rid of it rather 
> than extend it!
>
>
> T

So what is the alternative? I'm not that enthusiastic of mixin 
templates because it just inserts everything like you would copy 
and paste text. That way you have to be careful when using 
several mixin templates that they don't use the exact same 
variable name for example so it kind of becomes inconvenient. 
What happens with private: and public:, do they bleed over into 
the non mixin code?

I like alias this because it still offers a way to encapsulation 
what you want to insert.

Multiple inheritance isn't that much of a problem as interfaces 
solves that but still you want to be able to reuse 
implementations and not create wrappers for inner structs/classes 
by hand in every instance you use it.



More information about the Digitalmars-d mailing list