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:
On Wednesday, 14 October 2015 at 13:32:54 UTC, Atila Neves wrote:
ever get approved. My original plan was to write a DIP for "static inheritance",

I would be intersted in seeing a detailed analysis on the difference between inheritance and "alias this" over the first struct member.

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;
}


Reply via email to