Thread overview
[Issue 4754] New: format and Format!() do not work with posix positional parameters
Aug 29, 2010
Jonathan M Davis
Apr 10, 2012
Stewart Gordon
August 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4754

           Summary: format and Format!() do not work with posix positional
                    parameters
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: jmdavisProg@gmail.com


--- Comment #0 from Jonathan M Davis <jmdavisProg@gmail.com> 2010-08-29 03:29:49 PDT ---
The following program fails to compile:

import std.metastrings;
import std.stdio;

void main()
{
    mixin(Format!("writeln(\"%1$s\");", "hello world"));
}


Instead, you get this error:

/path/to/src/phobos/std/metastrings.d(69): Error: static assert  "unrecognized
format %1"
/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
world")

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: -------
January 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4754


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4754


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |smjg@iname.com
         Resolution|                            |DUPLICATE


--- Comment #1 from Stewart Gordon <smjg@iname.com> 2012-04-10 03:38:13 PDT ---
*** This issue has been marked as a duplicate of issue 4532 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------