xxxxxxxxxx
import std.stdio;
string eponymousRename(string s)()
{
return "static string _getAliasSymbol(string name)()" ~
"{" ~
"int a;" ~
"return \"alias \" ~ __traits(parent,__traits(parent, a)).stringof[0 .. $-3] ~ \" = \" ~ name ~ \";\";" ~
"}" ~
"mixin(_getAliasSymbol!\"" ~ s ~ "\"());";
}
string _eponymousRename(string name, string tplName)()
{
return "alias " ~ tplName ~ " = " ~ name ~ ";";
}
template SomeName()
{
mixin(eponymousRename!"This");
string This()
{
return "hello";
}
int This(bool override_)
{
return 5;
}
}
void main()
{
auto x = SomeName();
writeln(x);
auto y = SomeName(true);
writeln(y);
}