Improving std.regex(p)

bearophile bearophileHUGS at lycos.com
Fri Jun 18 05:08:18 PDT 2010


Ben Hanson:
> Can you output source code at compilation time and have D compile it, or do you
> use a load of recursion like C++ TMP?

This can be done with string mixin. You can use compile-time evaluation to build a string of code, and the mix it in somewhere, the compiler will compile it. It's a dirty thing, but unless D3 gets macros, it's the thing to be used. You can use it to build a string of asm code too, because it's part of D syntax.

Bye,
bearophile


More information about the Digitalmars-d mailing list