how is this array subtyping inside struct (bug?) possible?

RazvanN razvan.nitu1305 at gmail.com
Tue Aug 11 08:23:33 UTC 2020


On Monday, 10 August 2020 at 20:42:34 UTC, Steven Schveighoffer 
wrote:

> The fault here is Phobos for accepting classes as ranges (range 
> classes are IMO an abomination that should never be used).
>
Honestly, I think that the real problem here is that alias this 
can be used with classes. I would argue that alias this should be 
available only for structs because:

1. There are no rules that define precedence: which should have 
priority alias this or one of the parents?
2. For classes you already have the inheritance mechanism and 
therefore alias this basically invites multiple inheritance into 
the problem (with its known issues: the diamond problem).

It would be easier for everyone if alias this would be banned and 
classes and just stick to structs.

Cheers,
RazvanN




More information about the Digitalmars-d mailing list