ECMAScript仕様輪読会 #83
前回: ECMAScript仕様輪読会 #82
Cosenseの招待リンク: https://scrapbox.io/projects/esspec/invitations/85b96c9fa718ce5185e307196ed8fb53
connpass: https://esspec.connpass.com/
Discord: https://discord.gg/59S3y6weQj
ES Spec Draft: https://tc39.es/ecma262/
multipage: https://tc39.es/ecma262/multipage/
資料: 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
esmeta playground: https://es-meta.github.io/playground/
時事ネタ
JSConf
8/31まで
https://docs.google.com/forms/d/e/1FAIpQLSf0QHajs3kQyax0zDX3W6KTFom7LqSqrIEmCp91tV_ccA9QWA/viewform
フロントエンドカンファレンス関西
自己紹介 (近況報告)
syumai syumai.icon
Twitter: https://twitter.com/__syumai GitHub: https://github.com/syumai
Go / TSを書いて暮らしてます
肘、リハビリ中
明後日、MCP関連で話します
https://rosca.connpass.com/event/359497/
来週、GoのCLIツール関連で話します
https://findy.connpass.com/event/362163/
iwatsurut
とくに、イベントもなく過ごしています。
仕事で、Go で Web システムを作ることになった。
igrep(山本悠滋)
https://github.com/igrep/
自作Clojure風言語 https://github.com/custard-lang/custard のREPLがようやく行をまたいだパースを実装したので、次はConjure https://github.com/Olical/conjure で呼べるようにしよう
前回のあらすじ
https://claude.ai/share/271b5393-bfc8-44e8-9154-7bbf346360ec
今回のメモ
code:js
function O() {}
const C1 = {
Symbol.hasInstance: (instance) => {
return true;
},
};
class C2 {
static Symbol.hasInstance(instance) {
return true;
}
}
function C3() {}
// C3Symbol.hasInstance = // writable: falseなので上書き不可能
Object.defineProperty(C3, Symbol.hasInstance, {
value(instance) {
return true;
},
});
class C4 {}
// C4Symbol.hasInstance = // writable: falseなので上書き不可能
Object.defineProperty(C4, Symbol.hasInstance, {
value(instance) {
return true;
},
});
const o = new O();
// 以下、true
console.log(o instanceof C1);
console.log(o instanceof C2);
console.log(o instanceof C3);
console.log(o instanceof C4);
code:js
Object.getOwnPropertyDescriptor(Function.prototype, Symbol.hasInstance).value.toString()
'function Symbol.hasInstance() { native code }'
Object.getOwnPropertyDescriptor(Function.prototype, Symbol.hasInstance).value.name
'Symbol.hasInstance'
code:js
Object.defineProperty(Array, Symbol.hasInstance, {
value(instance) {
return true;
},
});
console.log(1 instanceof Array); // true
console.log(Array.isArray(1)); // false
code:js
function C1() {}
function C2() {}
function C3() {}
C2.prototype = C1.prototype;
C3.prototype = C1.prototype;
C1.prototype.say = () => console.log("hello");
new C1().say();
new C2().say();
new C3().say();
code:js
const arrow = () => {};
console.log(arrow.prototype);
class C {
m() {}
async am() {}
*gm() {}
async *agm() {}
}
const c = new C();
console.log(c.m.prototype); // undefined
console.log(c.am.prototype); // undefined
console.log(c.gm.prototype); // Object Generator {}
console.log(c.agm.prototype); // Object AsyncGenerator {}
console.log(c.gm()); // Object Generator {}
console.log(c.agm()); // Object AsyncGenerator {}
code:js
Boolean.prototype // false
Boolean(Boolean.prototype); // true