ECMAScript仕様輪読会 #55
前回: ECMAScript仕様輪読会 #54
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://github.com/tc39/agendas
https://github.com/tc39/notes
https://github.com/tc39/proposals が今まさに更新されている
Promise.try
自己紹介 (近況報告)
syumai syumai.icon
Twitter: https://twitter.com/__syumai GitHub: https://github.com/syumai
Go / TSを書いて暮らしてます
別チャンネルでライブしました
URL
https://zenn.dev/ubie_dev/articles/e720224828aa43
最近個人的にComlinkがアツい
Asakusa.go #2 と言うイベントをやります
tars0x9752 (たーず / naoki aoyama) tars0x9752.icon
https://github.com/tars0x9752
普段はTSを書いています
個人で管理してるドメインを更新したりなど
あんまり使ってないけど放棄するのもな~みたいな感じ
iwatsurut
とくに、イベントもなく過ごしています。
Kyoto.go オフラインLT会 参加申込しました。
ありがとうございます!yebis0942.icon
4/28@株式会社はてなさんの京都オフィスで開催です(connpass)
yebis0942 (えびす) yebis0942.icon
GoとReact
無料で使えるtkドメイン使ってましたがついにサービス終了の運びに
http://www.dot.tk/ja/index.html
esbuildの設定に詳しくなった
設定項目の名前がなかなか難しい
https://esbuild.github.io/api/#stdin
https://esbuild.github.io/api/#main-fields
ECMAScriptバンドル界の難しさを感じる
tomato3713 (とまと/ねことまと)tomato3713.icon
Go と Perl
https://twitter.com/tomato3713
https://tomato3713.hatenablog.com/
社内でGoのProposal読む会をしたり、OOC2024 staff やったり
仕様書の年度が2025になった
と思ったら2/17にコミットされてた
https://github.com/tc39/ecma262/commit/d502ea4acdde7e89a7e042dcc4e9123c6c75f476
前回のあらすじ
今回の範囲
https://tc39.es/ecma262/#sec-functiondeclarationinstantiation
formal parameters とは
https://tc39.es/ecma262/#prod-FunctionDeclaration
function BindingIdentifier ( FormalParameters) { FunctionBody }
関数定義の丸かっこの中身
FunctionDeclaration の場合は初期化される
FunctionExplanation の場合は
Formal parameters and functions are initialized as part of FunctionDeclarationInstantiation. All other bindings are initialized during evaluation of the function body.
Formal parameters and functions は FunctionDeclarationInstantiation 時に初期化されて、その他のバインディングは関数本体が評価される時に初期化されるってことっぽい?
関数はどこから生まれる?
Function constructor
https://tc39.es/ecma262/#sec-function-constructor
この中のCreateDynamicFunctionが本体っぽい
https://tc39.es/ecma262/#sec-createdynamicfunction
InstantiateFunctionObject
https://tc39.es/ecma262/#sec-runtime-semantics-instantiatefunctionobject
Syntax Directed Operation
構文解析中に見付かった関数宣言から、関数オブジェクトを作成する
strict がどこからくるか
body が IsStrict か
IsStrict: https://tc39.es/ecma262/#sec-isstrict
https://tc39.es/ecma262/#sec-strict-mode-code
syntactic unit とかいう新しいのがでてきた
ESMeta
仕様書のここを実行してますみたいなのが出てくるやつ
関数宣言の初期化とインスタンス化
インスタンス化は実際に関数が [[Call]] か [[Construct]] されたあと
tomato3713.icon BoundNames とは?
https://speakerdeck.com/syumai/how-to-read-ecmascript-spec?slide=28
4. Let formals be func.FormalParameters.
5. Let parameterNames be the BoundNames of formals.
Syntax-directive operation はパターンマッチ的に処理の仕方を分岐する
今回なら BoundNames of formals なのでマッチするものは formals
formal は FormalParameters なので https://tc39.es/ecma262/#prod-FormalParameters で処理される
ComputedPropertyKey が出てくるようなコードがどんなのものか
code:js
const o = {
key: "value",
};
function f({ "key": myKey }) {
console.log(myKey);
}
f(o); // value
Let がエイリアス宣言
Let A be B of C
→ CにマッチしたBを syntax-directed names で処理してAとして割り当てる
tomato3713.icon うろ覚え
opt がついてるのは or Empty みたいな意味
if文のconditionにdeclarationは書けるのか?
AssignmentExpressionは書けるが、declarationは書けない
code:js
if (var a = 1) {} // SyntaxError
TopLevelVarDeclaredNames
14まで読んだ