{"action":"created","issue":{"url":"https://api.github.com/repos/jashkenas/coffeescript/issues/4311","repository_url":"https://api.github.com/repos/jashkenas/coffeescript","labels_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/4311/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/4311/comments","events_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/4311/events","html_url":"https://github.com/jashkenas/coffeescript/pull/4311","id":177959758,"number":4311,"title":"Output ES2015 arrow functions","user":{"login":"GeoffreyBooth","id":456802,"avatar_url":"https://avatars.githubusercontent.com/u/456802?v=3","gravatar_id":"","url":"https://api.github.com/users/GeoffreyBooth","html_url":"https://github.com/GeoffreyBooth","followers_url":"https://api.github.com/users/GeoffreyBooth/followers","following_url":"https://api.github.com/users/GeoffreyBooth/following{/other_user}","gists_url":"https://api.github.com/users/GeoffreyBooth/gists{/gist_id}","starred_url":"https://api.github.com/users/GeoffreyBooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeoffreyBooth/subscriptions","organizations_url":"https://api.github.com/users/GeoffreyBooth/orgs","repos_url":"https://api.github.com/users/GeoffreyBooth/repos","events_url":"https://api.github.com/users/GeoffreyBooth/events{/privacy}","received_events_url":"https://api.github.com/users/GeoffreyBooth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jashkenas/coffeescript/milestones/10","html_url":"https://github.com/jashkenas/coffeescript/milestones/2.0.0","labels_url":"https://api.github.com/repos/jashkenas/coffeescript/milestones/10/labels","id":2015479,"number":10,"title":"2.0.0","description":"A breaking-change release of CoffeeScript that outputs the latest implemented ECMAScript syntax whenever possible.","creator":{"login":"GeoffreyBooth","id":456802,"avatar_url":"https://avatars.githubusercontent.com/u/456802?v=3","gravatar_id":"","url":"https://api.github.com/users/GeoffreyBooth","html_url":"https://github.com/GeoffreyBooth","followers_url":"https://api.github.com/users/GeoffreyBooth/followers","following_url":"https://api.github.com/users/GeoffreyBooth/following{/other_user}","gists_url":"https://api.github.com/users/GeoffreyBooth/gists{/gist_id}","starred_url":"https://api.github.com/users/GeoffreyBooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeoffreyBooth/subscriptions","organizations_url":"https://api.github.com/users/GeoffreyBooth/orgs","repos_url":"https://api.github.com/users/GeoffreyBooth/repos","events_url":"https://api.github.com/users/GeoffreyBooth/events{/privacy}","received_events_url":"https://api.github.com/users/GeoffreyBooth/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2016-09-20T04:18:33Z","updated_at":"2016-09-20T04:18:51Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2016-09-20T04:13:59Z","updated_at":"2016-09-20T16:24:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jashkenas/coffeescript/pulls/4311","html_url":"https://github.com/jashkenas/coffeescript/pull/4311","diff_url":"https://github.com/jashkenas/coffeescript/pull/4311.diff","patch_url":"https://github.com/jashkenas/coffeescript/pull/4311.patch"},"body":"**WIP**. Just thought I’d get the ball rolling and try to establish a precedent for merging into the `2` branch. I’ve only spent a few minutes on this, and I was surprised how easy it was to get `=>` to output as `=>`; although I get the sense that there are a lot of considerations to `=>` that I’m not considering. Please enlighten me.\r\n\r\nOnly two tests fail with this patch, but I’m not sure that they should pass:\r\n```coffee\r\ntest \"`new` works against bare function\", ->\r\n  eq Date, new ->\r\n    eq this, new => this\r\n    Date\r\n\r\ntest \"#2009: don't touch `` `this` ``\", ->\r\n  nonceA = {}\r\n  nonceB = {}\r\n  fn = null\r\n  (->\r\n    fn = => this is nonceA and `this` is nonceB\r\n  ).call nonceA\r\n  ok fn.call nonceB\r\n```\r\n\r\n@lydell actually [commented](https://github.com/jashkenas/coffeescript/pull/4198#issuecomment-178812597) back when he wrote the second test that it would fail when we output `=>`. So maybe it’s time to remove that test?\r\n\r\nAs for the first one, I get the sense that the test was written expecting the arrow function to be wrapped by an IIFE. I presume that the point of outputting `=>` for `=>` is to get our output closer to its input, and therefore we shouldn’t be dropping unexpected wrapper functions into the output:\r\n\r\n```bash\r\n./bin/coffee -bpe 'foo = (bar) => console.log bar, @'\r\n```\r\n```js\r\nvar foo;\r\n\r\nfoo = (bar) => {\r\n  return console.log(bar, this);\r\n};\r\n```\r\n\r\nIs this correct? Or should this test pass somehow?\r\n\r\nThere must be lots of additional code scattered across the repo that can be removed now that we needn’t do so much work to parse `=>`. What cleanup needs to be done?"},"comment":{"url":"https://api.github.com/repos/jashkenas/coffeescript/issues/comments/248354083","html_url":"https://github.com/jashkenas/coffeescript/pull/4311#issuecomment-248354083","issue_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/4311","id":248354083,"user":{"login":"atg","id":32292,"avatar_url":"https://avatars.githubusercontent.com/u/32292?v=3","gravatar_id":"","url":"https://api.github.com/users/atg","html_url":"https://github.com/atg","followers_url":"https://api.github.com/users/atg/followers","following_url":"https://api.github.com/users/atg/following{/other_user}","gists_url":"https://api.github.com/users/atg/gists{/gist_id}","starred_url":"https://api.github.com/users/atg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atg/subscriptions","organizations_url":"https://api.github.com/users/atg/orgs","repos_url":"https://api.github.com/users/atg/repos","events_url":"https://api.github.com/users/atg/events{/privacy}","received_events_url":"https://api.github.com/users/atg/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T16:24:03Z","updated_at":"2016-09-20T16:24:03Z","body":"My intuition of CoffeeScript functions is that `->` has a free `this` but `=>` has a bound `this`. That's it. It's kind of weird for `arguments` to depend on the whether this was bound or not. If you are going to ban `arguments` then ban it from both or neither."}}
{"actor":{"display_login":"atg"}}