8000 Clarification: Array of tables vs Array of inline tables · Issue #738 · toml-lang/toml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Clarification: Array of tables vs Array of inline tables #738
Closed
@tperami

Description

@tperami

The question is: Do array of tables with the [[table]] syntax have the same meaning as inline array of tables ?

For example: do those two documents have the same value ?

[[table]] 
a = 42
b = "test"

[[table]]
c = 4.2

And

table = [ { a = 42, b = "test" }, {c = 4.2} ]

I expect that they have the same value but a sentence in the specification mentioning that they are indeed the same seems a good idea. In particular this sentence from the specification is problematic:

The last type that has not yet been described is an array of tables

It is at the beginning of the "Arrays of table" and can be interpreted to imply that an array of table is a new type that wasn't defined before and in particular that it is not the same type as the type described in section "Arrays". It would be much better to describe it as a another syntax for an existing type rather than a new type. I suppose that in TOML history table of arrays were introduced before inline arrays and so that sentence is historical.

I wouldn't mention it normally but it seems that the only test suite listed on your wiki, i.e https://github.com/BurntSushi/toml-test, does a difference between double bracket array of tables and array of inline table. The former do not have the {type="array", ...} marker but the latter does, and so the two documents above are parsed differently in JSON according to that test suite.

Hopefully when https://github.com/toml-lang/compliance is operational that kind of problem won't exist anymore

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0