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

SE-XXXX Function Builders を読み解く / Reading the spec of Function Builders

SE-XXXX Function Builders を読み解く / Reading the spec of Function Builders

Kuniwak

July 08, 2019
Tweet

More Decks by Kuniwak

Other Decks in Programming

Transcript

  1. 4&9999

    'VODUJPO#VJMEFST

    ΛಡΈղ͘
    Kuniwak - DeNA Co.,Ltd.
    2019.07.08

    View full-size slide

  2. ,VOJXBL
    w ॴଐˠ
    • github.com/Kuniwak
    • qiita.com/Kuniwak
    w ߏจղੳ΍୯ମςετ͕޷෺
    w "QQ$PEF࢖͍
    3

    View full-size slide

  3. ࠓճ͓఻͍͑ͨ͜͠ͱ

    View full-size slide

  4. 4XJGU6*ͷཁૉٕज़Ͱ͋Δ

    'VODUJPO#VJMEFSTͷ

    ఏҊҙਤͱৄࡉΛֶͿ
    5

    View full-size slide

  5. 6
    @TupleBuilder
    func build() -> (Int, Int, Int) {
    1
    2
    3
    }
    func build() -> (Int, Int, Int) {
    let _a = 1
    let _b = 2
    let _c = 3
    return TupleBuilder.buildBlock(_a, _b, _c)
    }
    'VODUJPO#VJMEFST͸্ΛԼʹίϯύΠϥ͕มܗ͢Δ࢓༷ʢະ֬ఆʣ

    View full-size slide

  6. w ໦Ϧετߏ଄ͷߏஙΛॿ͚Δ%4-తͳݴޠػೳΛೖΕ͍ͨ
    w Ϣʔβʔ͕ఆٛͷͨΊͷ!GVODUJPO#VJMEFSΞϊςʔγϣϯ
    ͱGVODUJPOCVJMEFSܕΛೖΕ·͢
    w ίϯύΠϥ͕GVODUJPOCVJMEFSܕͷҾ਺ϒϩοΫ಺ͷ

    %4-ʢ4XJGUͷαϒηοτʣΛมܗͯ͠4XJGUݴޠ΁

    ຋༁ͯ͠ίϯύΠϧ͠·͢
    ·ͱΊɿ'VODUJPO#VJMEFSTͱ͸
    7

    View full-size slide

  7. ຖिਫ༵೔ʹࣾ಺Ͱ։࠵͞Ε͍ͯΔɺ

    4XJGU8FEOFTEBZͱ͍͏ษڧձͱ

    ಉ͡ܗࣜͰΏΔΏΔΈ͍͖ͯ·͢
    9

    View full-size slide

  8. 10
    4XJGU8FEOFTEBZൃͷ4XJGU΁ͷߩݙ

    View full-size slide

  9. Ͱ͸ݟ͍͖ͯ·͠ΐ͏

    View full-size slide

  10. https://forums.swift.org/t/important-
    evolution-discussion-of-the-new-dsl-
    feature-behind-swiftui/25168
    12
    TXJGUFWPMVUJPOͰͷެ։ͱಉ࣌ʹGPSVN΁QPTU͞ΕͨίϝϯτͰ͢ɻ

    View full-size slide

  11. https://github.com/apple/
    swift-evolution/pull/1046
    13
    TXJGUFWPMVUJPO্Ͱ࠷৽ͷ΋ͷΛѻ͍·͢ɻ΋͔ͨ͠͠Β

    GPSVNͰ͞Βʹٞ࿦͕ਐΜͰ͍Δ͔΋͠Ε·ͤΜ͕͝༰͍ࣻͩ͘͞ɻ

    View full-size slide

  12. https://docs.swift.org/swift-
    book/ReferenceManual/
    AboutTheLanguageReference.html
    14
    TUBUFNFOU΍FYQSFTTJPOΛ஌ΔͨΊͷࢿྉͰ͢ɻ

    View full-size slide

  13. w ໦Ϧετߏ଄ͷߏஙΛॿ͚Δ%4-తͳݴޠػೳΛೖΕ͍ͨ
    w Ϣʔβʔ͕ఆٛͷͨΊͷ!GVODUJPO#VJMEFS

    ΞϊςʔγϣϯͱGVODUJPOCVJMEFSܕΛೖΕ·͢
    w ίϯύΠϥ͕GVODUJPOCVJMEFSܕͷҾ਺ϒϩοΫ಺ͷ

    %4-ʢ4XJGUͷαϒηοτʣΛมܗͯ͠4XJGUݴޠ΁

    ຋༁ͯ͠ίϯύΠϧ͠·͢
    'VODUJPO#VJMEFSTͱ͸
    15

    View full-size slide