On Monday, January 28, 2019 10:41:55 PM MST Meta via Digitalmars-d-learn 
wrote:
> On Monday, 28 January 2019 at 22:17:56 UTC, Steven Schveighoffer
>
> wrote:
> > On 1/28/19 3:28 PM, Jonathan Levi wrote:
> >> On Sunday, 27 January 2019 at 09:31:46 UTC, bauss wrote:
> >>> On Sunday, 27 January 2019 at 05:37:57 UTC, Jonathan Levi
> >>>
> >>> wrote:
> >>>> This works in LDC *but not* DMD?
> >>>> . . .
> >>>> Is this a bug in DMD *or* in LDC?
> >>>
> >>> There is no bug here.
> >>
> >> So... LDC is the one that is bugged?
> >
> > Yeah, that's odd. It should be the same result, as they both
> > have the same semantics for the front end.
> >
> > I'll defer to an LDC developer to answer that, but in truth, it
> > really should be the way LDC implements it, even if that's not
> > how the language spec is.
> >
> >> I think it would have been nice to have a way of explicitly
> >> use the super method to implement an interface without having
> >> to rewrite the whole signature.  I thought I remember seeing a
> >> way once, but I must have been dreaming.
> >
> > I agree.
> >
> > BTW, the typeof(super) requirement is super-annoying. alias x =
> > super.x; is clear, I don't see why we need to specify
> > typeof(super) in this context at least.
> >
> > -Steev
>
> It's because aliases do not support context pointers, I'm pretty
> sure.

Yeah. It would be like trying to do something like

alias x = this.x;

As it stands, I believe that super is always either used as a function call
to the constructor or to mean the this pointer for the base class. I don't
think that it ever means the type of the base class - just like this never
means the type of the current class or struct. And their usage is pretty
much identical. They're both either used for calling a constructor or for
accessing the pointer/reference of the object. It's just that one of them is
for the current class or struct, whereas the other is for a base class of
the current class. The only difference in syntax that I can think of between
them at the moment is that this is also used to name constructors when
they're declared, whereas super is not used in that sort of way (since any
constructor that would be referenced by super would be declared with this,
not super).

- Jonathan M Davis



Reply via email to