DMD 1.005 release

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Feb 7 06:24:04 PST 2007


"Jarrett Billingsley" <kb3ctd2 at yahoo.com> wrote in message 
news:eqcmo3$2u17$1 at digitaldaemon.com...

Just wanted to add that something I find severely lacking is that there's no 
way to get a pretty (usable, non-mangled) string representation of a type. 
Instead we have to write large template libraries to accomplish something 
that the compiler does _all the time_.  This means it's currently not 
possible to do something like

template MakeVariable(Type, char[] name)
{
    const char[] MakeVariable = Type.nameof ~ " " ~ name ~ ";";
}

mixin(MakeVariable!(int, "x"));

Instead we have to use a template library to demangle the name:

import ddl.meta.nameof;

template MakeVariable(Type, char[] name)
{
    const char[] MakeVariable = prettytypeof!(Type) ~ " " ~ name ~ ";";
}

mixin(MakeVariable!(int, "x"));


:\ 





More information about the Digitalmars-d-announce mailing list