2 ms·
It is only now, that I realize, that [<whitespace>a] and [a<whitespace>] are really supposed to be 1 string inside a list. However, I already see problems with
by zelphirkalt 6y ago
It is only now, that I realize, that [<whitespace>a] and [a<whitespace>] are really supposed to be 1 string inside a list. However, I already see problems with this kind of syntax:
[<whitespace>a,<whitespace>b]
How will this be interpreted/parsed? Will there be a whitespace before "b" after parsing? That would mean, that I am not able to separate visually more clearly, by adding a whitespace between list elements, which is widely considered to be a good practice in programming languages. The reason is readability.
The next thing is, that on the same line whitespace is added, but what about multiple lines defining a list? Here we do not add the line breaks and indentation to the string. It's not consistent in this way.
So I personally would never write string like that. I would always make use of quotes in such situations and probably in YAML in general, simply to make it clear, that I do wish to have the leading whitespace in the string, and it is not simply a typo, resulting from removing a former first element from the list.
JSON is limitting, but for configuration I think it's kind of limitations are often good. With comments in JSON I am still not sure, because sometimes I'd like to write them there, but would not like to include another dependency, only to be able to parse away the comments from JSON. Then I better write good docs elsewhere.