Reminder: Two days left to review Jesse Phillips' CSV Parser

dsimcha dsimcha at yahoo.com
Wed Nov 9 17:46:51 PST 2011


On 11/9/2011 8:02 PM, dsimcha wrote:
> As a reminder, the review of Jesse Phillips' CSV parser ends at the end
> of Friday and will be followed by one week of voting. Please speak up
> now about any remaining issues.

BTW, here's my second round of review now that some changes have been made:

Design-level stuff:

How do I use csvReader to process a CSV file as it's being read in (i.e. 
I don't want to ever have the whole file in memory)?  I guess I could do 
something like:

import std.algorithm, std.stdio, std.csv, std.conv;

void main() {
     auto file = File("foo.csv");
     auto chars = joiner(file.byLine(), '\n');

     auto reader = csvReader(chars);
}

If this would work, though, then it should be documented.  I'd also like 
to see csvReader tested with lowest-common-denominator input ranges 
instead of just strings, which are bidirectional ranges and can be 
treated as random access if they only have ASCII characters.  Also, IMHO 
we really need a ByChar range in std.stdio instead of the joiner kludge 
I used, though I'm not sure about the details with regard to how Unicode 
support should work.

Still no support for writing CSVs?  I understand writing is complicated 
from an API design perspective.  Maybe it would be easiest to just 
provide an enquote() function that adds quotes to a field and escapes 
any that are already inside the field and let the user handle the higher 
level stuff, since this is pretty simple.

Minor documentation nitpicks:

CSVException:  IncompletCellException -> IncompleteCellException (typo)

The first csvReader example:  You declare the variable count but don't 
use it.

Records, Record:  front(), empty(), popFront() should not mention 
std.range.InputRange.  These interfaces are virtual function-based 
interfaces in case someone needs virtual function-based access to a 
range.  They are not used in most cases when ranges are used because 
templates are usually better.



More information about the Digitalmars-d mailing list