On 02/04/2013 14:33, Nick Treleaven wrote:
On 02/04/2013 01:10, bearophile wrote:
Sometimes you want to print something coming out of a UFCS chain with a
formatting string. In this case you can't append the writef/writefln at
the end of the chain. The problem is easy to solve with two simple
functions like this. Are they worth having in std.stdio?
I think usually the format string is known statically, so we could have
a template overload of writef[ln] with a compile-time format parameter.
We can then use that overload for UFCS:
5.writefln!"hi %s!";
Of course, the main point of doing that is to compile-time validate the
format string. But UFCS is a nice consequence.