The fully qualified name for the symbol sym is an alias of.
A short name for the symbol sym is an alias of.
Symbol to provide the strings for.
module foo; void bar() {} alias categoryName = CategoryName!bar; assert(categoryName.type == "function"); assert(categoryName.name == "bar"); assert(categoryName.fqn == "foo.bar");
bool localSymbol; void fn() {} auto dg = () => localSymbol; class C {} C c; struct S {} S s; interface I {} union U { int i; bool b; } U u; alias Ffn = CategoryName!fn; static assert(Ffn.type == "function"); static assert(Ffn.name == "fn"); // Can't test fqn from inside a unittest alias Fdg = CategoryName!dg; static assert(Fdg.type == "delegate"); static assert(Fdg.name == "dg"); // Ditto alias Fc = CategoryName!c; static assert(Fc.type == "class"); static assert(Fc.name == "c"); // Ditto alias Fs = CategoryName!s; static assert(Fs.type == "struct"); static assert(Fs.name == "s"); alias Fm = CategoryName!(lu.traits); static assert(Fm.type == "module"); static assert(Fm.name == "traits"); static assert(Fm.fqn == "lu.traits"); alias Fi = CategoryName!I; static assert(Fi.type == "interface"); static assert(Fi.name == "I"); alias Fu = CategoryName!u; static assert(Fu.type == "union"); static assert(Fu.name == "u");
Provides string representations of the category of a symbol, where such is not a fundamental primitive variable but a module, a function, a delegate, a class or a struct.
Accurate module detection only works on compilers 2.087 and later, due to missing support for __traits(isModule).