-
Notifications
You must be signed in to change notification settings - Fork 861
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
Nested arrays of tables #353
Comments
One possible idea for an extension, which, I admit, scales not very well, would be to add additional layers of brackets around the table names: one for each level of array depth: [[[matrix]]]
value = 1
[[matrix]]
value = 0
[[[matrix]]]
value = 0
[[matrix]]
value = 1
comment = "bottom right diagonal element" This would be equivalent to the following JSON: "matrix":[ [ { "value":1 }, { "value":0 } ], [ { "value":0 }, { "value":1, "comment":"bottom right diagonal element" } ] ] |
Why does the lack of a matrix notation make TOML strictly less expressive than JSON? I'm interested to know, since I'm not aware of any such notation in JSON. |
@Fischmax: TOML has inline tables, so you should be able to write your example as follows (I think):
|
In #309 @jodastephen suggested an alternative grammar for array table: [analyzers.filter]
[#]
type = "icu-tokenizer"
[#]
type = "lowercase"
[#]
type = "length"
min = 2
max = 35 If this is accepted, it can be easily extended to allow n-dimension matrix: [nested_array_table]
[#]
[##]
value = 1
[##]
value = 0
[#]
[##]
value = 0
[##]
value = 1
comment = "bottom right diagonal element" |
Any workaround? |
IMO, this issue is a duplicate of #309. It can be closed in favour of that. |
Closing as a duplicate of #309. |
I disagree that this is a duplicate of #309. Related, certainly, but not a duplicate. Different syntax for arrays of tables, including several that were proposed on that thread, won't necessarily allow arrays of arrays of tables, and likewise support for arrays of arrays of tables could potentially be added without changing the existing syntax for arrays of tables. |
Hi everyone!
TOML has arrays:
TOML has tables:
TOML even has arraytables:
But is there any way to do something like
in TOML? If so, how can I do this? If not, why can't I do this?
I understand that there is always a way around this, by for instance flattening arrays
or introducing filler structs:
However, none of these seems really appropriate. Also, in that case, TOML would be strict less expressive than JSON, which is kind of a pitty, since JSON is so darn unreadable.
The text was updated successfully, but these errors were encountered: