Am 21.11.2013 17:52, schrieb Bruno Medeiros:

On 09/03/2013 12:11, Sönke Ludwig wrote:

There has been some discussion about using a different format than
JSON for the package description
files
. While this topic is
techinically not particularily pressing, it would be good to know
where to go with this early. The two candidates so far are YAML and
SDL. JSON will still be supported for backwards compatibility and as
the default format that is transferred over the network (package
registry). The following sections list the pros/cons of each format
and an example of how it could look like. My favorite so far is SDL,
which was originally proposed by Nick Sabalausky, who also made a D
implementation
. So now I
think it would be good to get some more input to get a collective
opinion on this before implementing anything.

Have you considered lenient JSON as an alternative?

Lenient JSON is a loosely defined extension to JSON that allows many of
the things that would make it a more succint and clear data format. For
a description of lenient JSON, see this:
http://developer.android.com/reference/android/util/JsonReader.html#setLenient%28boolean%29

It allows these extra syntaxes:

  • End of line comments starting with // or # and ending with a newline

character.

  • C-style comments starting with / and ending with /. Such comments

may not be nested.

  • Names that are unquoted or 'single quoted'.
  • Strings that are unquoted or 'single quoted'.
  • Array elements separated by ; instead of ,.
  • Unnecessary array separators. These are interpreted as if null was

the omitted value.

  • Names and values separated by = or => instead of :.
  • Name/value pairs separated by ; instead of ,.

Some JSON parser/readers support this functionality already, so there is
also some tool support already (although not for D).

I think it was suggested before on the D newsgroup, but it looks like
it would solve only two issues - the quotes required around names and
lack of comments. But there are two other significant things where both
SDL and (slightly worse) YAML are an improvement - reducing (visual)
nesting levels and matching parentheses.

But on the other hand I guess if lenient JSON would have been supported
from the start, then the shouting for a better format would possibly
have never started in the first place...

Anyway, SDL IMHO hits a nice sweet spot between a well thought out
custom syntax and a generic data description language, as well as
between simplicity and power. And if nothing else, I think it's a format
worth helping to become more popular ;)