{"action":"created","issue":{"url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3840","labels_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3840/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3840/comments","events_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3840/events","html_url":"https://github.com/jashkenas/coffeescript/pull/3840","id":56923105,"number":3840,"title":"Fix #3597: Allow interpolations in object keys","user":{"login":"lydell","id":2142817,"avatar_url":"https://avatars.githubusercontent.com/u/2142817?v=3","gravatar_id":"","url":"https://api.github.com/users/lydell","html_url":"https://github.com/lydell","followers_url":"https://api.github.com/users/lydell/followers","following_url":"https://api.github.com/users/lydell/following{/other_user}","gists_url":"https://api.github.com/users/lydell/gists{/gist_id}","starred_url":"https://api.github.com/users/lydell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydell/subscriptions","organizations_url":"https://api.github.com/users/lydell/orgs","repos_url":"https://api.github.com/users/lydell/repos","events_url":"https://api.github.com/users/lydell/events{/privacy}","received_events_url":"https://api.github.com/users/lydell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-07T19:42:39Z","updated_at":"2015-02-08T04:31:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/3840","html_url":"https://github.com/jashkenas/coffeescript/pull/3840","diff_url":"https://github.com/jashkenas/coffeescript/pull/3840.diff","patch_url":"https://github.com/jashkenas/coffeescript/pull/3840.patch"},"body":"The following is now allowed:\r\n\r\n    o =\r\n      a: 1\r\n      b: 2\r\n      \"#{'c'}\": 3\r\n      \"#{'d'}\": 4\r\n      e: 5\r\n      \"#{'f'}\": 6\r\n      g: 7\r\n\r\nIt compiles to:\r\n\r\n    o = (\r\n      obj = {\r\n        a: 1,\r\n        b: 2\r\n      },\r\n      obj[\"\" + 'c'] = 3,\r\n      obj[\"\" + 'd'] = 4,\r\n      obj.e = 5,\r\n      obj[\"\" + 'f'] = 6,\r\n      obj.g = 7,\r\n      obj\r\n    );\r\n\r\n- Closes #3039. Empty interpolations in object keys are now _supposed_ to be\r\n  allowed.\r\n- Closes #1131. No need to improve error messages for attempted key\r\n  interpolation anymore.\r\n- Implementing this required fixing the following bug:\r\n\r\n      (\"\" + a): 1\r\n\r\n  The above used to error out on the colon, saying \"unexpected colon\". But\r\n  really, it is the attempted object key that is unexpected. Now the error is on\r\n  the opening parenthesis instead.\r\n- However, the above fix broke some error message tests for regexes. The easiest\r\n  way to fix this was to make a seemingly unrelated change: The error messages\r\n  for unexpected identifiers, numbers, strings and regexes now say for example\r\n  'unexpected string' instead of 'unexpected \"\"\"some #{really long} string\"\"\"'.\r\n  In other words, the tag _name_ is used instead of the tag _value_.\r\n  This was way easier to implement, and is more helpful to the user. Using the\r\n  tag value is good for operators, reserved words and the like, but not for\r\n  tokens which can contain any text. For example, 'unexpected identifier' is\r\n  better than 'unexpected expected' (if a variable called 'expected' was used\r\n  erraneously).\r\n- While writing tests for the above point I found a few minor bugs with string\r\n  locations which have been fixed."},"comment":{"url":"https://api.github.com/repos/jashkenas/coffeescript/issues/comments/73396623","html_url":"https://github.com/jashkenas/coffeescript/pull/3840#issuecomment-73396623","issue_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3840","id":73396623,"user":{"login":"lydell","id":2142817,"avatar_url":"https://avatars.githubusercontent.com/u/2142817?v=3","gravatar_id":"","url":"https://api.github.com/users/lydell","html_url":"https://github.com/lydell","followers_url":"https://api.github.com/users/lydell/followers","following_url":"https://api.github.com/users/lydell/following{/other_user}","gists_url":"https://api.github.com/users/lydell/gists{/gist_id}","starred_url":"https://api.github.com/users/lydell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lydell/subscriptions","organizations_url":"https://api.github.com/users/lydell/orgs","repos_url":"https://api.github.com/users/lydell/repos","events_url":"https://api.github.com/users/lydell/events{/privacy}","received_events_url":"https://api.github.com/users/lydell/received_events","type":"User","site_admin":false},"created_at":"2015-02-08T04:31:48Z","updated_at":"2015-02-08T04:31:48Z","body":"I forgot destructuring tests."}}