ECMAScript仕様輪読会 #65
前回: ECMAScript仕様輪読会 #64
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/
資料: https://speakerdeck.com/syumai/ecmascriptshi-yang-wodu-munonibi-yao-nazhi-shi-daiziesutoban
読み物リスト
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
時事ネタ
自己紹介 (近況報告)
syumai syumai.icon
Twitter: https://twitter.com/__syumai GitHub: https://github.com/syumai
Go / TSを書いて暮らしてます
先週、Goのイテレータについての発表をしました
利用者視点で考える、イテレータとの上手な付き合い方
引き続き、原稿に苦しんでいます
JSConfJPにプロポーザル出しました
iwatsurut
とくに、イベントもなく過ごしています。
先週の Go のイテレータの勉強会見ました。
YAMAMOTO Yuji
初参加
求職中です https://the.igreque.info/posts/2024/04-iij-unknown
だいたいのプロフィールは https://github.com/igrep/ に書いてます
iPad Proのディスプレイが壊れたので直したら、純正パーツじゃなかったためか音ゲーがめっちゃプレイしづらくなってしまって辛い
JSConfJPにプロポーザル出しました
yebis0942
数回ぶりの参加です
GoとTypeScriptを書いています
TSKaigi Kansaiにプロポーザル出せませんでした
JSConfJPにプロポーザル出しました
書いてて良かった自社テックブログ
前回のあらすじ
今回は長いので略
今回の範囲
16 ECMAScript Language: Scripts and Modules の 16.1.7 GlobalDeclarationInstantiation の step: 9 から
NOTE2
LexicallyDeclaredNames
var以外の変数宣言全部
global objectがProxyで定義されている場合
hostによってはそういうこともあるのだろう
?がついている呼び出しはabruptになりうる
Proxyを使うと本来は内部的な操作であるはずのものに任意の処理を差し込める
If this occurs, the code for the Script is not evaluated.
宣言に問題があると評価すら行われない
more than one Script
HTMLで一つのdocumentに複数の<script>タグがある場合
name conflicts between function/var declarations and let/const/class declarations
これが再現できず
yebis0942.iconメモ
16.1.1
It is a Syntax Error if any element of the LexicallyDeclaredNames of ScriptBody also occurs in the VarDeclaredNames of ScriptBody.
この定義によると、letとvarがかぶるとSyntax Errorっぽい
つまりこんなやつでは?
Single Script版
code:js
console.log("before var");
var a;
console.log("after var");
console.log("before let");
let a;
console.log("after let");
code:output
Uncaught SyntaxError: redeclaration of var a
More than one Script版
code:html
<html>
<script>
console.log("before var");
var a;
console.log("after var");
</script>
<script>
console.log("before let");
let a;
console.log("after let");
</script>
</html>
code:console
before var
after var
Uncaught SyntaxError: redeclaration of var a
// 2番目のscriptタグの評価前にSyntax Errorで終了している
CommonJSで複数のファイルをrequireした場合
Node.jsでは隔離されていそう
[+default]の文法的パラメーターの用途
たとえばこのあたり https://tc39.es/ecma262/#sec-class-definitions
export defaultの場合は名前を付けずに済ませられるようになる
code:js
class A {}; // OK
class {}; // Syntax Error
export default class A {}; // OK
export default class {}; // OK
export defaultは何でも受け付ける説
code:js
let a = 1;
export default a = 2; // OK
ModuleExportNameにStringLiteralが許されるようになった理由
Wasm対応のため
export {};を許容しているのはなぜか?
自動生成の便宜のため?
あえて禁止する理由もないため?