Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
tc39 proposals
Search
Taketoshi Aono(青野健利 a.k.a brn)
October 09, 2019
Programming
0
800
tc39 proposals
tc39のproposals
throw expression
richer-keys
class-access-expression
Taketoshi Aono(青野健利 a.k.a brn)
October 09, 2019
Tweet
Share
More Decks by Taketoshi Aono(青野健利 a.k.a brn)
See All by Taketoshi Aono(青野健利 a.k.a brn)
document.write再考
brn
6
2.9k
Parsing Javascript
brn
12
9k
JSON & Object Tips
brn
1
410
CA 1Day Youth Bootcamp for Frontend LT
brn
0
820
Modern TypeScript
brn
2
750
javascript - behind the scene
brn
3
690
プロダクト開発とTypeScript
brn
8
2.8k
React-Springでリッチなアニメーション
brn
1
620
javascript internationalization API
brn
0
810
Other Decks in Programming
See All in Programming
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
Exploring: Partial and Independent Composables
blackbracken
0
100
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
190
ドメインイベント増えすぎ問題
h0r15h0
2
350
Security_for_introducing_eBPF
kentatada
0
110
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
390
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
140
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
260
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
130
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
137
6.7k
Thoughts on Productivity
jonyablonski
67
4.4k
GraphQLとの向き合い方2022年版
quramy
44
13k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
Facilitating Awesome Meetings
lara
50
6.1k
Done Done
chrislema
181
16k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
4 Signs Your Business is Dying
shpigford
181
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Transcript
tc39_study (throw_expressions) (Richer_Keys) (Class_Access_Expressions)
Name !CSO 5BLFUPTIJ"POP੨݈ར Occupation 'SPOUFOE%FWFMPQFS1SPEVDU0XOFS Company $ZCFSBHFOU"EUFDI4UVEJP"*.FTTFOHFS OSS $POUSJCVUPSPG7
About IUUQJOGPCODI
5ISPXFYQSFTTJPO
8IBUJTUISPXFYQSFTTJPO 5ISPXΛFYQSFTTJPO͔͠ॻ͚ͳ͍ॴͰॻ͚ΔΑ͏ʹͨ͠
function save(filename = throw new TypeError("Argument required")) { }
function getEncoder(encoding) { const encoder = encoding === "utf8" ?
new UTF8Encoder() : encoding === "utf16le" ? new UTF16Encoder(f alse) : encoding === "utf16be" ? new UTF16Encoder(t rue) : throw new Error("Unsupported encoding"); }
*NQMFNFOUBUJPO ࣮ੲ7ʹ࣮͠·ͨ͠ɻ݁ہ$-"CBOEPO͠·͕ͨ͠ɻ
1SPCMFN ࣮લఏͱͯ͠ 1SPQPTBMUP&YQMPSF&$."4DSJQU4UBUFNFOUTBT&YQSFTTJPOT IUUQTHJUIVCDPNSCVDLUPOQSPQPTBMTUBUFNFOUTBT FYQSFTTJPOTSFBENF ͱ͍͏ఏҊ͕TUBHFʹ͋ͬͨɻ TUBUFNFOUΛFYQSFTTJPOͱͯ͠औѻ͏͜ͱ͕Ͱ͖ΔΑ͏ʹ͢Δͱ͍͏ఏҊ
1SPCMFN ͨͩ͠ɺ&DNBTDSJQUʹ͓͚ΔTUBUFNFOUͱFYQSFTTJPOͷࠞಉ͕ ݴޠΛΑΓෳࡶʹͯ͠͠·͏ͷͰਐలͳ͘ UISPXFYQSFTTJPOʹؔͯ͠จ๏ͷՃʹରͯ͠ωΨςΟϒͳ͕݁ग़ͯ ͍ͯTUBHFʹਐΉ͜ͱͳͦ͞͏
%PFYQSFTTJPO ͦͯ͠ߋʹEPFYQSFTTJPOͱ͍͏QSPQPTBM͕ࠓճఏҊ͞Ε͍ͯΔશͯͷ TUBUFNFOUͱFYQSFTTJPOΛղܾͯ͠͠·͏ͷͰ ଟTUBHF͕ਐΉ͜ͱͳ͍͔͠Εͳ͍ɻ
function save(filename = do { throw new TypeError("Argument required”) })
{ } // σϑΥϧτύϥϝʔλͰͷdoࣜ·ͩະఆ
function getEncoder(encoding) { const encoder = encoding === "utf8" ?
new UTF8Encoder() : encoding === "utf16le" ? new UTF16Encoder(f alse) : encoding === "utf16be" ? new UTF16Encoder(t rue) : do { throw new Error("Unsupported encoding”); } }
1SPQPTBMSJDIFSLFZT
$PNQPTFEQSPQPTBM $PMMFDUJPO\UP,FZ UP7BMVF^ͱDPNQPTJUF,FZ DPNQPTJUF4ZNCPM ͷ̎ͭͷQSPQPTBMͷΈ߹Θͤ ͲͪΒΦϒδΣΫτͷࣝผʹ͍ͭͯ
$PMMFDUJPO\UP,FZ UP7BMVF^ $PMMFDUJPOʹUP,FZͱUP7BMVFΛՃ͢Δ
new Map([], { toKey(key) {return normalizedKey;}, toValue(value) {return normalizedValue;}, });
new WeakMap([], { toKey(key) {return normalizedKey;}, toValue(value) {return normalizedValue;}, }); new Set([], { toValue(value) {return normalizedValue;}, }); new WeakSet([], { toValue(value) {return normalizedValue;}, });
DPNQPTJUF,FZ DPNQPTJUF4ZNCPM ෳͷΦϒδΣΫτ͔ΒΩʔΛੜ͢Δ DPNQPTJUF,FZͱDPNQPTJUF4ZNCPM"1*ΛՃ͢Δ Ҿͷॱং͕ҧ͚Εҧ͏ΩʔͱͳΔ Ωʔʹར༻͞ΕͨΦϒδΣΫτ8FBL.BQͰཧ͞ΕΔͷͰΦϒδΣΫτ ͕ফ͑ΕϝϞϦ͔Βফ͑Δ
compositeKey(...parts: [...any]) : Object.freeze({__proto__:null}) compositeSymbol(...parts: [...any]) : Symbol()
const myValues = new Map(); const components = [a, b];
const myKey = compositeKey(...components); myValues.set(myKey, components); // ... let [a, b] = myValues.get(myKey);
4UBUVT UP,FZ͚ͩTUBHFʹͳΓ·ͨ͠ɻ UP7BMVF͕ඞཁ͔Ͳ͏͔͕TUBHFͰͷٞʹͳΓͦ͏
$MBTTBDDFTTFYQSFTTJPO
8IBUJTUIJT ΫϥεΦϒδΣΫτΞΫηε͢ΔҰ؏ͨ͠ํ๏Λఆٛ͢Δ
class C { static f() { ... } g() {
class.f(); } }
1SPCMFNTTPGBS TUBUJDͳΫϥεؔͷதͰUIJTΛͬͨ߹ɺؔͷݺͼग़͞ΕํʹΑͬͯ UIJT͕มΘΔ Ϋϥε໊Λͬͯ'PPCBSͱͨ͠߹ɺ'PPΛԿॻ͘ͷ%3:ʹͯ͠ ͍Δ UIJTDPOTUSVDUPS͔ΒࢀরͰ͖Δ͕ɺಉ͘͡UIJT͕TBGFͰͳ͍
%JTDVTT ࢀরํ๏͕૿͑Δͷ·͘͠ͳ͍ 'PPCBSͷΑ͏ʹΫϥε໊ͰΞΫηε͢Δͷ͕γϯϓϧͰΑ͍ %3:Λߟ͑ΔͱUIJTDPOTUSVDUPS͕ͩɺ҆શͰͳ͍ DMBTTCBSͰ͍͍͔͠Εͳ͍
4UBUVT 4UBHFʹͳΓ·ͨ͠