DIP66 - Multiple alias this
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Sep 30 12:34:03 UTC 2020
On Wed, Sep 30, 2020 at 07:54:39AM +0000, Paolo Invernizzi via Digitalmars-d wrote:
> On Wednesday, 30 September 2020 at 01:36:59 UTC, Mike wrote:
> > On Monday, 28 September 2020 at 19:55:10 UTC, Andrei Alexandrescu 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.
>
> This!
>
> We've never used alias this for classes, I'm wondering if there's
> something like that in Phobos, or in other projects ...
[...]
I haven't used alias on classes either, but I did frequently use alias
this on structs that wrap classes. Which may lead to some of the same
complexity: struct S implicitly converts to class C which may in turn
implicitly convert to base class B or interface I. But probably not as
horrible as using alias this inside a class.
T
--
Three out of two people have difficulties with fractions. -- Dirk Eddelbuettel
More information about the Digitalmars-d
mailing list