{"action":"created","issue":{"url":"https://api.github.com/repos/toml-lang/toml/issues/456","repository_url":"https://api.github.com/repos/toml-lang/toml","labels_url":"https://api.github.com/repos/toml-lang/toml/issues/456/labels{/name}","comments_url":"https://api.github.com/repos/toml-lang/toml/issues/456/comments","events_url":"https://api.github.com/repos/toml-lang/toml/issues/456/events","html_url":"https://github.com/toml-lang/toml/issues/456","id":216223578,"number":456,"title":"Allow \"[]\" to return to global scope (for adding sibling array after a table)","user":{"login":"TedDriggs","id":4805575,"avatar_url":"https://avatars1.githubusercontent.com/u/4805575?v=3","gravatar_id":"","url":"https://api.github.com/users/TedDriggs","html_url":"https://github.com/TedDriggs","followers_url":"https://api.github.com/users/TedDriggs/followers","following_url":"https://api.github.com/users/TedDriggs/following{/other_user}","gists_url":"https://api.github.com/users/TedDriggs/gists{/gist_id}","starred_url":"https://api.github.com/users/TedDriggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TedDriggs/subscriptions","organizations_url":"https://api.github.com/users/TedDriggs/orgs","repos_url":"https://api.github.com/users/TedDriggs/repos","events_url":"https://api.github.com/users/TedDriggs/events{/privacy}","received_events_url":"https://api.github.com/users/TedDriggs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":36,"created_at":"2017-03-22T22:07:44Z","updated_at":"2017-04-12T12:35:42Z","closed_at":null,"body":"I'm trying to model this Rust struct in TOML:\r\n\r\n```rust\r\n#[derive(Debug, Clone, PartialEq, Deserialize)]\r\npub struct WhitelistConfig<T: DeviceIdentifier> {\r\n    appliance: Appliance,\r\n    rules: Vec<Rule>,\r\n    \r\n    #[serde(default)]\r\n    ignore: PhantomData<T>\r\n}\r\n```\r\n\r\nWhen writing it out in TOML, I believe the natural way to read/write it would be:\r\n\r\n1. Provide information about the appliance this config file connects to\r\n1. Provide the list of rules (which could be long)\r\n\r\nThat would look something like...\r\n\r\n```toml\r\n[appliance]\r\nhost = \"teddriggs-dev\"\r\napi_key = \"MY-API-KEY\"\r\n\r\n# this isn't valid right now; it will consider the field to be part of `appliance`\r\nrules = [\r\n    { tag = \"whitelist\" },\r\n    { group_id = 1 }\r\n]\r\n```\r\n\r\nOne approach I thought of that could address this would be allowing `[]` to appear once to return to global scope after entering a table. It would be invalid to use `[]` if the document started with key-value pairs, avoiding the splitting of a table definition.\r\n\r\nThis might be too narrow a case, but I think the pattern of 'metadata + a list' seems likely to occur somewhat frequently. This may also dovetail with #309; shorter syntax for arrays-of-tables would make me less concerned about teaching users the `[[rules]]` construct. \r\n"},"comment":{"url":"https://api.github.com/repos/toml-lang/toml/issues/comments/293562414","html_url":"https://github.com/toml-lang/toml/issues/456#issuecomment-293562414","issue_url":"https://api.github.com/repos/toml-lang/toml/issues/456","id":293562414,"user":{"login":"guai","id":220780,"avatar_url":"https://avatars0.githubusercontent.com/u/220780?v=3","gravatar_id":"","url":"https://api.github.com/users/guai","html_url":"https://github.com/guai","followers_url":"https://api.github.com/users/guai/followers","following_url":"https://api.github.com/users/guai/following{/other_user}","gists_url":"https://api.github.com/users/guai/gists{/gist_id}","starred_url":"https://api.github.com/users/guai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guai/subscriptions","organizations_url":"https://api.github.com/users/guai/orgs","repos_url":"https://api.github.com/users/guai/repos","events_url":"https://api.github.com/users/guai/events{/privacy}","received_events_url":"https://api.github.com/users/guai/received_events","type":"User","site_admin":false},"created_at":"2017-04-12T12:35:42Z","updated_at":"2017-04-12T12:35:42Z","body":"@ChristianSi, then why is it ok to get \"table re-opened\" error on levels > 0?"}}
{"actor":{"display_login":"guai"}}