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
750
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.8k
Parsing Javascript
brn
12
8.6k
JSON & Object Tips
brn
1
360
CA 1Day Youth Bootcamp for Frontend LT
brn
0
750
Modern TypeScript
brn
2
720
javascript - behind the scene
brn
3
660
プロダクト開発とTypeScript
brn
8
2.8k
React-Springでリッチなアニメーション
brn
1
570
javascript internationalization API
brn
0
760
Other Decks in Programming
See All in Programming
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
250
Rubyのobject_id
qnighy
6
1.3k
マイグレーションコード自作して File-Based Routing に自動移行!! ~250 ページの歴史的経緯を添えて~
cut0
1
260
Go1.23で入った errorsパッケージの小さなアプデ
kuro_kurorrr
2
320
LangChainの現在とv0.3にむけて
os1ma
4
830
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
5
1.5k
Swift Concurrencyとレースコンディション
objectiveaudio
1
400
Jakarta EE meets AI
ivargrimstad
0
350
実践!難読化ガイド
mitchan
0
120
How to Break into Reading Open Source
kaspth
0
160
ドメイン駆動設計を実践するために必要なもの
bikisuke
3
330
Ruby Parser progress report 2024
yui_knk
2
220
Featured
See All Featured
BBQ
matthewcrist
83
9.1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
YesSQL, Process and Tooling at Scale
rocio
167
14k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
27
8.9k
The Mythical Team-Month
searls
218
43k
Why Our Code Smells
bkeepers
PRO
334
56k
Building Your Own Lightsaber
phodgson
101
6k
How to train your dragon (web standard)
notwaldorf
85
5.6k
Documentation Writing (for coders)
carmenintech
65
4.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
230
130k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
663
120k
Being A Developer After 40
akosma
83
590k
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ʹͳΓ·ͨ͠