Why can't we derive struct's?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Dec 20 16:10:39 UTC 2018


On Thu, Dec 20, 2018 at 03:44:34PM +0000, 12345swordy via Digitalmars-d wrote:
> On Thursday, 20 December 2018 at 15:29:50 UTC, H. S. Teoh wrote:
> > On Thu, Dec 20, 2018 at 12:15:53AM -0800, Manu via Digitalmars-d wrote:
> > > On Wed, Dec 19, 2018 at 7:45 PM Walter Bright via Digitalmars-d
> > > <digitalmars-d at puremagic.com> wrote:
> > [...]
> > > > > Why should it be impossible to derive a struct?
> > > >
> > > > Because polymorphism makes little sense for a value type.
> > > 
> > > It's not really polymorphism without a vtable, just simple
> > > extension. `alias this` produces the same result, it's just more
> > > wordy, kinda ugly, and boilerplate-ey. It also hogs the `alias this`
> > > slot.
> > [...]
> > 
> > Sigh... when is multiple alias this ever going to happen??
> > 
> > 
> > T
> 
> When IgorStepanov quit disappearing on us.
> https://github.com/dlang/dmd/pull/8378
[...]

IIRC, that PR was blocked because of disagreements over how ambiguous
symbols over multiple alias this types would be resolved.  Somebody
needs to come up with a DIP with well-defined semantics for all the
details and corner cases before this can move forward.


T

-- 
"Maybe" is a strange word.  When mom or dad says it it means "yes", but when my big brothers say it it means "no"! -- PJ jr.


More information about the Digitalmars-d mailing list