8000 Clarify inline tables are immutable (and dotted keys can't "inject" into them) · Issue #630 · toml-lang/toml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Clarify inline tables are immutable (and dotted keys can't "inject" into them) #630

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

Closed
pradyunsg opened this issue Jun 16, 2019 · 4 comments · Fixed by #652
Closed

Clarify inline tables are immutable (and dotted keys can't "inject" into them) #630

pradyunsg opened this issue Jun 16, 2019 · 4 comments · Fixed by #652

Comments

@pradyunsg
Copy link
Member

You can't "inject" into inline tables with dotted keys. This isn't clear in the specification and we should clarify.

@LongTengDao
Copy link
Contributor
LongTengDao commented Aug 6, 2019

Also include below (if I am right):

a = {}
[a.b]

@pradyunsg
Copy link
Member Author
a = {}
[a.b]

This isn't valid. This is injecting a "b" key into an inline table defined "a".

@eksortso
Copy link
Contributor
eksortso commented Aug 7, 2019

That would make a good counterexample for the spec, though.

How about this?


Inline tables are immutable. Once they are defined, new elements and subtables cannot be added to them.

a = {}
#a.b = 1  # INVALID
#[a.b]  # INVALID

I would avoid saying the word "inject." "Immutable" carries plenty of weight, so making that meaning clear ought to be sufficient.

@eksortso
Copy link
Contributor

I'm going to have to change the wording. We don't want anyone to think that, when TOML is loaded into a data structure in a program, that the data structure must be immutable. Granted, it's not recommended to modify a configuration in a program. But what the program does with it is outside the scope of the specification.


Once inline tables are defined, their values are fully set, and new elements and subtables cannot be added to them.

a = {}
#a.b = 1  # INVALID
#[a.b]  # INVALID

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

Successfully merging a pull request may close this issue.

3 participants
0