Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 19, 2018. It is now read-only.
/discussPublic archive

Commite717f0f

Browse files
committed
Update const definition
1 parentca2915e commite717f0f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

‎Features.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ foo := 42
3636
which becomes:
3737

3838
```js
39-
constfoo=42
39+
constfoo=42;
4040
```
4141

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.
4543

4644
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.
4745

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp