3 ms·
> Like 'jc ls' gives json output with following entry format: { "filename": "[actual-filename-string]" } > Then I start asking: why not simply { "[actual-filen
by msla 7y ago
> Like 'jc ls' gives json output with following entry format: { "filename": "[actual-filename-string]" }
> Then I start asking: why not simply { "[actual-filename-string]" } ?
Because the first at least has a stab at being self-documenting, and maybe even forwards- and backwards-compatible: The file is saying what the values are (unless you're kinda dumb when choosing keys) and, since programs can ask for values by name, older programs won't have to deal with keys added by newer versions and newer programs can deal with missing values more gracefully than abandoning a whole parse because the record has six values instead of ten.
> But then why not:
> { { "metakeyword": "keyword", "metavalue": "filename" }, { "metakeyword": "value", "metavalue": "[actual-filename-string]" } }
Same information, now more verbose. Is there ever going to be a key other than "metakeyword" in that slot? If not, drop it.