http://d.puremagic.com/issues/show_bug.cgi?id=2631





------- Comment #5 from wbax...@gmail.com  2009-01-28 22:37 -------
(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.


-- 

Reply via email to