ECMAScript仕様輪読会 #44
前回: ECMAScript仕様輪読会 #43
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
便利ツール
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
時事ネタ
https://vuefes.jp/2023/
https://nextwebconf.connpass.com/event/300174/
TC39 in Tokyo
https://github.com/tc39/agendas/blob/main/2023/09.md
21:09再開
自己紹介 (近況報告)
syumai syumai.icon
Twitter: https://twitter.com/__syumai GitHub: https://github.com/syumai
原稿が書けた
Deno Festに行ってきました
Ryan Dahlと握手!できた
tars0x9752 (たーず / naoki aoyama) tars0x9752.icon
先週体調がかなり悪かったけど治ってきた
antisatori
先週は寝てしまって参加出来ませんでした
↓ SerenityOSとLadybirdというOSとブラウザを自作している様子をYoutubeにアップしているチャンネル
https://www.youtube.com/@awesomekling
iwatsurut
とくに、イベントもなく過ごしています。
久しぶりに React をさわったら、やっぱりよくわかりませんでした。
仕事では、php でお客様向けのサービスのお守りをしてます。
すこし、電話システムのバックエンドを go で動かしてます。
AWS の サーバーを Cloudformation で書いてます
yebis0942
Tsurugi DBを一瞬眺めたりしていました
リソース潤沢なハードウェアで性能が出るRDBらしい
プレスリリース: https://prtimes.jp/main/html/rd/p/000000001.000124881.html
https://github.com/project-tsurugi/tsurugidb
内部コンポーネントが山とかの名前なのはなぜ?という話があっておもしろい
https://github.com/project-tsurugi/tsurugidb/issues/4
機能とコンポーネント名を独立にさせるメリットの方が、今後の変更可能性を考えると現状では大きい気がします
GitHub Actionまわり、各種ライブラリのアップデートチャンスがありそう
https://github.com/project-tsurugi/tsurugi-annotations-action
枯れていると思われているテクノロジーの再実装よさそう
いまからJavaScriptエンジンの再実装説
前回のあらすじ
Identifier Names
Unicode code pointを指定する記法はいろいろある
予約語
ReservedWords: 明確に定義されている
keywords: 仕様書内でゆるめに使われている
文脈によってキーワードっぽく振る舞うものもある
余談:
今回の範囲
読み物リスト
12.8 Punctuators
Punctuator ::
OptionalChainingPunctuator
OtherPunctuator
OptionalChaningPunctuator
?. [lookahead ∉ DecimalDigit]
?.の直後に数字が来てはいけない
実験してみる
code:js
0?.1:2
ここでは?.ではなく.1として解釈される
Q. ?.はOtherPunctuatorにはマッチしないのか?
Punctuatorが連続するという文法規則はないのではないか
OtherPunctuator
>>>とは…?
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Unsigned_right_shift
符号なしシフト演算子
DivPunctuator
正規表現の/と識別するために分けている
RightBracePunctuator
テンプレート文字列の展開部分の識別のために分けているはず(?)
12.9.3 Numeric Literals
NumericLiteralSeparator: 数字の区切りに使える
LegacyOctalLiteral -> strict mode配下では使えない
code:js
() => { "use strict"; 0o123; }
Function (anonymous)
() => { "use strict"; 0123; }
() => { "use strict"; 0123; }
^^^^
Uncaught SyntaxError: Octal literals are not allowed in strict mode.
NonOctalDecimalIntegerLiteral
code:js
081
81
071
57
LegacyOctalIntegerLiteral
LegacyOctalLikeDecimalIntegerLiteral と中身が完全に同じに見える?
code:js
() => {"use strict"; 079}
() => {"use strict"; 079}
^^^
Uncaught SyntaxError: Decimals with leading zeros are not allowed in strict mode.
() => {"use strict"; 077}
() => {"use strict"; 077}
^^^
Uncaught SyntaxError: Octal literals are not allowed in strict mode.
ExponentPart
code:js
1e+01
10
1e+1
10
1e+00000001
10
1e+0_0_0_0_0_001
10
1e+0.1
1e+0.1
^^
Uncaught SyntaxError: Unexpected number
1e0.1
1e0.1
^^
Uncaught SyntaxError: Unexpected number
1e0001
10
1e011
100000000000 // 0は9個 (8進数) ではなく11個。0は無視されるだけ
0o1n // 文法生成規則には無さそうだがNode.jsでもFirefoxでも通る
// EDIT: NonDecimalIntegerLiteral[+Sep] BigIntLiteralSuffix にマッチしそう
1n
0o11n
9n
0b1n
1n
0b11n
3n
https://github.com/tc39/proposal-bigint/issues/208
https://github.com/tc39/proposal-extended-numeric-literals
13px のように数値リテラルに自由な接尾辞をつけられるようにするという提案
https://ja.wikipedia.org/wiki/Hexspeak
0xDEADBEEFなどなど
12.9.3.2 Static Semantics: MV
MV = Mathematical Value
無限の精度を持った値
12.9.4 String Literals
NOTE
Basic Multilingual Plane(BMP, 基本多言語面)
Unicodeの概念
Code points belonging to the Basic Multilingual Plane are encoded as a single code unit element of the string. All other code points are encoded as two code unit elements of the string.
BMPの範囲内のcode pointは1つのcode unit elementでエンコードされる
範囲外のcode pointは2つでエンコードされる
UTF-16ではBMPの範囲外の文字列はサロゲートペアで表現される(常に2つのcode unit elementで表現できる)
参考: String.fromCodePoint()の最大値は0x10FFFF
LegacyOctalEscapeSequence
やぱそう
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Errors/Deprecated_octal
code:js
"\0" // 8進数