You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 19, 2018. It is now read-only.
Copy file name to clipboardExpand all lines: Features.md
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -36,12 +36,10 @@ foo := 42
36
36
which becomes:
37
37
38
38
```js
39
-
constfoo=42
39
+
constfoo=42;
40
40
```
41
41
42
-
This has the advantage that it’s not a breaking change; currently`:=` fails to compile. Adding support for this new operator includes mimicking with`const` what CoffeeScript currently does with`var`, in that it tracks all assigned variables and initializes them together in one`var` statement at the top of the scope.
43
-
44
-
There is no need to support`?:=`, since by definition constants can’t be reassigned.
42
+
This has the advantage that it’s not a breaking change; currently`:=` fails to compile.`const` variables must be assigned and declared in the same operation, so such declarations would happen in JavaScript at the same place in your code (unlike`var` declarations which happen at the top of the scope). There is no need to support`?:=`, since by definition constants can’t be reassigned.
45
43
46
44
Nothing 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.