Optional(2018)年...その後

 Optional(2018)年...その後

3f4e0340909015791f1712c52b116da7?s=128

Hideaki Tamai

July 26, 2018
Tweet

Transcript

  1. 0QUJPOBM  ೥ ͦͷޙ )JEFBLJ5BNBJ 1PUBUPUJQT+VMZ 

  2. ࣗݾ঺հ )JEFBLJ5BNBJ ɾ.POFZ'PSXBSE *OD ɾJ04ΞϓϦΤϯδχΞ ɾ͘͘͢͢ʂࢠҭͯΤϯδχΞ.FFUVQ UBNBEPO !UBNBEPO

  3. IUUQTNPOFZGPSXBSEDPNFOHJOFFST@CMPHPQUJPOBM 0QUJPOBM  ೥͚͋·͓ͯ͠ΊͰͱ͏͍͟͝·͢

  4. ͜ΕΛػʹXBSOJOHΛ๾໓͢΂͘ ౰ࣾJ04ΤϯδχΞ͕ ෦ॺΛӽ͑ͯऔΓ૊Έ·ͨ͠ ௨ৗͷػೳ։ൃͱฒߦͯ͠໿ϲ݄

  5. Before

  6. ΍ͬͨ͜ͱͦͷ̍ 4XJGU-JOU "VUPDPSSFDU

  7. Πϯσϯτͷௐ੔͚͔ͩͱࢥͬͯͨΒɺ ؆୯ͳwarning͸मਖ਼ͯ͘͠Εͨ func validate(_ input :(hoge: Fuga)) throws -> Void

    { func validate(_ input :(hoge: Fuga)) throws {
  8. None
  9. ΍ͬͨ͜ͱͦͷ̎ γϡοͱ௚ͤͦ͏ͳXBSOJOHΛফ͢

  10. - public final class Hoge: Fuga { + public class

    Hoge: Fuga { - network.request(request) { _ in } + _ = network.request(request) { _ in } ྫʣ͜͏͍͏΍ͭ
  11. None
  12. ͋ͱ͸ͪͪ͘͘஍ಓʹ XBSOJOHΛͭͿ͍ͯͬͨ͠

  13. ਏ͔ͬͨ΍ͭ

  14. Ұ෦ͷϥΠϒϥϦ͕$PDPB1PET ܦ༝͡Όͳ͍ํ๏Ͱಋೖͯ͋͠Δ ʢେ൒͸$PDPB1PETܦ༝ʣ wͲͷόʔδϣϯΛ࢖ͬͯΔ͔෼͔Βͳ͍ͷͰ࠷৽ʹΞο ϓσʔτͨ࣌͠ͷӨڹൣғ͕ݟ͑ͣɺΞοϓσʔτ͠ ͯྑ͍ͷ͔ෆ໌ w͔͠΋Ұ෦ಠ࣮ࣗ૷Λ௥Ճͯ͠࢖ͬͯΔ΍ͭ΋͋Δ

  15. ಠ࣮ࣗ૷Λ௥Ճͯ͠ͳ͍ ϥΠϒϥϦ wϥΠϒϥϦͷόʔδϣϯΛίϛοτϩά͔Βਪଌ ͠ӨڹൣғΛௐࠪ w$PDPB1PETʹҠߦ

  16. ಠ࣮ࣗ૷Λ௥Ճͯ͠Δ ϥΠϒϥϦ w൚༻తͳػೳ௥ՃͩͬͨͷͰɺϥΠϒϥϦΛGPSL͠ ͯຊՈʹQVMMSFRVFTUΛग़ͨ͠ wऔΓࠐ·Εͳ͔ͬͨϥΠϒϥϦ͸GPSLFESFQPTJUPSZ ͷϥΠϒϥϦΛ$PDPB1PETͰΠϯετʔϧ

  17. After

  18. Before

  19. After Ϗϧυʹ͔͔Δ͕࣌ؒϝνϟ୹ॖ͞Εͨ XBSOJOH࡟আ͚ͩͰͳ͘ɺ4XJGUରԠ΍ ίϯύΠϧΦϓγϣϯͷมߋ΋ޮՌ͕͋ͬͨͱࢥΘΕΔ

  20. ࠷ޙͷXBSOJOH ՝ۚͷϨγʔτ͕J04ܗࣜ ˠݱࡏରԠத

  21. XBSOJOHΛ૿΍͞ͳ͍ औΓ૊Έ

  22. Ұྫ ɾϏϧυ࣌ʹ4XJGU-JOU"VUPDPSSFDU࣮ߦ ɾϏϧυʹNTҎ্͔͔͍ͬͯΔॲཧͰXBSOJOH ɾ4JEFSʢNJTTQFMMʣಋೖ ɾ%BOHFSಋೖ

  23. ·ͱΊ w ݹ͔͘Βӡ༻͞Ε͍ͯΔϓϩμΫτͰ΋ؤுͬͯऔΓ૊Ί͹ɺXBSOJOHΛ ΄΅̌ʹग़དྷΔ w Ϗϧυ୹ॖͷऔΓ૊Έ΋ग़དྷͯϏϧυ͕࣌ؒ෼෼·Ͱ୹ॖग़དྷͨ w ෦ॺΛ·͍ͨͰXBSOJOH๾໓ʹऔΓ૊ΜͩͷͰɺࣾ಺ͷJ04ΤϯδχΞ಺Ͱ XBSOJOH΍ϦϑΝΫλϦϯάʹର͢Δҙ͕ࣝߴ·ͬͨ w

    XBSOJOHΛݮΒͯ͠ຬ଍͢ΔͷͰ͸ͳ͘ɺ૿΍͞ͳ͍࢓૊Έͷߏங͕େࣄ
  24. ͝ਗ਼ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