{"action":"created","issue":{"url":"https://api.github.com/repos/coffeescript6/discuss/issues/31","repository_url":"https://api.github.com/repos/coffeescript6/discuss","labels_url":"https://api.github.com/repos/coffeescript6/discuss/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/coffeescript6/discuss/issues/31/comments","events_url":"https://api.github.com/repos/coffeescript6/discuss/issues/31/events","html_url":"https://github.com/coffeescript6/discuss/issues/31","id":175425936,"number":31,"title":"const assignment operator","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":[{"url":"https://api.github.com/repos/coffeescript6/discuss/labels/feature%20discussion","name":"feature discussion","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":29,"created_at":"2016-09-07T06:49:52Z","updated_at":"2016-09-17T17:06:18Z","closed_at":null,"body":"Branching off from #1 and #30, I thought it would be good to have a thread dedicated to discussing the proposed new operator for explicitly declaring and assigning a variable as a `const`. This thread is *not* for debating automatic `let` assignment, or whether we should change other things related to variable assignment. Just `const`. For other topics, please comment on other issue threads.\r\n\r\nThe consensus from #1 seems to be to add an `:=` operator that works like `=`, but declares and assigns a variable as a `const`. So:\r\n\r\n```coffee\r\nfoo := 42\r\n```\r\nbecomes:\r\n\r\n```js\r\nconst foo = 42;\r\n```\r\n\r\nThis has the advantage that it’s not a breaking change; currently `:=` fails to compile. There is no need to support `?:=`, since by definition constants can’t be reassigned.\r\n\r\nNothing else would be changed by adding this new operator. Normal assignment is handled as it is today, with `var`. Even though using `:=` would cause `const` to be in the generated output, this feature is “opt in” like modules and the same warning would apply about transpiling CoffeeScript’s output.\r\n\r\nIf people like the idea but disagree with the syntax, I invite you to propose an alternate syntax _that isn’t a breaking change._ Simply following ES2015, with a syntax like `const foo = 42`, is an option since `const` is already a reserved word in CoffeeScript.\r\n\r\nSo I think the debate is: should we add this at all? And if so, this syntax or some other backwards-compatible syntax?"},"comment":{"url":"https://api.github.com/repos/coffeescript6/discuss/issues/comments/247789642","html_url":"https://github.com/coffeescript6/discuss/issues/31#issuecomment-247789642","issue_url":"https://api.github.com/repos/coffeescript6/discuss/issues/31","id":247789642,"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},"created_at":"2016-09-17T17:06:18Z","updated_at":"2016-09-17T17:06:18Z","body":"See [this comment](https://github.com/coffeescript6/discuss/issues/35#issuecomment-247758678). I really don’t think allowing `const` without `let` is feasible, for all the other differences that `const` has from `var` aside from unreassignability. I still think we should close this issue and leave #35 as the only viable option for supporting `let`/`const`."}}
{"actor":{"display_login":"GeoffreyBooth"}}