www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11702] New: std.string.splitLines to immutable result

https://d.puremagic.com/issues/show_bug.cgi?id=11702

           Summary: std.string.splitLines to immutable result
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-12-07 05:53:19 PST ---
void main() pure {
    import std.string;
    immutable parts = "5\n6".splitLines;
}


splitLines can be used in a pure function, but its result can't yet be assigned
to an immutable (dmd 2.065alpha):

temp.d(3): Error: cannot implicitly convert expression (splitLines("5\x0a6",
cast(KeepTerminator)false)) of type string[] to immutable(char[][])


Even this fails with a similar error:

void main() pure {
    import std.string;
    immutable s = "5\n6";
    immutable parts = s.splitLines;
}

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