www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Help with demangling

reply g <g g.g> writes:
Hi
Is there a way to demangle .mangleof strings at CTFE
or at least know the fully qualified name of a class or template instance.
Jan 10 2010
next sibling parent g <g g.g> writes:
g Wrote:

 Hi
 Is there a way to demangle .mangleof strings at CTFE
 or at least know the fully qualified name of a class or template instance.
let's repeat : "Google is your friend!" http://www.dsource.org/projects/ddl/browser/trunk/meta/demangle.d but is severely outdated (dmd 0.166! btw im using dmd 2.039) so it will fail with invariant,shared,__gshared,inout(the new),etc. Is that the only alternative?
Jan 10 2010
prev sibling next sibling parent reply Trass3r <un known.com> writes:
What about std.demangle?
Jan 11 2010
parent g <g g.g> writes:
Trass3r Wrote:

 What about std.demangle?
doesn't work in ctfe
Jan 11 2010
prev sibling parent reply grauzone <none example.net> writes:
g wrote:
 Hi
 Is there a way to demangle .mangleof strings at CTFE
 or at least know the fully qualified name of a class or template instance.
If you have to use such dirty tricks, you probably should consider to turn back NOW for your own good. D always lures you into doing tricky template and CTFE stuff, and then you end up either in compiler bugs or other dead ends.
Jan 11 2010
parent reply Brad Roberts <braddr puremagic.com> writes:
On 1/11/2010 11:20 PM, grauzone wrote:
 g wrote:
 Hi
 Is there a way to demangle .mangleof strings at CTFE
 or at least know the fully qualified name of a class or template
 instance.
If you have to use such dirty tricks, you probably should consider to turn back NOW for your own good. D always lures you into doing tricky template and CTFE stuff, and then you end up either in compiler bugs or other dead ends.
And how do bugs get fixed? Step one is finding them.. which typically involves writing code that uses the features. Secondarily, a good number of bugs have been fixed over the last couple months, so re-exploring the area might well bear good fruit. Anyway, doom and gloom pronouncements like this aren't particularly helpful. That said, demangling a symbol and using that inside compile time expressions does sound like one good definition of hell, regardless of how well it works. Later, Brad
Jan 11 2010
parent reply grauzone <none example.net> writes:
Brad Roberts wrote:
 On 1/11/2010 11:20 PM, grauzone wrote:
 g wrote:
 Hi
 Is there a way to demangle .mangleof strings at CTFE
 or at least know the fully qualified name of a class or template
 instance.
If you have to use such dirty tricks, you probably should consider to turn back NOW for your own good. D always lures you into doing tricky template and CTFE stuff, and then you end up either in compiler bugs or other dead ends.
And how do bugs get fixed? Step one is finding them.. which typically involves writing code that uses the features. Secondarily, a good number of bugs have been fixed over the last couple months, so re-exploring the area might well bear good fruit. Anyway, doom and gloom pronouncements like this aren't particularly helpful.
Some types of bugs just never seem to disappear: when one specific bug got fixed, a regression occurs and you have a similar bug. (This happened with forward references in the current dmd release.) Nothing wrong with a warning.
 That said, demangling a symbol and using that inside compile time expressions
 does sound like one good definition of hell, regardless of how well it works.
Exactly. The thing is just (and that I wanted to say in my previous post): you get easily fascinated by the possibilities, but then either the language or dmd hit an unexpected barrier and fail. Then you start hacks by throwing heaps of CTFE and mixins on the problem, or stuff like parsing .mangleof. I believe choosing a simpler solution instead (although it's boring in terms of hacking) is better.
 Later,
 Brad
Jan 11 2010
parent g <g g.g> writes:
grauzone Wrote:

 Brad Roberts wrote:
 On 1/11/2010 11:20 PM, grauzone wrote:
 g wrote:
 Hi
 Is there a way to demangle .mangleof strings at CTFE
 or at least know the fully qualified name of a class or template
 instance.
If you have to use such dirty tricks, you probably should consider to turn back NOW for your own good. D always lures you into doing tricky template and CTFE stuff, and then you end up either in compiler bugs or other dead ends.
And how do bugs get fixed? Step one is finding them.. which typically involves writing code that uses the features. Secondarily, a good number of bugs have been fixed over the last couple months, so re-exploring the area might well bear good fruit. Anyway, doom and gloom pronouncements like this aren't particularly helpful.
Some types of bugs just never seem to disappear: when one specific bug got fixed, a regression occurs and you have a similar bug. (This happened with forward references in the current dmd release.) Nothing wrong with a warning.
 That said, demangling a symbol and using that inside compile time expressions
 does sound like one good definition of hell, regardless of how well it works.
Exactly. The thing is just (and that I wanted to say in my previous post): you get easily fascinated by the possibilities, but then either the language or dmd hit an unexpected barrier and fail. Then you start hacks by throwing heaps of CTFE and mixins on the problem, or stuff like parsing .mangleof. I believe choosing a simpler solution instead (although it's boring in terms of hacking) is better.
 Later,
 Brad
well, but is there a way to get by other means the fully qualified name of a class for use to a mixin (is a project for automatic generation of lua bindings)
Jan 12 2010