Summary: format and Format!() do not work with posix positional
--- Comment #0 from Jonathan M Davis <jmdavisp...@gmail.com> 2010-08-29
03:29:49 PDT ---
The following program fails to compile:
mixin(Format!("writeln(\"%1$s\");", "hello world"));
Instead, you get this error:
/path/to/src/phobos/std/metastrings.d(69): Error: static assert "unrecognized
/path/to/src/phobos/std/metastrings.d(51): 11 recursive instantiations
from here: FormatString!("writeln(\"%1$s\");","hello world")
d.d(6): instantiated from here: Format!("writeln(\"%1$s\");","hello
So, it would appear that Format!() fails to work with posix positional
parameters. If you replace %1$s with %s, it works just fine. Also, if you
attempt to use format() with %1$s, it throws a FormatError at runtime. I would
expect that format and Format!() would accept exactly the same types of input
as writefln(). However, that does not appear to currently be the case.
Certainly, having them differ in capabilities is going to cause a fair bit of
confusion. So, they need to be fixed to work with the same input as writefln().
In particular, they need to support posix positional parameters.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------