Can we just have struct inheritence already?

Exil Exil at gmall.com
Thu Jun 13 03:43:16 UTC 2019


On Wednesday, 12 June 2019 at 06:00:12 UTC, H. S. Teoh wrote:
> This is kinda contrived, though, and honestly I would vote for 
> not supporting this sort of usage.  But it's the kind of thing 
> certain people might get up in arms about, if this behaviour 
> were changed.
>
>
>> Or, heck, even just have it share an address with another data 
>> member. That or the null thing, I see no realistic problem 
>> either way. Or if you really want to be needlessly clumsy 
>> about it, have an attribute or pragma or something that says 
>> "If this field is a zero-byte struct, then for the love of god 
>> make it zero byte, I don't even care how you do it."
>
> Maybe just alias it to void[0], like somebody proposed?

Since you'd still have to "alias this" the alias, it would 
probably cause more problem as it would now act as an array in 
some regard.

>> And yea, sure, of course we have bigger fish to fry. But that 
>> should never be a reason to say "The mistake is realistically 
>> fixable, but NO, never gonna anyway!" instead of "Right, that 
>> was a mistake and it's fixable. We should fix it sooner or 
>> later BUT it's not a high priority right now."
>
> In fact, I agree.  But I'm also not holding my breath for D 
> leadership to change this attitude anytime soon. Cf. the bool 
> fiasco, the char -> int implicit conversion (C promotion rules) 
> fiasco, autodecoding (which is by now universally acknowledged 
> as a mistake, but nobody has yet dared to take the first step 
> to actually kill it), etc..
>
> At some point, I seriously want to entertain the idea of D3. It 
> used to be immediately shot down as not being likely, but with 
> Andrei's recent change of stance about std.v2, there's a faint 
> glimmer of hope that perhaps one day D3 could become reality.
>
>
> T

Don't think it will. If D3 happens, then that means there will be 
D2 code that can't work with D3. Creating a std.v2 means that old 
code can just use the old version of the std and still work 
without having to rewrite their code. They can also use new D 
features while still using the old std library. One is a lot 
easier to deal with than the other.


More information about the Digitalmars-d mailing list