http://d.puremagic.com/issues/show_bug.cgi?id=6640

           Summary: More formatting consistency between string and range
                    of char
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara <k.hara...@gmail.com> 2011-09-10 06:28:32 PDT ---
Sample code:
----
import std.stdio, std.range;
void main() {
    struct Range {
        string value;
        const @property bool empty(){ return !value.length; }
        const @property dchar front(){ return value.front(); }
        void popFront(){ value.popFront(); }

        const @property size_t length(){ return value.length; }
    }
    auto s = "string";
    auto r = Range("string");

    writef("[%s]", s);          writefln("[%s]", r);
    writef("[%10s]", s);        writefln("[%10s]", r);
    writef("[%-10s]", s);       writefln("[%-10s]", r);
    writef("[%(%02x %)]", s);   writefln("[%(%02x %)]", r);
    writef("[%(%s %)]", s);     writefln("[%(%s %)]", r);
}

Outputs:
----
[string][string]                   // OK 
[    string][    string]           // OK
[string    ][string    ]           // OK
[73 74 72 69 6e 67][string]        // expects [73 74 72 69 6e 67]
[115 116 114 105 110 103][string]  // expects [s t r i n g]

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

Reply via email to