Help from the compiler when debugging failing template constraints - a pull request

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 15 02:43:58 PDT 2015


On Thursday, 15 October 2015 at 06:46:25 UTC, Ola Fosheim Grøstad 
wrote:
> On Thursday, 15 October 2015 at 01:08:18 UTC, deadalnix wrote:
>> On Wednesday, 14 October 2015 at 20:12:52 UTC, Ola Fosheim 
>> Grøstad wrote:
>>> [...]
>>
>> No virtual dispatch, no downcast possible, no dynamic typeid, 
>> ...
>
> Does this mean that static inheritance for structs can be done 
> as syntax sugar using "alias this" with no semantic changes and 
> get the same semantics as with a class?
>
> E.g.:
>
> struct MySub : MySuper {
> }
>
> translates into
>
> struct MySub {
>   MySuper __super;
>   this(...){ __super.__ctor; ...}
>   ~this(...){ ...; __super.__dtor;}
>   alias __super this;
> }

All I want from static inheritance is exactly what's made 
possible by the `models` PR. I guess I'll write that DIP after 
all.

Atila


More information about the Digitalmars-d mailing list