June 26, 2018 [Issue 19029] New: Provide alias symbol name trait | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19029 Issue ID: 19029 Summary: Provide alias symbol name trait Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: radu.racariu@gmail.com Currently there is no way to get the name of the alias for a symbol type. For example the following: === void main() { import std.traits; size_t s; pragma(msg, typeof(s).stringof); pragma(msg, mangledName!(typeof(s))); pragma(msg, mangledName!s); } === Prints --- ulong m _D9onlineapp4mainFZ1sm --- For code generation porpoises (eg. generate C wrapper code) there is no way to get the type of `s` as `size_t` because `size_t` is an alias. A new trait, `__traits(aliasName, symbol)`, could be used to retrieve the alias name for a symbol type. This trait will return the name of the concrete type if the symbol type is not an alias. -- |
Copyright © 1999-2021 by the D Language Foundation