Using a mixin, is it possible to have it define a method based on a string passed into the mixin?

An example of what I'm hoping to do:

mixin template make_method(string name) {
void name() { // not sure how to make it become "void bark()" here
       writeln("hello");
     }
}

class Animal {

   mixin make_method!("bark");

}

Animal a;

a.bark();


Any help would be appreciated. I'm hoping D can do this since it would make something I'm trying to do easier.

Reply via email to