Compile Time Printing

Blake Anderton rbanderton at
Mon Jan 30 06:54:16 PST 2012

So from what I've found searching the newsgroup and my own 
experimentation, the best way to accomplish compile time printing 
is to do something like this:

string ctMain()
    //evaluate and return the final result string

enum result = ctMain();
pragma(msg, result);

I'm not a fan of having to build a single string and print it all 
at once. I know it's not that bad but it just means I have to 
pass around an Appender!string to all my logic functions that 
print results instead of having a central function they can call. 
I know a ctwriteln never really caught on, and pragma(msg, ...) 
has some limitations in that it can't use "local" variables even 
in CTFE. Are there any alternatives I'm overlooking?

More information about the Digitalmars-d-learn mailing list