meta.nameof
Convert any D symbol or type to a human-readable string, at compile time.
Given any D symbol (class, template, function, module name, or non-local variable)
or any D type, convert it to a compile-time string literal,
optionally containing the fully qualified and decorated name.
Limitations (as of DMD 0.162):
1. Names of local variables cannot be determined, because they are not permitted
as template alias parameters. Technically, it's possible to determine the name by using
a mixin hack, but it's so ugly that it cannot be recommended.
2. The name mangling for symbols declared inside extern(Windows), extern(C) and extern(Pascal)
functions is inherently ambiguous, so such inner symbols are not always correctly displayed.
- template manglednameof(alias A)
- Like .mangleof, except that it works for an alias template parameter instead of a type.
- template prettynameof(alias A)
- The symbol as it was declared, but including full type qualification.
example:
"int mymodule.myclass.myfunc(uint, class otherclass)"
- template prettytypeof(A)
- Convert any D type to a human-readable string literal
example:
"int function(double, char[])"
- template qualifiednameof(alias A)
- Returns the qualified name of the symbol A.
This will be a sequence of identifiers, seperated by dots.
eg "mymodule.myclass.myfunc"
This is the same as prettynameof(), except that it doesn't include any type information.
- template symbolnameof(alias A)
- Returns the unqualified name, as a single text string.
eg. "myfunc"