Re: text based file formats

2022-12-20 Thread 9il via Digitalmars-d-announce

On Tuesday, 20 December 2022 at 19:46:36 UTC, John Colvin wrote:

On Tuesday, 20 December 2022 at 00:40:07 UTC, H. S. Teoh wrote:
On Mon, Dec 19, 2022 at 04:16:57PM -0800, Walter Bright via 
Digitalmars-d-announce wrote:

On 12/19/2022 4:35 AM, Adam D Ruppe wrote:
> On Monday, 19 December 2022 at 09:55:47 UTC, Walter Bright 
> wrote:

> > Curious why CSV isn't in the list.
> 
> Maybe std.csv is already good enough?


LOL, learn something every day! I've even written my own, but 
it isn't very good.


There's also my little experimental csv parser that was 
designed to be as fast as possible:


https://github.com/quickfur/fastcsv

However, it can only handle input that fits in memory (using 
std.mmfile is one possible workaround), has a static limit on 
field sizes, and does not do validation.



T


We use this at work with some light tweaks, it’s done a lot 
work 


It has already been replaced with 
[mir.csv](https://github.com/libmir/mir-ion/blob/master/source/mir/csv.d). Mir is faster, SIMD accelerated, and supports numbers and timestamp recognition.




Re: text based file formats

2022-12-20 Thread Adrian Matoga via Digitalmars-d-announce
On Sunday, 18 December 2022 at 16:12:35 UTC, rikki cattermole 
wrote:

> * make it @safe and pure if possible (and its likely possible)

pure is always a worry for me, but yeah @safe and ideally 
nothrow (if they are forgiving which they absolutely should be, 
there is no reason to throw an exception until its time to 
inspect it).


I frequently find it useful for a text data file parser to call a 
diagnostic callback instead of assuming some default behavior 
(whether that's forgiving, printing warnings, throwing or 
something else). With template callback parameters the parser can 
throw if the user wants it or stay pure nothrow if no action is 
required.


Re: text based file formats

2022-12-20 Thread H. S. Teoh via Digitalmars-d-announce
On Tue, Dec 20, 2022 at 07:46:36PM +, John Colvin via 
Digitalmars-d-announce wrote:
[...]
> > There's also my little experimental csv parser that was designed to
> > be as fast as possible:
> > 
> > https://github.com/quickfur/fastcsv
> > 
> > However it can only handle input that fits in memory (using std.mmfile
> > is one possible workaround), has a static limit on field sizes, and does
> > not do validation.
[...]
> We use this at work with some light tweaks, it’s done a lot work 

Wow, I never expected it to be actually useful. :-P  Good to know it's
worth something!


T

-- 
They say that "guns don't kill people, people kill people." Well I think the 
gun helps. If you just stood there and yelled BANG, I don't think you'd kill 
too many people. -- Eddie Izzard, Dressed to Kill


Re: text based file formats

2022-12-20 Thread John Colvin via Digitalmars-d-announce

On Tuesday, 20 December 2022 at 00:40:07 UTC, H. S. Teoh wrote:
On Mon, Dec 19, 2022 at 04:16:57PM -0800, Walter Bright via 
Digitalmars-d-announce wrote:

On 12/19/2022 4:35 AM, Adam D Ruppe wrote:
> On Monday, 19 December 2022 at 09:55:47 UTC, Walter Bright 
> wrote:

> > Curious why CSV isn't in the list.
> 
> Maybe std.csv is already good enough?


LOL, learn something every day! I've even written my own, but 
it isn't very good.


There's also my little experimental csv parser that was 
designed to be as fast as possible:


https://github.com/quickfur/fastcsv

However it can only handle input that fits in memory (using 
std.mmfile is one possible workaround), has a static limit on 
field sizes, and does not do validation.



T


We use this at work with some light tweaks, it’s done a lot work 