libXO-ification - Why - and is it a symptom of deeper issues?

Allan Jude allanjude at freebsd.org
Sun Nov 15 18:23:05 UTC 2015


On 2015-11-15 13:16, Allan Jude wrote:
> On 2015-11-15 13:14, Garrett Cooper wrote:
>>
>>> On Nov 15, 2015, at 10:09, Allan Jude <allanjude at freebsd.org> wrote:
>>
>> ...
>>
>>> The big difference is, a json parser isn't going to blow up if a new
>>> field gets added in the middle, and your awk/grep/sed script probably will.
>>
>> That's a plus to those formats, yes, but if someone changes the field name (which can happen today, on a whim, and would go unnoticed for a while because no tests/spec), you'll run into a KeyError in Python or an equivalent error message in your language of choice.
>>
>> Thanks,
>>
> 
> But, if the same change was made to a pure text output, then our 'column
> 3' would suddenly be username instead of ip address, and your program
> would not work at intended either. so at least json would give you a
> warning.
> 
> So, the need for a spec on the output is not specific to encoded
> outputs, changing the output in text is just as disruptful.
> 

Also, libxo now supports the versioning of output, to make it possible
for your json parser to detect when a change to the schema has been made.

-- 
Allan Jude

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20151115/fee8e94d/attachment.bin>


More information about the freebsd-current mailing list