On Sunday, 12 April 2015 at 21:34:21 UTC, H. S. Teoh wrote:
On Sun, Apr 12, 2015 at 02:33:03PM +0000, ketmar via Digitalmars-d-learn wrote:
On Sun, 12 Apr 2015 14:18:21 +0000, JR wrote:

> But the compiler has all the pieces of information needed to > see
> it's wrong, doesn't it?

no, it doesn't. compiler doesn't know about `std.format.format` and it's special abilities. while it is possible to add such checks to the compiler, it will introduce interdependency between compiler and
phobos, which is not desirable.

writing CTFE `writef` version is possible without template bloat in
binary, but it will take more memory in compile time and slows
compilation. there were talks about having `writef!"fmt"(args)` in
phobos, but nobody took that task yet.

It's not hard to write a CTFE version of writef/writeln/etc., that takes the format argument at compile-time, since std.format itself is already
CTFE-able.

Except for floating-point values (at least).

Reply via email to