Can we just have struct inheritence already?

Manu turkeyman at gmail.com
Mon Jun 10 08:03:32 UTC 2019


On Mon, Jun 10, 2019 at 12:30 AM Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 6/9/19 5:13 PM, Manu wrote:
> > This is NOT polymorphism, we're not talking about polymorphism, I wish
> > people would not change the topic.
>
> The problem here is that it's difficult to define subtyping without
> polymorphism. C++ does technically allow it, but code such as:
>
> struct my_vector : public std::vector<int> { ... }
>
> is universally reviled. I really think it wouldn't help D much to add
> struct inheritance.

We do it anyway though, it's just terrible.
How will it cause any harm to anybody? I hate this idea that something
has shown to be sorely missed for so long, and we still can't
reconsider it because some moron out there might write bad code?
D almost exclusively attracts power-users, who have unbelievably
complex software to get on with. Tools are good, especially tools like
this which only make a shitty piece of existing language much cleaner
and simpler to reason about.


More information about the Digitalmars-d mailing list