Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readable Array of Tables #230

Closed
trans opened this issue Jun 29, 2014 · 2 comments
Closed

Readable Array of Tables #230

trans opened this issue Jun 29, 2014 · 2 comments

Comments

@trans
Copy link

trans commented Jun 29, 2014

For a lot of potential use cases the array-of-tables notation doesn't work well. It's just not very readable if there are more than a few entries. So I was thinking about what the intent of these, and it seems to me they are for tables --not hash tables, but the other kind of tables we commonly use, like in a database. So it would follow, that a notation like so would do the trick:

[products]
[name]    [sku]      [color]
"Hammer"  738594937  ""
"Nail"    284758393  "gray"
"Drill"   111753345  "black"
"Saw"     023445123  "brown"
"Screw"   573512344  "silver"

Exact notation would have to be worked out. The above could work, I think, if single entry tables weren't allowed (i.e. there has to be at least two headers). That might be too restrictive though.

I think anyone will see the merit in this if they simply write out what the above looks like in the current array-of-tables notation --it takes up a whole screen.

@yosymfony
Copy link
Contributor

I think this suggestion violates TOML's simplicity like #204. You'll have readability problems with long-columns values.

@BurntSushi
Copy link
Member

I'm against this. I can appreciate that there may be some use cases where this syntax is clearer, but:

  1. It's probably pretty rare in a config file.
  2. If Tuples and Inline Tables: A Motivation #219 gets fixed, the issue of it taking up the whole screen goes away.
  3. Your suggested syntax seems to introduce significant whitespace. Blech.
  4. I don't know what you mean about hash tables vs "real" tables. A table in TOML is ideally represented as a hash table. The abstraction is a map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants