On Thursday, 3 June 2021 at 01:22:14 UTC, Paul Backus wrote:
                auto tmp = File(filename).byLine();

`File.byLine` overwrites the previous line's data every time it reads a new line. If you want to store each line's data for later use, you need to use [`byLineCopy`][1] instead.

a) What is the rationale behind not making byLineCopy the default?

b) Does not compile:

csv.d(17): Error: function csv.CSVData!true.CSVData.parseCSV(char[] str) is not callable using argument types (string) csv.d(17): cannot pass argument tmp.front() of type string to parameter char[] str csv.d(21): Error: function csv.CSVData!true.CSVData.parseCSV(char[] str) is not callable using argument types (string) csv.d(21): cannot pass argument e of type string to parameter char[] str [...]/../../src/phobos/std/algorithm/iteration.d(525): instantiated from here: MapResult!(__lambda2, ByLineCopy!(immutable(char), char)) csv.d(21): instantiated from here: map!(ByLineCopy!(immutable(char), char))
csv.d(40):        instantiated from here: CSVData!true

c) Reminds me of the necessity to add dups here and there. And reminds me of "helping the compiler" [1]?

[1] <https://wiki.c2.com/?HelpingTheCompilerIsEvil>

Reply via email to