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.167): 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.

Members

Templates

manglednameof
template manglednameof(alias A)

Like .mangleof, except that it works for an alias template parameter instead of a type.

prettynameof
template prettynameof(alias A)

The symbol as it was declared, but including full type qualification.

prettytypeof
template prettytypeof(A)

Convert any D type to a human-readable string literal

qualifiednameof
template qualifiednameof(alias A)

Returns the qualified name of the symbol A.

symbolnameof
template symbolnameof(alias A)

Returns the unqualified name, as a single text string.

Meta

License

BSD style: $(LICENSE)

Authors

Don Clugston