{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/1010","labels_url":"https://api.github.com/repos/babel/babel/issues/1010/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/1010/comments","events_url":"https://api.github.com/repos/babel/babel/issues/1010/events","html_url":"https://github.com/babel/babel/issues/1010","id":61038439,"number":1010,"title":"Computed properties + Symbols","user":{"login":"timoxley","id":43438,"avatar_url":"https://avatars.githubusercontent.com/u/43438?v=3","gravatar_id":"","url":"https://api.github.com/users/timoxley","html_url":"https://github.com/timoxley","followers_url":"https://api.github.com/users/timoxley/followers","following_url":"https://api.github.com/users/timoxley/following{/other_user}","gists_url":"https://api.github.com/users/timoxley/gists{/gist_id}","starred_url":"https://api.github.com/users/timoxley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timoxley/subscriptions","organizations_url":"https://api.github.com/users/timoxley/orgs","repos_url":"https://api.github.com/users/timoxley/repos","events_url":"https://api.github.com/users/timoxley/events{/privacy}","received_events_url":"https://api.github.com/users/timoxley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-13T11:01:37Z","updated_at":"2015-03-13T11:09:48Z","closed_at":null,"body":"\r\nSymbols work fine as regular keys:\r\n\r\n```js\r\n> let key = Symbol('key')\r\nundefined\r\n> let a = {}\r\nundefined\r\n> a[key] = 'value'\r\n'value'\r\n> a\r\n{}\r\n> Object.getO\r\n> Object.getOwnPropertySymbols(a)\r\n[ {} ]\r\n> JSON.stringify(a)\r\n'{}'\r\n```\r\n\r\nSo far so good but how about computed properties:\r\n\r\n```js\r\n\r\n> b = {[Symbol('anotherkey')]: 'value'}\r\n{ 'Symbol(anotherkey)_r.7hg3clbbmf17nwmi': 'value' }\r\n> Object.getOwnPropertySymbols(b)\r\n[ {} ]\r\n> JSON.stringify(b)\r\n'{\"Symbol(anotherkey)_r.7hg3clbbmf17nwmi\":\"value\"}'\r\n```\r\nSymbols don't seem to work correctly as computed properties.\r\nSeems to come down to computed properties being enumerable, regardless whether their contents are Symbols or not:\r\n\r\n```js\r\n> Object.getOwnPropertyDescriptors(a)\r\n{ 'Symbol(key)_q.dfiwdc4nm9t9ms4i':\r\n   { value: 'value',\r\n     writable: true,\r\n     enumerable: false,\r\n     configurable: true } }\r\n> Object.getOwnPropertyDescriptors(b)\r\n{ 'Symbol(anotherkey)_r.7hg3clbbmf17nwmi':\r\n   { value: 'value',\r\n     writable: true,\r\n     enumerable: true,\r\n     configurable: true } }\r\n\r\n```\r\n\r\nSeems like a faulty artifact of babel transformation to me, but I checked the spec quickly and can't find any explicit references to the behaviour of Symbols in computed properties, so I'm not exactly sure what the correct behaviour should be here."},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/78922052","html_url":"https://github.com/babel/babel/issues/1010#issuecomment-78922052","issue_url":"https://api.github.com/repos/babel/babel/issues/1010","id":78922052,"user":{"login":"timoxley","id":43438,"avatar_url":"https://avatars.githubusercontent.com/u/43438?v=3","gravatar_id":"","url":"https://api.github.com/users/timoxley","html_url":"https://github.com/timoxley","followers_url":"https://api.github.com/users/timoxley/followers","following_url":"https://api.github.com/users/timoxley/following{/other_user}","gists_url":"https://api.github.com/users/timoxley/gists{/gist_id}","starred_url":"https://api.github.com/users/timoxley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timoxley/subscriptions","organizations_url":"https://api.github.com/users/timoxley/orgs","repos_url":"https://api.github.com/users/timoxley/repos","events_url":"https://api.github.com/users/timoxley/events{/privacy}","received_events_url":"https://api.github.com/users/timoxley/received_events","type":"User","site_admin":false},"created_at":"2015-03-13T11:09:48Z","updated_at":"2015-03-13T11:09:48Z","body":"```\r\n> echo \"console.log(JSON.stringify({[Symbol('anotherkey')]: 'value'}))\" > t.js && babel-node t.js && rm t.js\r\n{\"Symbol(anotherkey)_q.pba23r6ghu8tzkt9\":\"value\"}\r\n```"}}