Am 10.01.2012 06:08, schrieb Jesse Phillips:
I'm adding output to the std.csv module that will be available in
the next release and I'm hoping I can get an opinion on this.
The last stated rule for CSV is:
Each record should contain the same number of fields (not
enforced)
I didn't enforce this as I don't see it likely to be indicating
an error. But I have found that not following this and parsing
with a struct will cause incorrect results.
one,two
three
four
Will parse as
one,two
three,two
four,two
So I can easily fix this by setting my internal struct with
.init. I like this.
A goal I am going for with csvWriter is, what goes in comes out.
But in this case your output would be
one,two
three,
four,
Which I like as it is correct, but it isn't the original input.
So the only why to achieve these goals together is to not allow
the initial invalid input... Thoughts?
do not allow invalid input - maybe a helper function to detect, but no
silent "repair" or internal "allow-invalid" stuff - i would get harder
to get the lib right