[Issue 13568] New: Support compile-time string formatting in std.format

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 3 07:18:24 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13568

          Issue ID: 13568
           Summary: Support compile-time string formatting in std.format
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: hsteoh at quickfur.ath.cx

Currently, std.format.formattedWrite (along with the convenience wrappers
around it, namely writef, writefln, std.string.format, etc.), take a runtime
format string as argument, although most use cases involve format strings that
are already known at compile-time. This limits what we can statically do with
these string, e.g., statically check that the right number of arguments are
being passed for that format, that the right types are being passed, etc.,
instead of deferring until runtime to detect any problems.

Ideally, we should extend formattedWrite() to accept compile-time strings so
that if the format is already statically known, we can perform compile-time
checks on it.

--


More information about the Digitalmars-d-bugs mailing list