Twitter hashtag: #esspec
便利ツール
時事ネタ
自己紹介 (近況報告)
syumai syumai.icon
Kyoto.goのGo Conference miniに行ってきました
紅葉をちょっと見れた
こう言うのやります
tars0x9752 (たーず / naoki aoyama) tars0x9752.icon
Webフロントエンドエンジニア
fp-ts, cyclejs toka
iwatsurut
とくに、イベントもなく過ごしています。
仕事は、php でお客様向けの Webの開発をしています。
それ以外に、twilio の電話システムのバックエンドを go で書いたりしてます。
夕方いきなり、AWS の操作が全然できないという目にあって、びっくりしました。
PADAone (ぱだわん)
フロントエンドエンジニア
最近は型システム・型理論に興味あります
型システム入門の輪読会やってます
-> リンク欲しいです!
TypeScript 好きです(最近はOCamlとかHaskellに興味あり)
MDNとかObsidianっていうツールの翻訳とかをたまにやってます
趣味は筋トレ・サウナ
AntiSatori
久しぶりの参加になります
最近は型システムとコンパイラーに興味があります(ASTをいじるようなコードを書いてみたい)
ブラウザで動くビジュアルプログラミング環境作ろうとしています
Max MSP的なやつ
フロントエンドエンジニアとして求職中です
前回のあらすじ
3つのルール
a. offending tokenと直前のトークンの間に1つ以上のLineTerminatorがある
b. offending tokenが}
c. The previous token is ) and the inserted semicolon would then be parsed as the terminating semicolon of a do-while statement (14.7.2).
だいたいの statement は文法的にはセミコロンで終わることを期待される
今回の範囲
code:js
OUTER:
for (let i = 0; i < 10; i++) {
INNER:
for (let j = 0; j < 10; j++) {
console.log(i, j);
if (j === 3) {
continue /* ここにセミコロン挿入される */
OUTER
}
}
}
code:js
function f() {
throw
1
};
f();
throw
^^^^^
SyntaxError: Illegal newline after throw
自動挿入されるセミコロンによって文法エラーになるパターン
code:js
function f() {
throw;
1;
};
f();
throw;
^
SyntaxError: Unexpected token ';'
C#はthrowの後にセミコロンで終わることもある
これを将来的に許可する可能性を残したかったのかも(?)
code:js
()
=> console.log(1)
=> console.log(1)
^^
SyntaxError: Unexpected token '=>'
code:js
const a = 1
a
() => {
console.log(a)
}
a
SyntaxError: Malformed arrow function parameter list
code:js
async
function f() {
console.log(1)
}
f()
async
^
ReferenceError: async is not defined
code:js
class C {
async
M() {
this.async = 1
console.log(this.async)
}
}
(new C()).M()
// 1
code:js
async
()
=> 1
async
() => 1
async ()
=> 1
async () => 1
// 有効なのは4つ目だけ
code:js
~/go/src/github.com/syumai/til/js/esspec9(main ✗) echo -n 'console.log(1)' > empty.js
~/go/src/github.com/syumai/til/js/esspec9(main ✗) cat empty.js
console.log(1)%
~/go/src/github.com/syumai/til/js/esspec9(main ✗) node empty.js
1
~/go/src/github.com/syumai/til/js/esspec9(main ✗) echo -n 'if(true)' > empty.js
~/go/src/github.com/syumai/til/js/esspec9(main ✗) cat empty.js
if(true)%
~/go/src/github.com/syumai/til/js/esspec9(main ✗) node empty.js
/Users/syumai/go/src/github.com/syumai/til/js/esspec9/empty.js:1
if(true)
SyntaxError: Unexpected end of input
code:js
~/go/src/github.com/syumai/til/js/esspec9(main ✗) cat left.js
const a = 1 + 2
(function() {
console.log(1)
})()
~/go/src/github.com/syumai/til/js/esspec9(main ✗) node left.js
/Users/syumai/go/src/github.com/syumai/til/js/esspec9/left.js:2
(function() {
^
TypeError: 2 is not a function
code:js
~/go/src/github.com/syumai/til/js/esspec9(main ✗) cat left.js
const a = 1 + 2;
(function() {
console.log(1)
})()
~/go/src/github.com/syumai/til/js/esspec9(main ✗) node left.js
1
次回: 12.10.3 Interesting Cases of Automatic Semicolon Insertion