Why can't we derive struct's?

Walter Bright newshound2 at digitalmars.com
Fri Dec 21 21:46:45 UTC 2018


On 12/21/2018 11:08 AM, Steven Schveighoffer wrote:
>> The issues I've seen in bugzilla are how alias this overrides default expected 
> behavior of classes. In other words, if you have a base class and want to cast 
> it to a derived, and the base class has an alias this, it stupidly tries the 
> alias this, and won't even consider a dynamic cast.
> 
> It's not madness so much as poor implementation. Saying there are bugs in the 
> alias this implementation is not the same as saying the feature is problematic. 
> All that is needed is a good definition of what takes precedence -- we already 
> have that, it's just not implemented properly.

The ones I reviewed do not have easy answers as to what the correct behavior 
"ought" to be, and it certainly is not spec'ed in the specification.


> But MI is not multiple alias-this.

It fundamentally is. (Though I agree it doesn't have the virtual base "diamond 
inheritance" issue.)



More information about the Digitalmars-d mailing list