Can we just have struct inheritence already?

Manu turkeyman at gmail.com
Mon Jun 10 18:30:32 UTC 2019


On Mon, Jun 10, 2019 at 2:55 AM Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 6/9/2019 10:52 PM, Manu wrote:
> > That is indeed the feature that necessitates my 'solution'
>
> One possibility is that if the alias this is referring to a struct with no
> fields, it gets a 0 size. This will mimic the behavior of C++.

The struct exists as a member irrespective of the alias this.
And at this point, you have implemented struct inheritance in absolute
terms, but why would you prefer an ugly and unclear syntax to specify
it?
Inheritance syntax is blindingly obvious and easy to see, base-struct
+ alias this is awkward to spot; the base member could be anywhere,
and the `alias this` may or may not be present (you have to go looking
for it), and the line may not even be nearby...


More information about the Digitalmars-d mailing list