[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [DEP 12] Why chosing YAML.



Charles Plessy <plessy@debian.org> writes:

> The "deb822" format, also known as "control data" or "paragraph" format,
> is particularly useful for keeping in a single file a serie of groups of
> fields, where the order of the groups is significant.  This is the case
> for the source package control file (debian/control), where the first
> paragraph is a header, or for the machine-readable Debian copyright
> file, where the patterns of the Files paragraphs take precedence over
> each other.  Apart from this, I think that it has no advantage over
> YAML.

> The YAML format is precisely specified, but it is not the case of the
> control data format, because the nature of each field (simple, folded,
> multiline) has to be defined in advance.  In contrast, with YAML, the
> nature of the field (scalar, sequence, mapping), is embedded in the
> syntax.  In the case of the proposed debian/upstream file, I find this
> feature very important as I would like it to be easy to extend with new
> fields.

> The YAML format is also very convenient as it matches closely data
> structures (scalar, array, hash) found in common interpreted languages.

Both YAML and JSON are considerably nicer formats than the RFC822-based
format of Debian control files: better-specified, more standardized,
clearer, less ambiguous, easier to understand, and *far* more widely
implemented in terms of finding a parser (or even a writer) for the format
in just about any language.  (JSON has probably surpassed YAML at this
point, and is probably what I'd use for anything new, but it has a little
bit more syntactic noise for humans than YAML does since you have to quote
strings.)

If we were inventing the Debian infrastructure from scratch today, I'd use
JSON or YAML for all the control files.

That said, every other structured file in a Debian package (with a few
minor exceptions like debian/watch) is in the deb822 format.  So it's
basically a question of whether the additional hassle of having to deal
with two different formats and two different parsers in code that operates
on Debian packages is worth the benefits of YAML.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: