structs, classes, interfaces - Part III, Solution

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Sun Sep 2 15:56:18 PDT 2007


Reiner Pope wrote:
 
> I wonder if we can extend the alias this syntax to get rid of the
> unnecessary symbols. Since, conceptually, aliasing just "binds" the
> second name to the first, giving the first variable a new name, why
> don't we just allow variables to be named "this". The code above becomes
> 
> struct C : IA, IB {
>      A this;
>      B this;
> }
> 
> To me it's quite consistent with "alias  b this".

Maybe I'm missing something, but why should alias be used in the first
place? Currently it's only a weak typedef (extended to other symbols) with
some overloading semantics. Adding mixin-like behavior inside structs feels
a bit inconsistent to me at least. Would it also allow aliasing some
symbols outside the struct? Doesn't it complicate metaprogramming a bit by
mixing runtime and compile time code?



More information about the Digitalmars-d mailing list