www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9615] New: std.conv.parse!(T[]) fails on trailing comma

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9615

           Summary: std.conv.parse!(T[]) fails on trailing comma
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



The D syntax (AFAIK) allows a trailing comma at the end of a list, for the sake
of convenience, eg:

int a = 
[
    1,
    2,
    3,
];

(This *is* legal, right, it's not an accepts invalid?)

In any case, this code is currently legal, but std.conv.pase rejects it:

//----
    int[] arr = [1, 2,];   //LEGAL
    string s  = "[1, 2,]"; //*SHOULD* work
    parse!(int[])(s); //Unexpected ']' when converting from type string to type
int
//----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9615





     parse!(int[])(s); //Unexpected ']' when converting from type string to type
 int
And if you are trying to parse a string[], you'll get a "Can't parse string: """ is missing" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 28 2013