ECMAScript 6th 2012-05-04 Draft
ECMAScript 6th のドラフト(harmony:specification_drafts [ES Wiki])が更新されてる。
前回同様に構文のみを抽出した文書を更新したよ。
今回の構文的な変更は...3点ほど
- NumericLiteralに新たなリテラル定義
- BinaryIntegerLiteral
- OctalIntegerLiteral
- ArrayComprehensionの
()
が不要に - ArrowFunction構文が追加
NumericLiteralに新たなリテラル定義
数値リテラルに新たなのが2点ほど追加された
BinaryIntegerLiteral
0 or 1 を示すリテラル?コメント欄参照
BinaryIntegerLiteral: 0b BinaryDegit 0B BinaryDegit BinaryIntegerLiteral BinaryDegit BinaryDegit: one of 0 1
はい、使い道が分かりません><
OctalIntegerLiteral
8進数な数値を示すリテラル
OctalIntegerLiteral: 0o OctalDigit 0O OctalDigit OctalIntegerLiteral OctalDigit OctalDigit: one of 0 1 2 3 4 5 6 7
Strictモード環境では010
みたいなのが使えないから、こちらは悪くない感じ。
ArrayComprehensionの()
が不要に
今までは
var arry = [v for (v of hogeList)];
だったのが、
var arry = [v for v of hogeList];
になる。
ArrowFunction構文が追加
ちょっと前に、ECMAScriptで提案されている arrow function についてで紹介したもの。
あの時は、まだECMAScript 6thに入るか微妙といっていたけど、入ってきたね!
var func1 = arg1 => AssignmentExpression; var func2 = () => AssignmentExpression; var func3 = (arg1, arg2) => { FunctionBody }
ちょいメモ
追記
構文のみを書いたけど、今回のドラフトにはビルトインオブジェクトやそのprototypeにメソッドやプロパティの追加が結構ある。そのうちまとめまる予定