Thread overview
[Issue 2114] New: Incorrect example foreach readLine()
May 20, 2008
d-bugmail
Nov 24, 2010
Witold Baryluk
Mar 09, 2011
ZY Zhou
May 20, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2114

           Summary: Incorrect example foreach readLine()
           Product: D
           Version: 2.014
          Platform: PC
               URL: std_stream.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: jlquinn@optonline.net


InputStream.opApply docs offer the following example:

 Stream file = new BufferedFile("sample.txt");
 foreach(ulong n, string line; file) {
   stdout.writefln("line %d: %s",n,line);
 }
 file.close();

This is seductively simple and desirable but doesn't compile, since line is invariant and readLine() returns char[].  Either docs need to be fixed to use char[] or the method needs to return a string.


-- 

November 24, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2114


Witold Baryluk <baryluk@smp.if.uj.edu.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baryluk@smp.if.uj.edu.pl


--- Comment #1 from Witold Baryluk <baryluk@smp.if.uj.edu.pl> 2010-11-24 07:52:30 PST ---
For reference: this bug is related to bug2081

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2114


ZY Zhou <rinick@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rinick@gmail.com


--- Comment #2 from ZY Zhou <rinick@gmail.com> 2011-03-09 02:27:29 PST ---
*** Issue 5724 has been marked as a duplicate of this issue. ***

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