I've fixed several limitations in std.traits.fullyQualifiedName / packageName / moduleName but still have issues with templated types / functions:<div><br></div><div>currently:</div><div>struct A{}</div><div>std.traits.fullyQualifiedName!(A!(int)) => CT error.</div>
<div><br></div><div>attempt to fix it:</div><div><div><br></div><div>----</div><div><div>template Stringof(alias T){</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>static if (!isCallable!T) enum Stringof = T.stringof;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>else enum Stringof = __traits(identifier, T);</div><div>}</div></div><div></div><div>template isTemplateInstantiation(alias T){</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>import std.algorithm;</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>enum isTemplateInstantiation=Stringof!T.canFind(`!`);</div><div>}</div></div><div><div>template fullyQualifiedName(alias T)</div></div><div><div>{</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>static if (isTemplateInstantiation!T){</div><div><span class="Apple-tab-span" style="white-space:pre">               </span>enum s=Stringof!T;</div><div><span class="Apple-tab-span" style="white-space:pre">           </span>import std.algorithm;</div>
<div><span class="Apple-tab-span" style="white-space:pre">              </span>enum s2=s.findSplit("!");</div><div><span class="Apple-tab-span" style="white-space:pre">          </span>mixin(`alias temp=`~s2[0]~`;`);</div><div><span class="Apple-tab-span" style="white-space:pre">              </span>enum fullyQualifiedName =fullyQualifiedName!temp~s2[1]~s2[2];</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>}</div></div><div>        else{...}</div><div>}</div><div><br></div><div>version(unittest){</div><div>  struct A(T1,T2){}</div><div>}</div><div>unittest{</div>
<div>  static assert(fullyQualifiedName!(A!(int,double)) == "util.traits.A!(int, double)");</div><div>}</div><div><div>----</div><div><br></div><div>however, it works only when "A" is visible in the scope of fullyQualifiedName, so it's pretty useless as it is. A potential fix would be to require the user to use a mixin (mixin(fullyQualifiedNameMixin!(A!double)) ) but that's ugly.</div>
<div><br></div><div>What we need:</div><div><div>__traits(getTemplate, A!T) => A</div></div><div><div>__traits(getTemplateArguments, A!(T,"foo")) => (T,"foo") (ie returns a tuple as in parameterTypeTuple or similar)</div>
</div><div><br></div><div>any thoughts?</div><div></div></div>