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

           Summary: std.range.chunks problem with chunkSize = 0
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2013-05-15 09:49:44 PDT ---
import std.stdio: writeln;
import std.range: chunks;
void main() {
    chunks("abcd"d, 0).writeln;
}

Prints an unbound range of empty strings, I think this is not good:

["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ...

I suggest to refuse the chunkSize = 0 with a pre-condition (or worse with an
enforce).

An alternative solution is to make 0 a special case, and return the whole
iterable:

std.range.chunks("abcd"d, 0).writeln;

==>

["abcd"]

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

Reply via email to