ECMAScript仕様輪読会 #54
前回: ECMAScript仕様輪読会 #53
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/notes/pull/314/files
自己紹介 (近況報告)
syumai syumai.icon
Twitter: https://twitter.com/__syumai GitHub: https://github.com/syumai
Go / TSを書いて暮らしてます
Meguro.esで何か話したい
https://meguroes.connpass.com/event/311788/
tars0x9752 (たーず / naoki aoyama) tars0x9752.icon
特になし
iwatsurut
とくに、イベントもなく過ごしています。
yebis0942 (えびす) yebis0942.icon
GoとReact
Kyoto.go オフラインLT会
https://kyotogo.connpass.com/event/313309/
前回のあらすじ
今回の範囲
15.2.2 Static Semantics: FunctionBodyContainsUseStrict
code:js
const f = function () {
"use hoge";
"fuga";
'use strict';
"fugafuga";
with ({}) {
}
};
// SyntaxError: Strict mode code may not include a with statement
10.2.11 FunctionDeclarationInstantiation
direct eval or indirect eval
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#direct_and_indirect_eval
20. Else,
a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
code:js
// このケースを言ってそう (bindings created by direct eval calls in the formal parameter list)
const f = function (a, b = eval("var c = 2; 1")) {
console.log(a, b, c);
};
f(); // undefined 1 2
// 別の例
const f = function (
a,
b = eval("var c = 2; console.log(c); 1"),
c = 3,
) {
console.log(a, b, c);
};
f();
/*
var c = 2; console.log(c); 1
^
SyntaxError: Identifier 'c' has already been declared
*/
code:js
(function () {
const f = function (a, b, c = 1) {
console.log(c); // 1 (ただし、次の行の変数cを、パラメータcの初期値によって初期化した値)
var c = 5;
console.log(c); // 5
};
f();
})();