Live data from Hacker News

TOML [Tom's Obvious Minimal Language]

toml.io

11–13 of 13 posts

Re: TOML [Tom's Obvious Minimal Language]

#11
post #6

I tried to use toml in as config format for the app I am building at my day job. I ditched it for json because it's representation is not unambiguous, meaning the same object tree has many many different valid representations in toml. This makes it really hard to implement roundtripping of the config string to object tree and then back to config string without losing the specific toml representation chosen by the con…

I think you meant JSON5 since JSON doesn't have comments.

Well since it's my own parser I support both inline and line ending comments. So I guess it's technically jsonc (json with comments) but whatever really.

Clarification: when speaking of json formatting I handle 2 distinct cases that make sense for me: inline objects and inline arrays (where all properties/ elements are on the same line) which make Configs more readable when the objects / arrays are small.

Re: TOML [Tom's Obvious Minimal Language]

#12
post #6

I tried to use toml in as config format for the app I am building at my day job. I ditched it for json because it's representation is not unambiguous, meaning the same object tree has many many different valid representations in toml. This makes it really hard to implement roundtripping of the config string to object tree and then back to config string without losing the specific toml representation chosen by the con…

I think you meant JSON5 since JSON doesn't have comments.

Douglas Crockford himself recommended using comments if you like then piping it through JSMin. Unfortunately the original post on Google+ no longer exists but it's referenced in a HN thread[0].

    I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have
    destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn’t.

    Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all 
    the comments you like. Then pipe it through JSMin before handing it to your JSON parser.
Which of course doesn't help because you could still just add parsing directives into the comments anyway. But as far as I'm concerned that means the spec implicitly allows comments as long as they're stripped out in transport.

[0]https://news.ycombinator.com/item?id=3912149

Re: TOML [Tom's Obvious Minimal Language]

#13
post #12

Earlier quoted context omitted.

I think you meant JSON5 since JSON doesn't have comments.

Douglas Crockford himself recommended using comments if you like then piping it through JSMin. Unfortunately the original post on Google+ no longer exists but it's referenced in a HN thread[0]. I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn’t. Su…

It doesn't matter that if he allowed comments initially if the final (current) specification didn't allow them.
Post reply on HN