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

Berni44 <bugzi...@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzi...@bernis-buecher.de
         Resolution|FIXED                       |INVALID

--- Comment #4 from Berni44 <bugzi...@bernis-buecher.de> ---
As can be read in the discussions of the PRs, this has been seen as invalid,
because it causes too much problems to accept such enums as strings, while
there is only little use. It was suggested to use FMTS.ONE.representation
instead, but that doesn't work, because the representation is
immutable(ubyte)[] and not string.

Anyway, a working workaround is

enum FMTS : string 
{
    ONE = "%s is %s"
}
immutable string fmt = FMTS.ONE;
assert (format!fmt("Pi", 3.14) == "Pi is 3.14");

--

Reply via email to