[Issue 2631] alias symbol this;
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 29 05:12:16 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2631
------- Comment #6 from site.puremagic.com at brianguertin.com 2009-01-29 07:12 -------
(In reply to comment #5)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Oh, and aliasing this should also nicely take care of the "inner name trick":
> > >
> > > template Blah!(T) { alias T Blah; }
> > >
> > > becomes
> > >
> > > template Blah!(T) { alias T this; }
> > >
> > > Much cleaner because it clarifies the intent and allows "one point of
> > > renaming".
> > >
> >
> > struct S
> > {
> > mixin Blah!(int); // what happens?
> > }
> >
> > If 'this' always refers to the template, you can't do cute things like mixing
> > in support for operations on values of type S.
> >
> > If 'this' refers to the template sometimes and to the enclosing scope in
> > others, it's confusing.
>
> Could the usual scope differentiation syntax be used?
> alias T this; // I mean the template itself
> vs
> alias T .this; // I mean the this in the outer scope
>
> Granted the "scopes" aren't actually different when you mix-in a template, but
> I think the intent is clear enough.
>
would this make sense?
alias T template; // I mean the template itself
vs
alias T this; // I mean the this in the outer scope
--
More information about the Digitalmars-d-bugs
mailing list