Bug 3989 – stringof of nested enums doesn't give sufficient information
Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-03-20T03:13:00Z
Last change time
2015-06-09T01:27:40Z
Assigned to
nobody
Creator
e.insafutdinov
Comments
Comment #0 by e.insafutdinov — 2010-03-20T03:13:15Z
class Foo
{
enum Boo
{
X
}
}
pragma(msg, Foo.Boo.stringof);
prints:
Boo
I can't use it for meta-programming purposes, as it does not specifies the type. At the very least it should return "Foo.Boo".
Comment #1 by andrej.mitrovich — 2012-10-21T20:31:36Z
Use fullyQualifiedName from Phobos:
module test;
import std.traits;
class Foo
{
enum Boo
{
X
}
}
pragma(msg, fullyQualifiedName!(Foo.Boo)); // => test.Foo.Boo
.stringof is unreliable at best, *especially* for metaprogramming.