Good idea. .tupleof seems to avoid collecting functions which is perfect. Here's a quick implementation:
http://codepad.org/lSDTFd7E The only issue I have left is that the function that prints the code doesn't really know what the variable was named in the calling code. As an alternative I could pass "myvar.stringof" and it would print its name before all field names instead of the type name. Btw, it seems CTFE doesn't work with this syntax: foreach (index; 0..100) But it does work with this syntax: foreach (index, value; values)