[darcs-users] machine-readable formats

Max Battcher me at worldmaker.net
Fri Sep 3 21:56:13 UTC 2010

On 09/03/2010 07:17 AM, Petr Rockai wrote:
> Petr Rockai<me at mornfall.net>  writes:
>> -<hash>: line
>> -<hash>: line
>> ...
>> which makes it a list of singleton hash->line maps... which may be about
>> as convenient as it gets with the data model at hand. For now, I'll
>> implement this and try to sell it as annotate --yaml in adventure. :)
> Ok, another downside of this that I discovered while reading the YAML
> spec is that we can't keep the lines verbatim, even modulo non-printable
> escapes, since these would be ambiguous. We probably need to use quoted
> scalars, which comes with a significant downside, namely that it's much
> harder to parse now without real YAML parser... :(

I'm *for* encouraging people to use a real YAML parser, if we are going 
for a YAML-like output. It would add a form of consistency and easy 
sign-post for best-supported experiences (to parse, just use your local 
YAML parser). YAML parsers exist already for a number of 
languages/platforms. Since YAML's data schema is a clear superset of 
JSON's, its also very easy to convert YAML to JSON (or XML for that 
matter) for those languages/platforms that don't provide YAML parsers.

> The result would look like
> - hash: "..."
> with ", \ and non-printable characters escaped in those ... but it's
> really quite hard to get rid of those correctly. Even though the
> resulting language is still regular, the correct automaton becomes
> unwieldy, defeating the original purpose.

I've got a gut feeling that I'd rather see darcs properly escape things 
in a clear character-oriented format for its machine-readable output 
than deal with verbatim output, anyway.

--Max Battcher--

More information about the darcs-users mailing list