{"action":"created","issue":{"url":"https://api.github.com/repos/tddbin/katas/issues/15","labels_url":"https://api.github.com/repos/tddbin/katas/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/tddbin/katas/issues/15/comments","events_url":"https://api.github.com/repos/tddbin/katas/issues/15/events","html_url":"https://github.com/tddbin/katas/issues/15","id":97523994,"number":15,"title":"Renaming in destructuring","user":{"login":"ehpc","id":324517,"avatar_url":"https://avatars.githubusercontent.com/u/324517?v=3","gravatar_id":"","url":"https://api.github.com/users/ehpc","html_url":"https://github.com/ehpc","followers_url":"https://api.github.com/users/ehpc/followers","following_url":"https://api.github.com/users/ehpc/following{/other_user}","gists_url":"https://api.github.com/users/ehpc/gists{/gist_id}","starred_url":"https://api.github.com/users/ehpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehpc/subscriptions","organizations_url":"https://api.github.com/users/ehpc/orgs","repos_url":"https://api.github.com/users/ehpc/repos","events_url":"https://api.github.com/users/ehpc/events{/privacy}","received_events_url":"https://api.github.com/users/ehpc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-27T18:22:35Z","updated_at":"2015-07-27T18:34:59Z","closed_at":null,"body":"I want to disagree with you about renaming kata http://tddbin.com/#?kata=es6/language/destructuring/rename. I think there is no renaming. Let me explain my point of view.\r\n\r\nWe have this code [1]:\r\n    const {x: y} = {x: 1};\r\n    assert.equal(y, 1);\r\n\r\nIt is equivalent to [2]:\r\n\tconst {x: x} = {x: 1};\r\n\tassert.equal(x, 1);\r\n\t\r\nWhich is in turn equivalent to [3]:\r\n\tconst {x} = {x: 1};\r\n\tassert.equal(x, 1);\r\n\r\nSo in snippet 3 we have a case of shorthanding the destructuring assignment. Basically it means: destructure an object which has a property by the name \"x\" and assign it's value to a variable named \"x\". The explicit version of this is in snippet 2.\r\nSnippet 1 on the other hand tells: destructure an object which has a property by the name \"x\" and assign it's value to a variable named \"y\".\r\nThere is no renaming of any kind, just a classical destructuring.\r\n\r\nWe can see this in specs: http://www.ecma-international.org/ecma-262/6.0/#sec-destructuring-assignment. The grammar reads as follows:\r\nAssignmentProperty[Yield] :\r\n\tIdentifierReference[?Yield] Initializer[In,?Yield]opt\r\n\tPropertyName : AssignmentElement[?Yield]\r\nAssignmentElement[Yield] :\r\n\tDestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt\r\n\r\nSo we have a \"PropertyName\" and an \"AssignmentElement\", which is no more than a \"DestructuringAssignmentTarget\" with an optional \"Initializer\".\r\nIn out example:\r\n\r\nconst {\r\nx: // PropertyName\r\ny // DestructuringAssignmentTarget\r\n} = {x: 1};\r\n\r\nor even:\r\n\r\nconst {\r\nx: // PropertyName\r\ny // DestructuringAssignmentTarget\r\n=42 // Initializer\r\n} = {y: 23};\r\n"},"comment":{"url":"https://api.github.com/repos/tddbin/katas/issues/comments/125299421","html_url":"https://github.com/tddbin/katas/issues/15#issuecomment-125299421","issue_url":"https://api.github.com/repos/tddbin/katas/issues/15","id":125299421,"user":{"login":"tddbin","id":11061816,"avatar_url":"https://avatars.githubusercontent.com/u/11061816?v=3","gravatar_id":"","url":"https://api.github.com/users/tddbin","html_url":"https://github.com/tddbin","followers_url":"https://api.github.com/users/tddbin/followers","following_url":"https://api.github.com/users/tddbin/following{/other_user}","gists_url":"https://api.github.com/users/tddbin/gists{/gist_id}","starred_url":"https://api.github.com/users/tddbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tddbin/subscriptions","organizations_url":"https://api.github.com/users/tddbin/orgs","repos_url":"https://api.github.com/users/tddbin/repos","events_url":"https://api.github.com/users/tddbin/events{/privacy}","received_events_url":"https://api.github.com/users/tddbin/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T18:34:59Z","updated_at":"2015-07-27T18:34:59Z","body":"The word \"rename\" might not be the best, I agree. Reassign or alike might\nbe better fits.\nAm 27.07.2015 8:22 nachm. schrieb \"Eugene Maslovich\" <\nnotifications@github.com>:\n\n> I want to disagree with you about renaming kata\n> http://tddbin.com/#?kata=es6/language/destructuring/rename. I think there\n> is no renaming. Let me explain my point of view.\n>\n> We have this code [1]:\n> const {x: y} = {x: 1};\n> assert.equal(y, 1);\n>\n> It is equivalent to [2]:\n> const {x: x} = {x: 1};\n> assert.equal(x, 1);\n>\n> Which is in turn equivalent to [3]:\n> const {x} = {x: 1};\n> assert.equal(x, 1);\n>\n> So in snippet 3 we have a case of shorthanding the destructuring\n> assignment. Basically it means: destructure an object which has a property\n> by the name \"x\" and assign it's value to a variable named \"x\". The explicit\n> version of this is in snippet 2.\n> Snippet 1 on the other hand tells: destructure an object which has a\n> property by the name \"x\" and assign it's value to a variable named \"y\".\n> There is no renaming of any kind, just a classical destructuring.\n>\n> We can see this in specs:\n> http://www.ecma-international.org/ecma-262/6.0/#sec-destructuring-assignment.\n> The grammar reads as follows:\n> AssignmentProperty[Yield] :\n> IdentifierReference[?Yield] Initializer[In,?Yield]opt\n> PropertyName : AssignmentElement[?Yield]\n> AssignmentElement[Yield] :\n> DestructuringAssignmentTarget[?Yield] Initializer[In,?Yield]opt\n>\n> So we have a \"PropertyName\" and an \"AssignmentElement\", which is no more\n> than a \"DestructuringAssignmentTarget\" with an optional \"Initializer\".\n> In out example:\n>\n> const {\n> x: // PropertyName\n> y // DestructuringAssignmentTarget\n> } = {x: 1};\n>\n> or even:\n>\n> const {\n> x: // PropertyName\n> y // DestructuringAssignmentTarget\n> =42 // Initializer\n> } = {y: 23};\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/tddbin/katas/issues/15>.\n>\n"}}