Use a string mixin?

string fun(string name)
{
  return "public static int " ~ name ~ "() { return 0; }";
}

struct S {
    mixin (fun("fctn1"));
}

void main() {
    S s;
    import std.stdio;
    writeln(s.fctn1());
}

Reply via email to