On 06/25/2010 07:10 AM, Walter Bright wrote:
http://www.drdobbs.com/blog/archives/2010/06/the_x_macro.html

Interesting technique that I haven't heard of. However one of my friends, a lead programmer at Sega, says they use similar technique extensively in C++; actually they avoid overusing it, as it slows down compilation considerably.

And for this particular Color case, enum in D can have a base type:

enum Color: string {
    RED = "red",
    GREEN = "green",
    BLUE = "blue",
}

writeln(Color.RED);     // gives "red"

so we don't have that maintainance problem :-)

Reply via email to