digitalmars.D.learn - static code generation p2
- js.mdnq (30/30) Dec 12 2012 Take the example here:
Take the example here:
http://forum.dlang.org/thread/vrupqijwqmccdpabmken forum.dlang.org
note how he provides the body of the method in the mixin. I would
like to something similar to what he has done but provide the
body of the mixin after the fact(so to speak).
Something like
class Test {
mixin make_method!(Test)
{
writeln("I am a banana");
}
}
or even
class Test {
mixin make_method!(Test)
({
writeln("I am a banana");
});
}
(I may want to parse the body too, but at this point it's not
relevant)
I also want to be able to do a similar thing with structs and
classes:
mixin make_struct!(Test)
({
public:
int v;
});
which would produce the obvious
struct Test { public: int v; }
Dec 12 2012








"js.mdnq" <js_adddot+mdng gmail.com>