www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11830] New: std.stdio.byLine reports extra line if you don't call .front

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

           Summary: std.stdio.byLine reports extra line if you don't call
                    .front
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: peter.alexander.au gmail.com



10:19:03 PST ---
If you don't call 'front' while iterating a ByLine range, you get a different
number of elements.

import std.stdio;
import std.range;
import std.algorithm;
void main()
{
    File("stuff", "w").write("line 1\nline 2\n");
    writeln(File("stuff").byLine.walkLength);
    writeln(File("stuff").byLine.filter!"true".walkLength);
}

This prints:

3
2

This should print 2 in both cases.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 27 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11830




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/516d4e95ab2dcaf12d4786400c8e5c75310551ca
Fix Issue 11830 - ByLine range length incorrect.

If you don't call `front` on a `ByLine` range then an extra line is reported.
This change ensures the extra line is consumed when only calling `empty`
without `front`.

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

https://github.com/D-Programming-Language/phobos/commit/64967c01e2752c6c6e4071d23ad025592e3ae83d


Fix Issue 11830 - ByLine range length incorrect.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 31 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11830


Peter Alexander <peter.alexander.au gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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