Can we just have struct inheritence already?

Manu turkeyman at gmail.com
Fri Jun 14 05:57:30 UTC 2019


On Thu, Jun 13, 2019 at 6:13 PM 12345swordy via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Thursday, 13 June 2019 at 23:28:37 UTC, Manu wrote:
> > On Thu, Jun 13, 2019 at 4:05 PM 12345swordy via Digitalmars-d
> > <digitalmars-d at puremagic.com> wrote:
> >>
> >> On Thursday, 13 June 2019 at 22:12:37 UTC, Manu wrote:
> >> > On Thu, Jun 13, 2019 at 7:55 AM 12345swordy via
> >> > Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> >> >>
> >> >> > [...] It's not better.
> >> >>
> >> >> Wouldn't it be better to allow structs to implement static
> >> >> only interfaces?
> >> >
> >> > I don't know what that means? Like D `interface`, which is a
> >> > pure vtable with no data members? That's the opposite of
> >> > what I want... what is a 'static' interface?
> >>
> >> Interface with only static functions and data members. No
> >> virtual function what so ever.
> >
> > Well... right. We're talking about struct's here. struct's
> > don't have virtual functions.
> I am saying that structs should be allow to inherent interfaces,
> provided that said interface only contains statics functions(with
> or without implementation) or data members.

I think that's much more weird than struct's inheriting a struct... an
interface is everything other than a static non-virtual type... a
struct is *exactly* that.

> What you want is the ability to define a contract for the structs
> to inherited without any virtual functions.

I would expect something different from a "contract"; that sounds like
some expectations without some concrete details defined. And again,
this is the opposite of that.


More information about the Digitalmars-d mailing list