Twitter hashtag: #esspec
便利ツール
自己紹介 (近況報告)
syumai
原稿が終わりました
Jun Yasumura / harupiyo Jun Yasumura.icon
Three.js少し練習
tars0x9752 (たーず / naoki aoyama) tars0x9752.icon
もう存在も忘れてたけど一年前くらいにだしてた temporal polyfill への PR がマージされた
↑ つながりで V8 のバグに遭遇した
noyannoyan.icon
休んでいる間、Jxckさん主催の勉強会に出てきたり、Web開発の基礎を勉強してました
実践node.js入門いい本ですね
前回のあらすじ
EnvironmentRecord のところよんでる
前回は Global Environment Records
今回の範囲
HasRestrictedGlobalProperty読み直し & NOTEを読むところから開始します!
HasRestrictedGlobalProperty
note: var や function の宣言ではなく直接 global object 上に直接プロパティが作られることがあるかもしれない。global な lexical binding は global object の non-configurable な同名のプロパティがある場合作ってはダメ
例 undefined など
code:js
// 以下は、ブラウザ上でのみ確認できた振る舞い
// OK
var undefined = 1; // VarDeclaredName の方なのでOK!
// NG
let undefined = 1; // LexicalDeclaredName の方なのでNG! (何故かNode.jsだとOK)
// NG
let a;
var a; // VarDeclarationがLexicalDeclarationをshadowできない
IsExtensible
code:js
d = 1;
console.log(globalThis.d); // 1
Object.preventExtensions(globalThis);
e = 1;
console.log(globalThis.e); // undefined
var f = 2; // Uncaught TypeError: Cannot add property f, object is not extensible
CanDeclareGlobalVar
GlobalVarBinding で Var Binding を作れるかどうか
globalObject が isExtensible じゃない場合以外、基本作れる
CanDeclareGlobalFunction
CanDeclareGlobalVarとほぼ同じだがこっちのほうが制約が多い
同名propがあった場合にDataDescriptorかどうかみてごにょごにょ
CreateGlobalVarBinding
Global Var Binding を作る
VarNames に名称を突っ込む
CreateGlobalFunctionBinding
Global Function Binding を作る
VarNames に名称を突っ込む
Module Environment Records
GetBindingValue, DeleteBinding, HasThisBinding and GetThisBinding
GetBindingValue
常にundefinedを返す
code:js
// "type": "commonjs"
console.log(this); // {}
// "type": "module"
console.log(this); // undefined
DeleteBinding
module は strict code なので使われない
HasThisBinding
常に true
GetThisBinding
常に undefined
CreateImportBinding
Module Record M が持つ N2 という束縛への間接的な binding N を作る
Environment Record Operations
さらっと流した
PrivateEnvironment Records
クラス宣言・クラス式のレキシカルなネスティング上で Pirvate Names のトラッキングをするのに使われる
OuterPrivateEnvironment
null か親の PrivateEnvironment
Names
このクラスによって宣言されたPrivateNames
気づき
CreateGlobalVarBinding または CreateGlobalFunctionBinding で binding が作られない限り、 VarNames には追加されなさそう。(var なしで宣言したら VarNames には入らなさそう)
PRチャンス?
GetThisBinding は Table 16 には入っていない
次回: 9.2.1.1 NewPrivateEnvironment をさらっとよんでついに 9.3 Realms