4 ms·
Self-describing data is generally a bad idea. If you can't get programs to agree on the original document format, what makes you think you'll be able to get the
by seagreen 10y ago
Self-describing data is generally a bad idea. If you can't get programs to agree on the original document format, what makes you think you'll be able to get them to agree on this meta format?
EDIT: The right solution is the simple one. Follow RFC4180 exactly. Reject everything that doesn't match it.
- lisivka 10y agoCSV is format for information interchange. General rule for II formats is: be strict in what you emit, be liberal in what you accept. So, yes, follow RFC4180 strictly in your own code, but be able to read CSV files produced by others too. Single line of metainformation can greatly reduce confusion and is easy to throw out, when it is unnecessary.
- x1798DE 10y agoThis rule sounds nice, but you end up with a bunch of malformed documents out there because people emitting it never get feedback about what they are doing wrong. I think I've said this in another thread, but I think rejecting malformed documents even though you could "figure out what they meant" is the equivalent of not telling people when they have food on their face. I think the right pattern for something like this is to complain loudly when you are given a malformed document, then say, "If you really want me to parse this malformed document, use --force and I'll try to make some guesses, but really you should just ask for a well-formed document."
- lisivka 10y agoYep, we have bunch of incompatible formats and tons of legacy documents and systems, but I'm 100% sure that me is not a person to blame for that.
- x1798DE 10y agoWell, I'm saying the attitude of "be liberal in what you accept" is to blame for the fact that malformed documents are being emitted in the first place. A huge number of people will just hack away at something until it works rather than implementing their emitters to spec, so accepting malformed documents is training people to emit malformed documents. That is unrelated to well-formed documents in incompatible formats, though.