Upgrade to Pro — share decks privately, control downloads, hide ads and more …

tc39 proposals

tc39 proposals

tc39のproposals
throw expression
richer-keys
class-access-expression

More Decks by Taketoshi Aono(青野健利 a.k.a brn)

Other Decks in Programming

Transcript

  1. tc39_study
    (throw_expressions)
    (Richer_Keys)
    (Class_Access_Expressions)

    View full-size slide

  2. Name
    !CSO 5BLFUPTIJ"POP੨໺݈ར

    Occupation
    'SPOUFOE%FWFMPQFS1SPEVDU0XOFS
    Company
    $ZCFSBHFOU"EUFDI4UVEJP"*.FTTFOHFS
    OSS
    $POUSJCVUPSPG7
    About
    IUUQJOGPCODI

    View full-size slide

  3. 5ISPXFYQSFTTJPO

    View full-size slide

  4. 8IBUJTUISPXFYQSFTTJPO
    5ISPXΛFYQSFTTJPO͔͠ॻ͚ͳ͍৔ॴͰ΋ॻ͚ΔΑ͏ʹͨ͠

    View full-size slide

  5. function save(filename = throw new TypeError("Argument required")) {
    }

    View full-size slide

  6. 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");
    }

    View full-size slide

  7. *NQMFNFOUBUJPO
    ࣮͸ੲ7ʹ࣮૷͠·ͨ͠ɻ݁ہ$-͸"CBOEPO͠·͕ͨ͠ɻ

    View full-size slide

  8. 1SPCMFN
    ࣮͸લఏͱͯ͠
    1SPQPTBMUP&YQMPSF&$."4DSJQU4UBUFNFOUTBT&YQSFTTJPOT
    IUUQTHJUIVCDPNSCVDLUPOQSPQPTBMTUBUFNFOUTBT
    FYQSFTTJPOTSFBENF
    ͱ͍͏ఏҊ͕TUBHFʹ͋ͬͨɻ
    TUBUFNFOUΛFYQSFTTJPOͱͯ͠औѻ͏͜ͱ͕Ͱ͖ΔΑ͏ʹ͢Δͱ͍͏ఏҊ

    View full-size slide

  9. 1SPCMFN
    ͨͩ͠ɺ&DNBTDSJQUʹ͓͚ΔTUBUFNFOUͱFYQSFTTJPOͷࠞಉ͕
    ݴޠΛΑΓෳࡶʹͯ͠͠·͏ͷͰਐల͸ͳ͘
    UISPXFYQSFTTJPOʹؔͯ͠΋จ๏ͷ௥Ճʹରͯ͠ωΨςΟϒͳ݁࿦͕ग़ͯ
    ͍ͯTUBHFʹਐΉ͜ͱ͸ͳͦ͞͏

    View full-size slide

  10. %PFYQSFTTJPO
    ͦͯ͠ߋʹEPFYQSFTTJPOͱ͍͏QSPQPTBM͕ࠓճఏҊ͞Ε͍ͯΔશͯͷ
    TUBUFNFOUͱFYQSFTTJPO໰୊Λղܾͯ͠͠·͏ͷͰ
    ଟ෼TUBHF͕ਐΉ͜ͱ͸ͳ͍͔΋͠Εͳ͍ɻ

    View full-size slide

  11. function save(filename = do { throw new TypeError("Argument required”) }) {
    }
    // σϑΥϧτύϥϝʔλͰͷdoࣜ͸·ͩະఆ

    View full-size slide

  12. 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”); }
    }

    View full-size slide

  13. 1SPQPTBMSJDIFSLFZT

    View full-size slide

  14. $PNQPTFEQSPQPTBM
    $PMMFDUJPO\UP,FZ UP7BMVF^ͱDPNQPTJUF,FZ DPNQPTJUF4ZNCPM
    ͷ̎ͭͷQSPQPTBMͷ૊Έ߹Θͤ
    ͲͪΒ΋ΦϒδΣΫτͷࣝผʹ͍ͭͯ

    View full-size slide

  15. $PMMFDUJPO\UP,FZ UP7BMVF^
    $PMMFDUJPOʹUP,FZͱUP7BMVFΛ௥Ճ͢Δ

    View full-size slide

  16. 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;},
    });

    View full-size slide

  17. DPNQPTJUF,FZ DPNQPTJUF4ZNCPM
    ෳ਺ͷΦϒδΣΫτ͔ΒΩʔΛੜ੒͢Δ
    DPNQPTJUF,FZͱDPNQPTJUF4ZNCPM"1*Λ௥Ճ͢Δ
    Ҿ਺ͷॱং͕ҧ͚Ε͹ҧ͏ΩʔͱͳΔ
    Ωʔʹར༻͞ΕͨΦϒδΣΫτ͸8FBL.BQͰ؅ཧ͞ΕΔͷͰΦϒδΣΫτ
    ͕ফ͑Ε͹ϝϞϦ͔Β΋ফ͑Δ

    View full-size slide

  18. compositeKey(...parts: [...any]) : Object.freeze({__proto__:null})
    compositeSymbol(...parts: [...any]) : Symbol()

    View full-size slide

  19. const myValues = new Map();
    const components = [a, b];
    const myKey = compositeKey(...components);
    myValues.set(myKey, components);
    // ...
    let [a, b] = myValues.get(myKey);

    View full-size slide

  20. 4UBUVT
    UP,FZ͚ͩTUBHFʹͳΓ·ͨ͠ɻ
    UP7BMVF͕ඞཁ͔Ͳ͏͔͕TUBHFͰͷٞ࿦ʹͳΓͦ͏

    View full-size slide

  21. $MBTTBDDFTTFYQSFTTJPO

    View full-size slide

  22. 8IBUJTUIJT
    ΫϥεΦϒδΣΫτ΁ΞΫηε͢ΔҰ؏ͨ͠ํ๏Λఆٛ͢Δ

    View full-size slide

  23. class C {
    static f() { ... }
    g() {
    class.f();
    }
    }

    View full-size slide

  24. 1SPCMFNTTPGBS
    TUBUJDͳΫϥεؔ਺ͷதͰUIJTΛ࢖ͬͨ৔߹ɺؔ਺ͷݺͼग़͞ΕํʹΑͬͯ
    UIJT͕มΘΔ
    Ϋϥε໊Λ࢖ͬͯ'PPCBSͱͨ͠৔߹ɺ'PPΛԿ౓΋ॻ͘ͷ͸%3:ʹ൓ͯ͠
    ͍Δ
    UIJTDPOTUSVDUPS͔ΒࢀরͰ͖Δ͕ɺಉ͘͡UIJT͕TBGFͰ͸ͳ͍

    View full-size slide

  25. %JTDVTT
    ࢀরํ๏͕૿͑Δͷ͸޷·͘͠ͳ͍
    'PPCBSͷΑ͏ʹΫϥε໊ͰΞΫηε͢Δͷ͕γϯϓϧͰΑ͍
    %3:Λߟ͑ΔͱUIJTDPOTUSVDUPS͕ͩɺ҆શͰ͸ͳ͍
    DMBTTCBSͰ΋͍͍͔΋͠Εͳ͍

    View full-size slide

  26. 4UBUVT
    4UBHFʹͳΓ·ͨ͠

    View full-size slide