[rust-dev] Configuration files library for Rust

Paul Nathan pnathan at vandals.uidaho.edu
Sat Jan 4 13:52:52 PST 2014


On 1/4/14 12:30 PM, Tony Arcieri wrote:
> On Sat, Jan 4, 2014 at 12:26 PM, Gaetan <gaetan at xeberon.net
> <mailto:gaetan at xeberon.net>> wrote:
> 
>     I m interessed on having your feedback on json and yaml vs toml for
>     instance.
> 
> JSON is ugly and token-ridden for configuration files. Having worked
> with tools that use it for this purpose, I find the configuration hard
> to read. Then there's the issue of comments, which are particularly
> important for configuration files. Some things have adopted JS-style
> comments for this purpose, but that's technically not standard JSON.
> 

All of this is true. Further, JSON is very fiddly and sensitive to typos
(e.g., spare " and ,) , which is something that does not play well with
many users, who are not used to or comfortable with that level of syntax
rigor.

> YAML's problem is indentation errors can turn into configuration errors,
> and they're incredibly tricky to spot. I've run into cases where we
> didn't spot problems until we deployed to production because the
> "production" section of a configuration file was misindented.

This is also my experience: making or using a tool to do special-purpose
editing of plaintext files sits ill with me.


TOML is very like INI, but includes hierarchical capabilities, which is
one of the cardinal problems with INI.  TOML has a spec, unlike INI,
which is nice.

 TOML is also similar in concept to YAML, but has certain variances -
It is not whitespace-delimited (unlike YAML), which makes it simple to
parse and visually edit by hand.  YAML is reputed to be fairly insecure,
something which would be good to avoid even the possibility of out of
the gate[1].

TOML also specifies types out of the gate and covers certain gaps in
JSON capabilities in this regards (I don't remember YAML here one way or
another).


And a final word - IMO it's better to have a system where it's harder to
shoot yourself in the foot. TOML and INI are roughly at the same level
here. JSON and YAML are a little easier to make mistakes with IME.


[1] http://blogs.teamb.com/craigstuntz/2013/02/04/38738/
-- 
Regards,
Paul

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 946 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140104/5836f9c2/attachment.sig>


More information about the Rust-dev mailing list