View mode: basic / threaded / horizontal-split · Log in · Help
October 30, 2011
Re: Review of Jesse Phillips's CSV Parser
On Sun, 30 Oct 2011 17:02:26 +0000, Jesse Phillips wrote:

> Thank you for the response, only one more follow-up question.
> 
> Records
> Record

If it's any consolation, I'm suffering from similar questions to myself 
in my naming of structs and methods for my database interface experiments.

Since it is rather a short step from a generic 'CSV' interface to a 
database interface, you may be determining the terminology that I should 
use. I should really divert for a day and look at what you have done. It 
would be interesting to see if I could write a similar interface over 
your stuff.

But there's so much to do!

Steve
October 30, 2011
Re: Review of Jesse Phillips's CSV Parser
On 10/30/2011 10:02 AM, Jesse Phillips wrote:
> Thank you for the response, only one more follow-up question.
>
> Records
> Record
>
> Don't these look easy to confuse? And funny if we didn't have type
> inference.
>
> Records records = csvText(str);
>
> foreach(Record record; records) ...
>
> Anyone want to complain about this suggestion? Record is private and can
> only be obtained from Records (is that appropriate phrasing?).

I started using that convention in dmd, i.e. Objects is an array of Object, and 
after I got used to it I like it fine.
October 30, 2011
Re: Review of Jesse Phillips's CSV Parser
On 10/29/2011 10:03 PM, Walter Bright wrote:
> I want to press Andrei to write up a doc on "What's a Range"

As a D1 user planning to migrate, this would be very appreciated.
October 31, 2011
Re: Review of Jesse Phillips's CSV Parser
On Fri, 28 Oct 2011 16:18:27 +0300, dsimcha <dsimcha@yahoo.com> wrote:

> Docs:
> http://nascent.freeshell.org/programming/D/doc/phobos/std_csv.html

Checked the new docs today. If I'm reading them right, the top example  
prints:

"Fred works as a Fly and earns $4 per year"

Is this a pop culture reference I'm not catching?

An idea I had the other day was to include convenience presets for the  
more common flavours of CSV formats, e.g.: csvText!CSVFormat_Excel(...)

-- 
Best regards,
 Vladimir                            mailto:vladimir@thecybershadow.net
November 01, 2011
Re: Review of Jesse Phillips's CSV Parser
On Mon, 31 Oct 2011 19:21:02 +0200, Vladimir Panteleev wrote:

> On Fri, 28 Oct 2011 16:18:27 +0300, dsimcha <dsimcha@yahoo.com> wrote:
> 
>> Docs:
>> http://nascent.freeshell.org/programming/D/doc/phobos/std_csv.html
> 
> Checked the new docs today. If I'm reading them right, the top example
> prints:
> 
> "Fred works as a Fly and earns $4 per year"
> 
> Is this a pop culture reference I'm not catching?

No, not that I know of. Should it be? Should I go with a more 
professional like example?

> An idea I had the other day was to include convenience presets for the
> more common flavours of CSV formats, e.g.: csvText!CSVFormat_Excel(...)

Well if Excel actually conforms to what it claims:

http://office.microsoft.com/en-us/excel-help/excel-formatting-and-
features-that-are-not-transferred-to-other-file-formats-HP010014105.aspx?
CTT=5&origin=HP010099725#BM4

Which I doubt it does, then my parser already defaults to being able to 
read such formats. In my experience Excel sucks at CSV and follows no 
rules.

The implementation I choose as default is the most common and any other 
style is just a butchafication and likely to be unreliable, usually stems 
from "my data has commas, so I'll use colon." Which is great until the 
data also has colon. But maybe that is just my experience.
November 01, 2011
Re: Review of Jesse Phillips's CSV Parser
On Tuesday, November 01, 2011 01:28:07 Jesse Phillips wrote:
> On Mon, 31 Oct 2011 19:21:02 +0200, Vladimir Panteleev wrote:
> > On Fri, 28 Oct 2011 16:18:27 +0300, dsimcha <dsimcha@yahoo.com> wrote:
> >> Docs:
> >> http://nascent.freeshell.org/programming/D/doc/phobos/std_csv.html
> > 
> > Checked the new docs today. If I'm reading them right, the top example
> > prints:
> > 
> > "Fred works as a Fly and earns $4 per year"
> > 
> > Is this a pop culture reference I'm not catching?
> 
> No, not that I know of. Should it be? Should I go with a more
> professional like example?
> 
> > An idea I had the other day was to include convenience presets for the
> > more common flavours of CSV formats, e.g.: csvText!CSVFormat_Excel(...)
> 
> Well if Excel actually conforms to what it claims:
> 
> http://office.microsoft.com/en-us/excel-help/excel-formatting-and-
> features-that-are-not-transferred-to-other-file-formats-HP010014105.aspx?
> CTT=5&origin=HP010099725#BM4
> 
> Which I doubt it does, then my parser already defaults to being able to
> read such formats. In my experience Excel sucks at CSV and follows no
> rules.

