git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Raymond <esr@thyrsus.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Simon <turner25@gmail.com>, Eric Raymond <esr@snark.thyrsus.com>,
	git@vger.kernel.org
Subject: Re: More git status --porcelain lossage
Date: Sat, 10 Apr 2010 18:57:04 -0400	[thread overview]
Message-ID: <20100410225704.GA4623@thyrsus.com> (raw)
In-Reply-To: <201004102321.59263.jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com>:
> [JSON] is a bit chatty, but is to some extent self documenting.

Yes. But to my mind, the big win of JSON is that you can extend it without
breaking parsers looking for older versions - they just skip the new
fields and all is happy.

Jakub, you seem to know this, but other listmermbers may not: I've
recently re-engineered GPSD, a service daemon for watching geolocation
sensors, to report JSON objects up the socket to client apps.  The
benefits in clarity and extensibility of the protocol have been
*huge*.  Like, today I'm adding a reporting type for digital
compass/gyroscope sensors.

> The question is whether it should output well formed array of objects,
> or just list of objects not wrapped in array...

Yes, I know this dance.  Answer: one big JSON object, tagged by the
name of the output generator, and also *containing a version-stamp
field*.  Array of file status objects is another top-level member.

The point is: later, if we want to enrich the reporting format, we add
whatever fields we want and bump the version stamp.  Self-describing
goodness.  Python, Perl, JavaScript, and Emacs LISP clients win
especially big.  Slurping this into a native data structure is one
function call.

The more I think about this, the better I like it.
 
> What I am worrying about is correct handling of escaping, quoting,
> and non-ASCII characters in strings (the JSON-quoting and JSON-escapes
> are different than C escape codes, IIRC).  JSON rules are simple,
> but are different than C.

Yes. Perhaps there's some scope for reuse here after all.  GPSD has
well-tested code for uttering the JSON quote/escape conventions. 
The git project is welcome to it.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

  reply	other threads:[~2010-04-10 22:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 19:06 More git status --porcelain lossage Eric Raymond
2010-04-09 19:09 ` Eric Raymond
2010-04-09 19:22 ` Jakub Narebski
2010-04-09 19:50   ` Eric Raymond
2010-04-10  4:12 ` Jeff King
2010-04-10  4:14   ` Jeff King
2010-04-10 18:48 ` Simon
2010-04-10 19:01   ` Jakub Narebski
2010-04-10 19:41     ` Eric Raymond
2010-04-10 20:31       ` Martin Langhoff
2010-04-10 22:28         ` Paolo Bonzini
2010-04-10 23:06           ` Eric Raymond
2010-04-11 11:04           ` David Aguilar
2010-04-10 21:21       ` Jakub Narebski
2010-04-10 22:57         ` Eric Raymond [this message]
2010-04-10 19:30   ` Eric Raymond
2010-04-10 19:39     ` Ævar Arnfjörð Bjarmason
2010-04-10 21:24       ` Simon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100410225704.GA4623@thyrsus.com \
    --to=esr@thyrsus.com \
    --cc=esr@snark.thyrsus.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=turner25@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).