Multiple alias this is coming.
IgorStepanov via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Fri Sep 19 12:22:40 PDT 2014
On Friday, 19 September 2014 at 18:49:57 UTC, Jesse Phillips
wrote:
> On Thursday, 18 September 2014 at 20:11:12 UTC, IgorStepanov
> wrote:
>> Do you ask about alias this or about it multiple usage.
>> Multiple usage is similar to single, but multiple:)
>
> Just an FYI, bearophile is very knowledgeable about D and one
> of the oldest community members, he holds the record for most
> bugs opened.
>
> This doesn't mean he knows everything, but it certainly makes
> it clear he was asking, "why would you want to use multiple
> alias this." As others mention kind of like "why would you want
> to use multiple inheritance."
Sorry, I'll note it.:)
>why would you want to use multiple inheritance.
I've written example with interface inherinatce.
Structs can be preferable then classes, when I want to manage
them allocating manually. When you use D as "better C", powerfull
struct's can be a you choise.
Multiple alias this (and therefore multiply inheritance) makes
structs almost as powerful as classes.
Another my motivation of doing this work is a implementing alias
this inheritance (from base class).
Situation when B can be casted to C and D, A can be casted to B
and C but cannot be casted to D is wrong:
class B : C
{
alias d this;
D d;
}
class A : B
{
}
A a = new A;
D d = a; //NG -> OK
More information about the Digitalmars-d-announce
mailing list