demangle and mangleof

Don Clugston dac at nospam.com.au
Fri Jul 7 06:17:11 PDT 2006


John Reimer wrote:
> Don Clugston wrote:
>> Bradley Smith wrote:
>>>
>>> Does it seem reasonable that the demangle() function should work for 
>>> the .mangleof property?
>>
>> It seems very reasonable to me. I have implemented compile-time 
>> demangle metafunctions:
>>
>> static assert( prettynameof!(A)    == "class main.A" );
>> static assert( qualifiednameof!(A) == "main.A" );
>> static assert( symbolnameof!(A)    == "A" );
>>
>> When doing this, I found some mistakes in the name mangling docs, and 
>> I'm pretty sure that my code is much more comprehensive than 
>> std.demangle.
>>
>> A really old version of the code is in dsource.ddl.meta, but it was 
>> ugly, and improvements to the template system have broken it. I'll 
>> post my new version soon (was working on it today, still fails in a 
>> few cases).
>>
> 
> 
> I eagerly await your improvements. :)
> 
> -JJR

It's done.
I've also added prettytypeof!(T) which converts any type into a string.

auto x = 5.0;
static assert( prettytypeof!( x ) == "double");

These functions works with just about anything I've thrown at them. Try 
to break it!
Enjoy!



More information about the Digitalmars-d-learn mailing list