Toml: Optional comma in multi-line arrays

Created on 27 Jun 2014  路  4Comments  路  Source: toml-lang/toml

I would like to propose a small change to the array syntax: make the comma between elements optional if they are separated by a newline. This would allow writing this array:

colors = [ "red", "yellow", "green" ]

alternatively like this:

colors = [
  "red"
  "yellow"
  "green"
]

Of course, commas after elements would still be allowed but they wouldn't be required provided the element is followed by newline.

This would be nicer for humans to write, and it would make the syntax of multi-line arrays more consistent with tables, where key/value pairs are likewise separated by just a newline.

Most helpful comment

I'm against this purely because it's another addition to the spec and there isn't much to be gained IMO. I don't really see a consistency between value arrays and key = value to be that important.

Also, TOML allows trailing commas, which makes one-item-per-line much more convenient anyway.

All 4 comments

I'm against this purely because it's another addition to the spec and there isn't much to be gained IMO. I don't really see a consistency between value arrays and key = value to be that important.

Also, TOML allows trailing commas, which makes one-item-per-line much more convenient anyway.

@BurntSushi :+1:

@BurntSushi :+1:

VCS diffs that are not as noisy would be one benefit to this feature

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pygy picture pygy  路  5Comments

ChristianSi picture ChristianSi  路  3Comments

jacobconley picture jacobconley  路  4Comments

mqudsi picture mqudsi  路  3Comments

clarfonthey picture clarfonthey  路  4Comments