digitalmars.D.learn - full ident name without mangle/demange?
- Nick Sabalausky (2/2) Mar 07 2011 Is there a way to get the fully-qualified name of an identifier without
- Tomek =?ISO-8859-2?B?U293afFza2k=?= (6/8) Mar 09 2011 Heh, looks like there isn't. It may be worth filing an enhancement reque...
- Nick Sabalausky (18/24) Mar 10 2011 Yea, I guess so.
- Jacob Carlborg (5/33) Mar 10 2011 Not sure but if I recall correctly you can do ".stringof" to get the
Is there a way to get the fully-qualified name of an identifier without doing "demange( mangledName!(foo) )"?
Mar 07 2011
Nick Sabalausky napisa=B3:Is there a way to get the fully-qualified name of an identifier without=20 doing "demange( mangledName!(foo) )"?Heh, looks like there isn't. It may be worth filing an enhancement request = for __traits(fullyQualifiedName, foo). BTW, what do you need it for? --=20 Tomek
Mar 09 2011
"Tomek Sowiński" <just ask.me> wrote in message news:20110309225011.3e9e1d3b Las-Miodowy...Nick Sabalausky napisał:Yea, I guess so.Is there a way to get the fully-qualified name of an identifier without doing "demange( mangledName!(foo) )"?Heh, looks like there isn't. It may be worth filing an enhancement request for __traits(fullyQualifiedName, foo).BTW, what do you need it for?Well, it's kind of round-about: It's to obtain the module name of an identifier. This, in turn, is for a trick to automatically detect and print the name of the current module in a unittest tool: http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/unittests.d?rev=202#L177 It had been working using mangledName and demangle, but it broke when I updated to DMD 2.052: http://d.puremagic.com/issues/show_bug.cgi?id=5718 I did eventually manage to work around the issue, though, at least in my particular case. But I figure if I'm going to get either the fully-qualified name or a module name, why have the CPU even go through the bother of sending it through the potentially error-prone and/or non-CTFE-compatible noop of mangle->demange? That in mind, something like __traits(moduleName, foo) and __traits(thisModuleName) would probably be good enhancement suggestions, too. :)
Mar 10 2011
On 2011-03-10 09:44, Nick Sabalausky wrote:"Tomek Sowiński"<just ask.me> wrote in message news:20110309225011.3e9e1d3b Las-Miodowy...Not sure but if I recall correctly you can do ".stringof" to get the name of the module. -- /Jacob CarlborgNick Sabalausky napisał:Yea, I guess so.Is there a way to get the fully-qualified name of an identifier without doing "demange( mangledName!(foo) )"?Heh, looks like there isn't. It may be worth filing an enhancement request for __traits(fullyQualifiedName, foo).BTW, what do you need it for?Well, it's kind of round-about: It's to obtain the module name of an identifier. This, in turn, is for a trick to automatically detect and print the name of the current module in a unittest tool: http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/unittests.d?rev=202#L177 It had been working using mangledName and demangle, but it broke when I updated to DMD 2.052: http://d.puremagic.com/issues/show_bug.cgi?id=5718 I did eventually manage to work around the issue, though, at least in my particular case. But I figure if I'm going to get either the fully-qualified name or a module name, why have the CPU even go through the bother of sending it through the potentially error-prone and/or non-CTFE-compatible noop of mangle->demange? That in mind, something like __traits(moduleName, foo) and __traits(thisModuleName) would probably be good enhancement suggestions, too. :)
Mar 10 2011