1 |
On Mon, Aug 12, 2019 at 10:58 AM Kent Fredric <kentnl@g.o> wrote: |
2 |
|
3 |
> On Mon, 12 Aug 2019 09:52:40 -0700 |
4 |
> Alec Warner <antarus@g.o> wrote: |
5 |
> |
6 |
> > CSV, JSON and YAML are both popular machine-and-people readable |
7 |
> > specifications with broad support. |
8 |
> |
9 |
> No, not CSV. There isn't really "a spec" for that. Even though there is |
10 |
> a "proposed spec", "CSV editors" and things that emit CSV just make up |
11 |
> their own rules. |
12 |
> |
13 |
> The more I know about CSV, the less I want anything to do with it. |
14 |
> |
15 |
> In essence, to make CSV viable (or any other delimiter-seperated format |
16 |
> viable), you have to locally redefine what that means to a limited |
17 |
> subset of the spec. |
18 |
> |
19 |
> For instance, forbid the feature where the first line is the string |
20 |
> "Sep=,"[1], which tools like Excel (may) generate, but aren't spec |
21 |
> compliant, and leads to ... interesting things. |
22 |
> |
23 |
> But pretty much you can take it for granted that a '.csv' extension |
24 |
> will make *somebody* make assumptions about the format that aren't true. |
25 |
> |
26 |
> Like for instance, is leading/trailing whitespace around delimiters |
27 |
> significant? Spec says yes[2], but implementations may desire it to be |
28 |
> no ( And gentoo probably prefers them not to be significant for |
29 |
> alignment reasons ) |
30 |
> |
31 |
|
32 |
I mean part of my joke is that instead of using one of the existing ones, |
33 |
you will make your own and it will have its own set of mistakes and |
34 |
assumptions :) |
35 |
|
36 |
|
37 |
> |
38 |
> As for JSON/YAML, ... eh... that may be the case for like, 4 line files. |
39 |
> |
40 |
> But once you have hundreds of entries, that becomes less true. |
41 |
> |
42 |
|
43 |
What becomes less true? |
44 |
|
45 |
|
46 |
> |
47 |
> And both of those can have "Fun" merge conflict issues due to the |
48 |
> requirements around record delimiters and syntax, |
49 |
> |
50 |
|
51 |
And this means what? That I might check something in that is broken? How is |
52 |
this not true for any syntax we define? |
53 |
|
54 |
|
55 |
> |
56 |
> eg: You're using JSON, does your JSON formatter emit every record on |
57 |
> its own line? No? That's going to create annoying merge conflicts. |
58 |
> |
59 |
|
60 |
On the editing side I expect humans to be editing, so the format is not |
61 |
particularly relevant. |
62 |
On the consuming side (e.g. a thing that downloads stuff from |
63 |
apis.gentoo.org) is where the standards are helpful, because I don't have |
64 |
to write some bespoke parser and I can just dump the json stream and get |
65 |
objects back. |
66 |
|
67 |
|
68 |
> |
69 |
> Does your formatter/decoder support trailing "," ? |
70 |
> No? That's going to introduce problems. |
71 |
> |
72 |
|
73 |
The JSON specification doesn't support trailing commas, iirc. I would |
74 |
expect people to follow the specification. |
75 |
|
76 |
|
77 |
> |
78 |
> That's why I'd rather a more narrow, less general, domain specific |
79 |
> format, instead of throwing these general tools at the problem. |
80 |
> |
81 |
> 1: |
82 |
> https://en.wikipedia.org/wiki/Comma-separated_values#General_functionality |
83 |
> 2: https://en.wikipedia.org/wiki/Comma-separated_values#Basic_rules |
84 |
> |