digitalmars.D.learn - demangle and mangleof
- Bradley Smith (23/23) Jun 09 2006 Does it seem reasonable that the demangle() function should work for the...
- Don Clugston (11/46) Jun 09 2006 It seems very reasonable to me. I have implemented compile-time demangle...
- John Reimer (3/22) Jun 09 2006 I eagerly await your improvements. :)
- Don Clugston (8/35) Jul 07 2006 It's done.
- Tom S (6/14) Jul 07 2006 Sure thing !
- Don Clugston (8/25) Jul 07 2006 That was quick! Hopefully I'll post a fix tonight.
- Tom S (5/11) Jul 07 2006 I'd be more than eager to cocreate such a library.
- Don Clugston (3/13) Jul 08 2006 I'm in. If you make arrangements to set up the meta directory, I'll
- Don Clugston (2/22) Jul 09 2006 I've fixed it. Try to break it again!
- Tom S (5/6) Jul 09 2006 http://158.75.59.9/~h3/code/kknd.rar
- Don Clugston (4/9) Jul 09 2006 Somehow, you aren't using the fixed version. That example worked for me
- Tom S (7/19) Jul 10 2006 Hmmm weird. I grabbed it from SVN using the ... hmm... browser
Does it seem reasonable that the demangle() function should work for the .mangleof property? private import std.stdio; private import std.demangle; void main() { class A { } writefln(A.mangleof); writefln(demangle(A.mangleof)); } This code prints C_Dmain1A C_Dmain1A It would be nice if it printed C_Dmain1A class main.A Does the D language even have the concept of a fully qualified class name? The property .classinfo.name is just the simple name of a class. The AssertError also just prints the simple file name rather than the source file path. This makes the error less useful when having modules with the same name in different packages. Thanks, Bradley
Jun 09 2006
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).private import std.stdio; private import std.demangle; void main() { class A { } writefln(A.mangleof); writefln(demangle(A.mangleof)); } This code prints C_Dmain1A C_Dmain1A It would be nice if it printed C_Dmain1A class main.ADoes the D language even have the concept of a fully qualified class name? The property .classinfo.name is just the simple name of a class. The AssertError also just prints the simple file name rather than the source file path. This makes the error less useful when having modules with the same name in different packages. Thanks, Bradley
Jun 09 2006
Don Clugston wrote:Bradley Smith wrote:I eagerly await your improvements. :) -JJRDoes 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).
Jun 09 2006
John Reimer wrote:Don Clugston wrote: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!Bradley Smith wrote:I eagerly await your improvements. :) -JJRDoes 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).
Jul 07 2006
Don Clugston wrote: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");Cool :)These functions works with just about anything I've thrown at them. Try to break it! Enjoy!Sure thing ! http://158.75.59.9/~h3/code/nameofBreak.rar -- Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Jul 07 2006
Tom S wrote:Don Clugston wrote:That was quick! Hopefully I'll post a fix tonight. I notice you're using the 'meta' namespace for your Tuple code. How about joining forces and making a compelling D metaprogramming library? Previously, my 'meta' library was just proof-of-concept stuff, but it's time to turn it into something serious. Oskar's done a lot of fantastic stuff too, although his seems to be more relevant at run time.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");Cool :)These functions works with just about anything I've thrown at them. Try to break it! Enjoy!Sure thing ! http://158.75.59.9/~h3/code/nameofBreak.rar
Jul 07 2006
Don Clugston wrote:I notice you're using the 'meta' namespace for your Tuple code. How about joining forces and making a compelling D metaprogramming library? Previously, my 'meta' library was just proof-of-concept stuff, but it's time to turn it into something serious. Oskar's done a lot of fantastic stuff too, although his seems to be more relevant at run time.I'd be more than eager to cocreate such a library. There's a D lib in the works that could use a 'meta' component... :> -- Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Jul 07 2006
Tom S wrote:Don Clugston wrote:I'm in. If you make arrangements to set up the meta directory, I'll start contributing. Let's get this ship afloat.I notice you're using the 'meta' namespace for your Tuple code. How about joining forces and making a compelling D metaprogramming library? Previously, my 'meta' library was just proof-of-concept stuff, but it's time to turn it into something serious. Oskar's done a lot of fantastic stuff too, although his seems to be more relevant at run time.I'd be more than eager to cocreate such a library. There's a D lib in the works that could use a 'meta' component... :>
Jul 08 2006
Don Clugston wrote:Tom S wrote:I've fixed it. Try to break it again!Don Clugston wrote:That was quick! Hopefully I'll post a fix tonight.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");Cool :)These functions works with just about anything I've thrown at them. Try to break it! Enjoy!Sure thing ! http://158.75.59.9/~h3/code/nameofBreak.rar
Jul 09 2006
Don Clugston wrote:I've fixed it. Try to break it again!http://158.75.59.9/~h3/code/kknd.rar "Shall we play a game ?" :D -- Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Jul 09 2006
Tom S wrote:Don Clugston wrote:Somehow, you aren't using the fixed version. That example worked for me with latest meta.demangle.I've fixed it. Try to break it again!http://158.75.59.9/~h3/code/kknd.rar"Shall we play a game ?" :DWhy not, I'm enjoying this. Every time you kill me, I come back stronger...
Jul 09 2006
Don Clugston wrote:Tom S wrote:Hmmm weird. I grabbed it from SVN using the ... hmm... browser interface. Might've been cache. Sorry for that.Don Clugston wrote:Somehow, you aren't using the fixed version. That example worked for me with latest meta.demangle.I've fixed it. Try to break it again!http://158.75.59.9/~h3/code/kknd.rarHrm. I'll have to 'kill -9' you next time. I'll try to break it again a bit later :) -- Tomasz Stachowiak /+ a.k.a. h3r3tic +/"Shall we play a game ?" :DWhy not, I'm enjoying this. Every time you kill me, I come back stronger...
Jul 10 2006