News for hackers. Stuff that matters.
Re:A love letter to the CSV format by account-5 on Wednesday March 26, 2025 @07:30PM (#43488725)
I like CSV for the same reasons I like INI files. It's simple, text based, and there's no typing encoded in the format, it's just strings. You don't need a library.

They're not without their drawbacks, like no official standards etc, but they do their job well.

I will be bookmarking this like I have the ini critique of toml: https://github.com/madmurphy/libconfini/wiki/An-INI-critique...

I think the first line of the toml critique applies to CSV: it's a federation of dialects.

Re:A love letter to the CSV format by nukem222 on Wednesday March 26, 2025 @07:49PM (#43488879)
> It's simple

My experience has indicated the exact opposite. CSVs are the only "structured" format nobody can claim to parse 100% (ok probably not true thinking about html etc, just take this as hyperbole.) Just use a well-specified format and save your brain-cells.

Occasionally, we must work with people who can only export to csv. This does not imply csv is a reasonable way to represent data compared to other options.

Re:A love letter to the CSV format by PaulHoule on Wednesday March 26, 2025 @08:39PM (#43489188)
The HTML 5 spec says exactly how you're supposed to deal with broken HTML files.
Re:A love letter to the CSV format by nukem222 on Wednesday March 26, 2025 @08:42PM (#43489204)
Yes, that is a single spec with correspondingly-small importance. Generally parsing html remains extremely difficult.
Re:A love letter to the CSV format by kibwen on Wednesday March 26, 2025 @09:56PM (#43489670)
It's of quite large importance, and despite being difficult, it is well-specified, which is the point here. Importantly, there is also no competing HTML spec, either de facto or otherwise. CSV doesn't have anything of comparable authority.
Re:A love letter to the CSV format by kokada on Thursday March 27, 2025 @08:33AM (#43492919)
> CSVs are the only "structured" format nobody can claim to parse 100%

You don't need to though since in most cases you just need to support whatever CSV format the tool you're handling, unless of course you're trying to write the next Excel/Google Sheets competitor.

Re:A love letter to the CSV format by deepsun on Wednesday March 26, 2025 @07:44PM (#43488838)
Similarly I had once loved the schemaless datastorages. They are so much simpler!

Until I worked quite a bit with them and realized that there's always schema in the data, otherwise it's just random noise. The question is who maintains the schema, you or a dbms.

Re. formats -- the usefulness comes from features (like format enforcing). E.g. you may skip .ini at all and just go with lines on text files, but somewhere you still need to convert those lines to your data, there's no way around it, the question is who's going to do that (and report sane error messages).

Re:A love letter to the CSV format by nukem222 on Wednesday March 26, 2025 @08:37PM (#43489177)
Schemaless can be accomplished with well-formed formats like json, xml, yaml, toml, etc. from the producer side these are roughly equivalent interfaces. There's zero upside to using CSVs except to comfort your customer. Or maybe you have centered importing of CSVs into your actual business, in which case you should probably not exist.