DMD 0.173 release [Name mangling]
Don Clugston
dac at nospam.com.au
Fri Nov 3 00:06:09 PST 2006
Walter Bright wrote:
> Major new stuff! But please, let's discuss that over in the
> digitalmars.D group.
>
> http://www.digitalmars.com/d/changelog.html
One of the 'minor things' is also
"Template instantiations can now accept alias parameters for local
variables and nested functions."
which is of great interest to me, since now meta.prettynameof!() can
work with local variables; this will be significant for DDL and probably
things like PyD as well.
But, the name mangling is really weird. It's totally different to the
name mangling for static variables, for example.
Maybe this is intentional, and needs to be that way; but it's a bit
tricky to parse, so I'd like confirmation that it's not a mistake.
Below is an example, taken from my meta.nameof file.
-----------
template inner(alias F)
{
class inner { }
}
template outer(alias B)
{
void function( inner!(B) ) outer;
}
template rawmanglednameof(alias A)
{
const char [] rawmanglednameof =
typeof(&outer!(A)).mangleof;
}
void wolf() {
static int proto;
int quark;
static assert(rawmanglednameof!(proto)==
"PPFC"
~ "4meta6nameof42__T5inner"
~ "S29_D4meta6nameof4wolfFZv"
~ "5protoi"
~ "Z5innerZv");
static assert(rawmanglednameof!(quark)==
"PPFC"
~ "_D4meta6nameof4wolfFZv54__T16rawmanglednameof"
~ "S29_D4meta6nameof4wolfFZv5quarkiZ42__T5outer"
~ "S29_D4meta6nameof4wolfFZv5quarkiZ42__T5inner"
~ "S29_D4meta6nameof4wolfFZv"
~ "5quarki"
~ "Z5innerZv");
/* Why isn't it just:
"PPFC"
~ "4meta6nameof42__T5inner"
~ "S29_D4meta6nameof4wolfFZv"
~ "5quarki"
~ "Z5innerZv"
?
*/
}
More information about the Digitalmars-d-announce
mailing list