[phobos] CSVRange: RFC

Jesse Phillips jesse.k.phillips at gmail.com
Sun Jan 30 11:32:37 PST 2011


Oh, I take no offense as I didn't make any effort to announce my work,
as their were still things to add and I didn't want my public
interface to be final. I was quite surprised that it up as an answer
on SO two weeks after creating it[1].

You are correct in that I have completely ignored the header. It was
the next thing I wanted work on, but then I realized that I wasn't
handling \r\n and since my separators aren't hard coded I needed to
make it possible to pass multiple separators for each and handle a
range of dchar instead of just one. The latter resulted in a nice
restructuring, but the former is giving me trouble.

I have a work in progress[2] which makes use of the new countUntil,
with a small modification[3]. And I believe that if startsWith were
updated to take a range of ranges, then this implementation should be
able multiple separators much easier[4].

All that said, I wouldn't really say it is ready for review. I hope
the two BugZilla entries are seen as good additions so that I don't
need to deal with them.

1. http://stackoverflow.com/questions/4457481/extracting-values-from-comma-separated-lists/4457515#4457515

2. https://github.com/he-the-great/JPDLibs/tree/separator

3. http://d.puremagic.com/issues/show_bug.cgi?id=5507

4. http://d.puremagic.com/issues/show_bug.cgi?id=5508

On Sat, Jan 29, 2011 at 9:24 PM, David Simcha <dsimcha at gmail.com> wrote:
> Jesse,
>
> I was unaware of your efforts.  At first glance, your lib looks pretty good.
>  I definitely think Phobos needs a real CSV parser, as I seem to write
> ad-hoc ones all the time.  Since your module mostly looks a little further
> along and better engineered than mine (mine was really just a prototype that
> I spent about half a day on), maybe we should focus on getting yours up to
> Phobos quality.  The one major feature yours is missing, though, is the
> ability for csvText() to extract a subset of the available columns by
> header.  I also like the idea of doing things by column header instead of
> hard coding the column order because it's less brittle if the layout
> changes.
>
> --David Simcha


More information about the phobos mailing list