void main()
{
struct Data(T)
{
T[16] stuff;
}
import std.traits;
auto name = fullyQualifiedName!(Data!long);
}
Currently this or anything similar does not work. Compiler complaints about "forward reference of variable parentPrefix" in std.traits (300).
Comment #1 by develop32 — 2013-06-29T10:04:15Z
(In reply to comment #0)
> void main()
> {
> struct Data(T)
> {
> T[16] stuff;
> }
>
> import std.traits;
> auto name = fullyQualifiedName!(Data!long);
> }
>
> Currently this or anything similar does not work. Compiler complaints about
> "forward reference of variable parentPrefix" in std.traits (300).
Its not about structs, any template does not work, be that class, struct or function. Am I missing something?
Comment #2 by public — 2013-06-29T10:12:46Z
It was an oversight when extending fullyQualifiedName for wider usage. Implementation for template types is currently discussed (there are lot of tricky parts in it).
You can still use fullyQualifiedName!Data and add template parameter to string representation manually if it absolutely needed as a temporary workaround.
Comment #3 by k.hara.pg — 2014-02-23T00:21:47Z
To improve fullyQualifiedName, fixing compiler issue 12077 is necessary.
After fixing the compiler bug, adding specialized fullyQualifiedNameImplForSymbols should fix the issue.
private template fqnTuple(T...)
{
static if (T.length == 0)
enum fqnTuple = "";
else static if (T.length == 1)
enum fqnTuple = fullyQualifiedName!(T[0]);
else
enum fqnTuple = fullyQualifiedName!(T[0]) ~ ", "
~ fqnTuple!(T[1 .. $]);
}
// construct "Base!(Args)" for the instantiated types and symbols
private template fullyQualifiedNameImplForSymbols(alias T : Base!Args, alias Base, Args...)
{
enum parentPrefix = fullyQualifiedNameImplForSymbols!(__traits(parent, Base)) ~ '.';
enum fullyQualifiedNameImplForSymbols( =
parentPrefix ~ __traits(identifier, Base) ~ "!(" ~ fqnTuple!Args ~ ")";
}
private template fullyQualifiedNameImplForSymbols(alias T)
{
....
}