Write/Writeln, etc

bearophile bearophileHUGS at lycos.com
Thu May 7 10:38:01 PDT 2009


std.metastrings.Format of D 2.029 is broken, I think.

--------------------

The following doesn't work, the pragma isn't seen as an instruction, I guess this is normal, but I don't like it much:

static if (true)
    pragma(msg, "true");
else
    pragma(msg, "false");

--------------------

D2 programs need more and more compile-time printing, and:
pragma(msg, ToString(...) ~ ...);
isn't much nice.

So I think that the std.metastrings.Write and std.metastrings.Writeln templates may be created, able to print strings, integral values, floating point values, and arrays of those types.

I have started to create such templates, but to create the std.metastrings.Write I have seen I'd like to have a pragma(msg, ...) that doesn't add a newline at the end.

Has someone written a template or compile-time-function able to print a floating point value?

Bye,
bearophile



More information about the Digitalmars-d mailing list