On Saturday, 23 October 2021 at 18:56:48 UTC, Simon wrote:
And I tried to use your suggestion like this:

enum OUTPUT_REPRO_CASE(alias func = __traits(parent, {})) = "build the actual code stuff with"~fullyQualifiedName!func~" and so on";

Which doesn't work. In that case func seems to become the parent namespace. If I substitute fullyQualifiedName!func with fullyQualifiedName!(__traits(parent, {}))) I get a circular dependecy error.

How do I have to use this exactly?

This seems to work:

import std.traits, std.stdio;
enum OUTPUT_REPRO_CASE = q{
    string name = fullyQualifiedName!(__traits(parent, {}));
    writeln(name);
};
void test()
{
    mixin(OUTPUT_REPRO_CASE);
}
void main()
{
    test();
}

Reply via email to