Can we just have struct inheritence already?

Manu turkeyman at gmail.com
Tue Jun 18 12:17:36 UTC 2019


On Tue, Jun 18, 2019 at 7:25 PM Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 6/13/2019 5:03 AM, Timon Gehr wrote:
> > I think a lot of the default opposition to new features (especially if they can
> > be implemented with a moderate amount of user code) is about DMD compiler
> > complexity, about adding new things to a code base which already suffers quite a
> > bit from incidental complexity.
>
> D has a TON of features. And yet every single day, people demand ever more
> features. How can this possibly work without turning D (and the compiler) into a
> unusable mess. I have no choice but to constantly say "no".

I'm pretty much just into feature uniformity at this stage. D's
biggest problem from my perspective is "weird shit", mostly
non-uniform arbitrary limitations and strange edge cases.
And also that shared doesn't work.

> As for struct inheritance, it seems what Manu really wants isn't struct
> inheritance at all, it is zero sized structs having zero size when they are used
> as fields.

As base structs specifically. I really want struct inheritance, and
zero sized fields does happen to be one thing that falls out of that.
There are 2 things I hate about it; one is the crappy static-if hack
required to deal with zero-sized bases, the other is that I have to
use `alias this` to describe a base.
alias this *should* be a very niche feature, but instead we abuse it
in lieu of struct inheritance, and no way to perform implicit
conversion. In both cases it's a gross code smell, and I hate it.

> First off, he has a workaround for it. I agree it's not very pretty, but it
> works and he is not blocked. That moves it way down on the priority list.

I agree. The thread was just to re-iterate my strong discontent, and
frankly, boredom with the situation.

> Secondly, there are template mixins, which have zero size.

That's feels even worse than my crappy hack to me.
Anyway, shared is my #1 concern.


More information about the Digitalmars-d mailing list