ECMAScript仕様輪読会 #42
前回: ECMAScript仕様輪読会 #41
Scrapboxの招待リンク: https://scrapbox.io/projects/esspec/invitations/85b96c9fa718ce5185e307196ed8fb53
connpass: https://esspec.connpass.com/
Discord: https://discord.gg/59S3y6weQj
ES Spec Draft: https://tc39.es/ecma262/
読み物リスト
Twitter hashtag: #esspec
21:01 再開
便利ツール
esspec-memo: https://tars0x9752.github.io/esspec-memo/esspec.html
Scrapbox Codeblock Generator: https://vzvu3k6k.github.io/scrapbox-codeblock/
TC39 Terminology: https://github.com/tc39/how-we-work/blob/main/terminology.md
時事ネタ
Bunの勢いがすごいですね
TC39が東京でやってます
https://twitter.com/robpalmer2/status/1706534112641843220?s=20
tars0x9752.icon そういえばそうだった
tars0x9752.icon type annotation!
気がつけばJSConf JPのCfP締め切り目前
自己紹介 (近況報告)
syumai syumai.icon
Twitter: https://twitter.com/__syumai GitHub: https://github.com/syumai
久々に海外に行きました
tars0x9752 (たーず / naoki aoyama) tars0x9752.icon
最近は主に fp-ts と cycle.js な web frontend やってます
https://cycle.js.org/getting-started.html
たまに react / next.js
yebis0942 (えびす) yebis0942.icon
Go, Reactを書いて暮らしています
最近はプライベートではSvelteを使いがち
reactiveに動かすためのお作法がReactと違う
代入操作をする必要があるはず(まだよく分かってない)
直近イベント情報
気がつけばJSConf JPのCfP締め切り目前
Kyoto.js気になっています
https://kyotojs.connpass.com/event/296322/
antisatori
先月初めて受けたTOEICの結果が返ってきて885点でした
台湾に行っても安心かもしれない…?yebis0942.icon
tars0x9752.icon sugoi yebis0942.iconsyumai.icon
https://www.meetup.com/ja-JP/englishonlycafe/
iwatsurut
仕事では、php でお客様向けのサービスのお守りをしてます。
すこし、電話システムのバックエンドを go で動かしてます。
AWS の サーバーを Cloudformation で書いてます。
前回のあらすじ
今回の範囲
読み物リスト
12.3 Line Terminators
改行は空白文字と違ってsyntactic grammarに影響することがある
SingleStringCharacters, DoubleStringCharacterでは<LS> (LINE SEPARATOR), <PS> (PARAGRAPH SEPARATOR)は普通に使うことができる
<LF>, <CR>, <CR><LF>は\の後にしか出現できない
code:js
const
a
=
1
const b = 2;
console.log(a);
console.log(b);
12.4 Comments
because of the general rule that a token is always as long as possible
https://tc39.es/ecma262/#sec-ecmascript-language-lexical-grammar の
The source text is scanned from left to right, repeatedly taking the longest possible sequence of code points as the next input element.
という記述と似ている。
行末の改行はsingle-line commentそのものには含まれない
つまり、single-line commentはセミコロン自動挿入に影響を与えない
改行を含んだmultiline commentはline terminatorと解釈される
code:js
const a = 1 /* OK */ const b = 2;
console.log(a, b);
const c = 1 /* NG
*/ const d = 2;
console.log(c, d);
B.1.1 HTML-like Comments
SingleLineHTMLOpen(Close)Commentの扱いによって脆弱性が発生した例
https://github.com/golang/go/issues/62396
12.5 Hashbang Comments
location-sensitive: ファイルの先頭だけで有効な文法
12.7 Names and Keywords
IdentifierNameはUnicode Annex 31の規則に従う
https://unicode.org/reports/tr31/
https://ufcpp.net/blog/2021/2/uax31/
ただしECMAScriptでは以下の例外を設けている
U+0024 ($)とU+005F (_)はIdentifierNameとして使える
IdentifierStartCharには、明示的にUnicodeIDStart(Unicodeの“ID_Start”)に加えて _ が追加されている
が、IdentifierPartCharにはUnicodeIDContinue(Unicodeの“ID_Continue”)のほかには_が追加されていない
ID_Continueに _ が含まれている
connector punctuation: https://www.compart.com/en/unicode/category/Pc
Unicode Annex 31のbackward compatibility
https://unicode.org/reports/tr31/#Backward_Compatibility
code:js
const ゜ = 1;
console.log(゜); // valid
const ᧚ = 2;
Uncaught SyntaxError: Invalid or unexpected token
const ゜᧚ = 2;
console.log(゜᧚); // valid