DIP 50 - AST macros
Philippe Sigaud
philippe.sigaud at gmail.com
Sun Nov 17 12:04:14 PST 2013
On Sun, Nov 17, 2013 at 8:41 PM, Simen Kjærås <simen.kjaras at gmail.com> wrote:
> Source is attached. I hope God forgives me.
Nice ideas. I particularly like this one:
final abstract class Args {
@property
static auto opDispatch(string name, Arg)(Arg arg) {
return NamedArg!(name, Arg)(arg);
}
}
Which allows you to have Args.c = 1 (and thus storing the name and the value).
Half of your implementation is in fact generic enough to be in Phobos
(staticFilter, staticZip). I know I use my own...
Btw, with DMD 2.064.2, we can now write:
template staticToString(T...) {
enum staticToString = T.stringof;
}
as:
alias staticToString(T...) = T.stringof;
Which is both easier to understand and easier on the eyes.
More information about the Digitalmars-d
mailing list