Get identifier of "this"

Andre andre at s-e-a-p.de
Mon Sep 17 10:43:24 PDT 2012


Hi,

assuming I have following constuct:

public class Bank{
    public enum test()
    {
      return "writeln(\""~__traits(identfier, this)~"\");";
    }
}

public static void main(){
    Bank b = new Bank;
    mixin(b.test());
}

During compile time, following code should be generated:
writeln("b");

Is this possible? For the demo coding I receive the error, that
"this"
has no identifier.

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list