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
780
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
8.9k
JSON & Object Tips
brn
1
380
CA 1Day Youth Bootcamp for Frontend LT
brn
0
780
Modern TypeScript
brn
2
740
javascript - behind the scene
brn
3
680
プロダクト開発とTypeScript
brn
8
2.8k
React-Springでリッチなアニメーション
brn
1
590
javascript internationalization API
brn
0
780
Other Decks in Programming
See All in Programming
WEBエンジニア向けAI活用入門
sutetotanuki
0
300
現場で役立つモデリング 超入門
masuda220
PRO
12
2.9k
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
150
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
RailsのPull requestsのレビューの時に私が考えていること
yahonda
5
1.7k
Nuxtベースの「WXT」でChrome拡張を作成する | Vue Fes 2024 ランチセッション
moshi1121
1
510
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
210
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
200
Kotlin2でdataクラスの copyメソッドを禁止する/Data class copy function to have the same visibility as constructor
eichisanden
1
130
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
1.6k
Featured
See All Featured
Unsuck your backbone
ammeep
668
57k
For a Future-Friendly Web
brad_frost
175
9.4k
Speed Design
sergeychernyshev
24
570
Bash Introduction
62gerente
608
210k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Code Reviewing Like a Champion
maltzj
519
39k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Thoughts on Productivity
jonyablonski
67
4.3k
Become a Pro
speakerdeck
PRO
24
5k
The Language of Interfaces
destraynor
154
24k
Rails Girls Zürich Keynote
gr2m
93
13k
4 Signs Your Business is Dying
shpigford
180
21k
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ʹͳΓ·ͨ͠