function name of the current function
enum name_another = "another"; import std.algorithm.searching : countUntil; struct Something { mixin("int " ~ name_another ~ ";"); void check() { // Check that basename removes (this.) from the scope name space static assert(this.another.stringof.countUntil('.') == this_dot.countUntil('.')); static assert(basename!(this.another) == name_another); } } Something something; // check that basename work in global scope (not this.) static assert(something.stringof.countUntil('.') == -1); static assert(basename!(something.another) == name_another);