http://www.drdobbs.com/blog/archives/2010/06/the_x_macro.html Even though D doesn't have a text macro preprocessor, this can be done using string mixins and a bit of CTFE.