Review of Jesse Phillips's CSV Parser

deadalnix deadalnix at gmail.com
Fri Oct 28 07:36:38 PDT 2011


Le 28/10/2011 16:09, Piotr Szturmaj a écrit :
> Jacob Carlborg wrote:
>> On 2011-10-28 15:25, Piotr Szturmaj wrote:
>>> dsimcha wrote:
>>>> Formal review of Jesse Phillips's CSV parser module begins today and
>>>> runs through November . Following that, a vote will take place for one
>>>> week. Please post any comments about this library in this thread.
>>>>
>>>> Docs:
>>>> http://nascent.freeshell.org/programming/D/doc/phobos/std_csv.html
>>>>
>>>> Code:
>>>> https://github.com/he-the-great/phobos/tree/csv
>>>
>>> Could csvText!Struct(...) be generalized to also support Tuples and
>>> (eventually) classes?
>>
>> Sounds more like a serialization library with a CSV archive type to me.
>>
>
> I suppose you misunderstood my intentions. Here's an example from the docs:
>
> string str = "Hello,65,63.63\nWorld,123,3673.562";
> struct Layout {
> string name;
> int value;
> double other;
> }
>
> auto records = csvText!Layout(str);
>
> foreach(record; records) {
> writeln(record.name);
> writeln(record.value);
> writeln(record.other);
> }
>
> I want to occasionally write:
>
> alias Tuple!(string, int, double) Layout; // instead of struct
>
> It should be easy to extend, but it would be nice if we have had general
> construct in Phobos. So instead of is(Contents == struct) @
> https://github.com/he-the-great/phobos/blob/csv/std/csv.d#L433 there
> should be isComposite!Contents and FieldTypeTuple should be generalized
> (if it isn't) to structs, classes and tuples. I don't know if Tuple as a
> struct doesn't return valid fields from FieldTypeTuple now.

That would be great !


More information about the Digitalmars-d mailing list