As I recall, part of the problem is that Excel's behavior with regards to CSV 
is locale-dependent.

- Jonathan M Davis
November 02, 2011
Re: Review of Jesse Phillips's CSV Parser
On 2011-11-01 02:28, Jesse Phillips wrote:
> On Mon, 31 Oct 2011 19:21:02 +0200, Vladimir Panteleev wrote:
>
>> On Fri, 28 Oct 2011 16:18:27 +0300, dsimcha<dsimcha@yahoo.com>  wrote:
>>
>>> Docs:
>>> http://nascent.freeshell.org/programming/D/doc/phobos/std_csv.html
>>
>> Checked the new docs today. If I'm reading them right, the top example
>> prints:
>>
>> "Fred works as a Fly and earns $4 per year"
>>
>> Is this a pop culture reference I'm not catching?
>
> No, not that I know of. Should it be? Should I go with a more
> professional like example?
>
>> An idea I had the other day was to include convenience presets for the
>> more common flavours of CSV formats, e.g.: csvText!CSVFormat_Excel(...)
>
> Well if Excel actually conforms to what it claims:
>
> http://office.microsoft.com/en-us/excel-help/excel-formatting-and-
> features-that-are-not-transferred-to-other-file-formats-HP010014105.aspx?
> CTT=5&origin=HP010099725#BM4
>
> Which I doubt it does, then my parser already defaults to being able to
> read such formats. In my experience Excel sucks at CSV and follows no
> rules.
>
> The implementation I choose as default is the most common and any other
> style is just a butchafication and likely to be unreliable, usually stems
> from "my data has commas, so I'll use colon." Which is great until the
> data also has colon. But maybe that is just my experience.

Excel + CSV == Pain in the ass

Excel uses different value delimiters as the default setting depending 
on the locale of the Excel application.

-- 
/Jacob Carlborg
November 02, 2011
Re: Review of Jesse Phillips's CSV Parser
On Tue, 01 Nov 2011 03:28:07 +0200, Jesse Phillips  
<jessekphillips+d@gmail.com> wrote:

> On Mon, 31 Oct 2011 19:21:02 +0200, Vladimir Panteleev wrote:
>
>> On Fri, 28 Oct 2011 16:18:27 +0300, dsimcha <dsimcha@yahoo.com> wrote:
>>
>>> Docs:
>>> http://nascent.freeshell.org/programming/D/doc/phobos/std_csv.html
>>
>> Checked the new docs today. If I'm reading them right, the top example
>> prints:
>>
>> "Fred works as a Fly and earns $4 per year"
>>
>> Is this a pop culture reference I'm not catching?
>
> No, not that I know of. Should it be? Should I go with a more
> professional like example?

I guess such things are really subjective, but personally to me it does  
seem a bit silly, and out-of-place from the documentation of a language  
that aims to be the successor of C++.

Have you decided about whether you'll be adding a formatter? Regardless of  
that, IMO the naming of "csvText" is not ideal. What does the "text" part  
imply - isn't CSV inherently a text format? How about "csvReader", which  
would also disambiguate it from a CSV formatter?

-- 
Best regards,
 Vladimir                            mailto:vladimir@thecybershadow.net
November 03, 2011
Re: Review of Jesse Phillips's CSV Parser
On Wed, 02 Nov 2011 15:11:24 +0200, Vladimir Panteleev wrote:

> I guess such things are really subjective, but personally to me it does
> seem a bit silly, and out-of-place from the documentation of a language
> that aims to be the successor of C++.

I'll make it a pop culture reference... kidding.

> Regardless
> of that, IMO the naming of "csvText" is not ideal. What does the "text"
> part imply - isn't CSV inherently a text format? How about "csvReader",
> which would also disambiguate it from a CSV formatter?

Sounds reasonable to me. CSV could be applied to other things, not that 
it ever is. I started making the implementation very generic and had to 
cut back especially since I couldn't test it all. I had even played with 
the idea of being able to just return slices of a range of things

https://github.com/he-the-great/JPDLibs/blob/separator/csv/csv.d

but stopped its development in favor of something that work with input 
ranges and could get into Phobos.

> Have you decided about whether you'll be adding a formatter? 

Yes I'll give this a try, but I'm going to concentrate on documentation 
of what is there.
November 05, 2011
Re: Review of Jesse Phillips's CSV Parser
Le 30/10/2011 03:09, Jesse Phillips a écrit :
> That is all I meant by it. A CSV parser does exist for every language, 
> but none come packaged with the language. C# even chose not to include an 
> ini so people would use XML. It really is sad that instead of something 
> solid they go the way of "discouraging."

Yes, especially since CSV files are still widely used and prove in many
cases far more usable than XML or even JSON. Good luck importing JSON in
Excel.

Dude
1 2 3 4 5 6
Top | Discussion index | About this forum | D home