Is `alias this` a mistake?

Mike slavo5150 at yahoo.com
Wed Aug 4 00:29:21 UTC 2021


On Tuesday, 3 August 2021 at 15:52:07 UTC, NonNull wrote:
> Here, further down, I just saw Walter indicate his opinion that 
> `alias this` is a mistake. Any thoughts?
>
> https://news.ycombinator.com/item?id=28029184

`alias this` don't have much value for classes, as the same can 
be achieved with interfaces, inheritance, and D's killer 
metaprogramming facilities.

Where `alias this` does have value is with structs.

My suggestion has been to deprecate (or at least discourage) 
`alias this` for classes, but invest more in `alias this` for 
structs (e.g. add multiple `alias this` features for structs).

More on that can be read at 
https://forum.dlang.org/post/vggskphkqxtriqnavmnf@forum.dlang.org


More information about the Digitalmars-d mailing list