Slide 1

Slide 1 text

S_Shimotori 1ਓͰ௅ΉSwiftίϯύΠϥ ʙܕγεςϜೖ໳ฤʙ iOSDC Japan 2024

Slide 2

Slide 2 text

2 ΈΜͳ೉͍͜͠ͱΛ࿩ͯͯ͠
 ͍͍͚ͭͯͳ͍……ʂʂ

Slide 3

Slide 3 text

3

Slide 4

Slide 4 text

4 omochimetaru. Swiftͷܕਪ࿦Λֶ΅͏. 2024, 3.

Slide 5

Slide 5 text

͓΋ͪ͞ΜϚδײँ😭 • Θ͔Γ΍͔ͬͨ͢ʂ • ίϯύΠϥ΍ܕਪ࿦ͷΘ͔Γ΍͍͢ࢿྉ͸Ϛδوॏ 5

Slide 6

Slide 6 text

6 ϚδΘ͔Γ΍͔ͬͨ͢οεʂ 2019೥ͷ߹॓ͷ ϋϯζΦϯ͕ݩωλͩΑ ϋϯζΦϯʂʁ ਌੾͗͢ΔͷͰ͸ʁʁ

Slide 7

Slide 7 text

7 https://github.com/omochi/SwiftTypeInferenceHandsOn

Slide 8

Slide 8 text

SwiftTypeInferenceHandsOnͷ͓୊ • ஬৯͍ঢ়ଶͷͱ͜ΖΛࣗ෼Ͱ࣮૷͠ɺશςετΛύεͰ͖ͨΒΫϦΞ 8 ʙʙதུʙʙ

Slide 9

Slide 9 text

ςετ͸͜Μͳײ͡ • ྫɿlet a = 3ͷܕਪ࿦͕͏·͍͔͘͘ͷςετ 9 Intܕͱਪ࿦Ͱ͖ͨΒOKʂ

Slide 10

Slide 10 text

ͪΐͬͱݹ͍͚Ͳޓ׵ੑ͋Δ͔Βฏؾ ❤︎ 10

Slide 11

Slide 11 text

🤔🤔🤔🤔🤔 11

Slide 12

Slide 12 text

_InternalSwiftSyntaxParser 12

Slide 13

Slide 13 text

2019೥ 13 Swift 5.1 Internal Swift Syntax Parser swift-syntax (2019) SwiftTypeInferenceHandsOn

Slide 14

Slide 14 text

2024೥ 14 Swift 5.1 Internal Swift Syntax Parser swift-syntax (2019) SwiftTypeInferenceHandsOn Swift 5.10 ❌

Slide 15

Slide 15 text

ʲֶͼᶃʳޓ׵ੑ͕ͳ͍͜ͱ΋͋Δ • 2019೥ • swift-syntax͕ίϯύΠϥಉࠝͷInternal Swift Syntax Parserʹґଘ͍ͯͨ͠ • 2024೥ • ίϯύΠϥ͔ΒISSP͕औΓআ͔Ε͍ͯΔ 15 5೥લͷswift-syntaxͱ࠷৽ͷίϯύΠϥͷ૊Έ߹ΘͤͰ͸࢖͑ͳ͍

Slide 16

Slide 16 text

࠷৽ͷSwiftSyntaxʹରԠͤ͞·ͨ͠ 16 👈 ௚ͨ͠ʂ

Slide 17

Slide 17 text

͔͜͜Β͕ຊ൪ʂ 17 ໨ࢦͤʂ

Slide 18

Slide 18 text

ಓͷΓ͸௕͘ݥ͍͠ • ϝιουͷ੹຿ͷൣғ͕Θ͔Βͳ͍ɺͲ͜·Ͱ࣮૷ͨ͠Β͍͍͔Θ͔Βͳ͍ 18 ʙʙதུʙʙ

Slide 19

Slide 19 text

ίϯύΠϥͷ࣮૷͸ظ଴݁Ռ͕໌Β͔ʂ • ࣮૷͢΂͖ॲཧ΍ظ଴݁Ռ͸໌Β͔Ͱ͋Γɺૉ௚ʹͦΕΛ࣮૷͢Ε͹OK • ϢʔβΠϯλʔϑΣʔε౳ʹ͋Γ͕ͪͳᐆດͳ;Δ·͍͸ͳ͍ 19

Slide 20

Slide 20 text

ίϯύΠϥͷ࣮૷͸ظ଴݁Ռ͕໌Β͔ʂ • ࣮૷͢΂͖ॲཧ΍ظ଴݁Ռ͸໌Β͔Ͱ͋Γɺૉ௚ʹͦΕΛ࣮૷͢Ε͹OK • ϢʔβΠϯλʔϑΣʔε౳ʹ͋Γ͕ͪͳᐆດͳ;Δ·͍͸ͳ͍ 20 ζόϦॻ͍ͯ͋ΔΘ͚Ͱ͸ͳ͍ ૉਓ͕ϊʔώϯτͰ೺Ѳ͢Δͷ͸೉͍͠ ͩͬͨΒ࣮ػ΍Debug View Hierarchy͔ΒḷΕͨͷʹ

Slide 21

Slide 21 text

ʲֶͼᶄʳ࣮૷ͷղઆΛฉ͖ಀ͢ͳ • ॳ৺ऀ͕ϊʔώϯτͰҰ໨Ͱ෼͔ΔΑ͏ʹ͸࣮૷͞Ε͍ͯͳ͍…ʂ • ಡΈ΍͍͢ՕॴΛ୳͢ͷ΋Ұۤ࿑ 21

Slide 22

Slide 22 text

22 Ͱ͖ͨ🎉🎉 ʢͪΐͬͱؒҧ͚ͬͯͨͲʣ

Slide 23

Slide 23 text

ࣗ෼ͰίϝϯτΛॻ͖଍͠ͳ͕Βղ͍ͨ 23 ※ωλόϨ๷ࢭͷͨΊ෬͍ͤͯ·͢

Slide 24

Slide 24 text

ॴײʢ੍ݶ࣌ؒͷ؍఺ʣ • ςετ͸͢΂ͯύεͰ͖͕ͨɺ͚ͬ͜͏͕͔͔࣌ؒͬͨ • ϚΠϖʔεʹ೰Μͩͷ΋͋Γΰʔϧσϯ΢ΟʔΫΛফඅͨ͠ • ΋͠1ധ2೔ͷ߹॓Ͱ௅ઓ͍ͯͨ͠ΒΫϦΞͰ͖ͯͳ͔ͬͨ😢 24

Slide 25

Slide 25 text

ॴײʢ೉қ౓ͷ؍఺ʣ • ࣗྗͰશ෦ղ͚ͨ🎉ɹҰ෦ؒҧ͚ͬͯͨͲ • ղ౴ͱ௚઀ؔ܎ͷͳ͍ॴʹ͍͚ͭͯͩͰ΋୭͔ͱٞ࿦Ͱ͖ͨΒΑ͔͔ͬͨ΋ • ASTͷϊʔυ΍visitorύλʔϯͳͲ΋ݟͲ͜Ζ 25

Slide 26

Slide 26 text

ʲֶͼᶅʳஸ౓͍͍՝୊Λιϩ߈ུ͢Δ • ஸ౓͍͍೉қ౓ͷ՝୊͕ݟ͚ͭΒΕΔͱલ޲͖ʹͳΕΔɺָ͍͠ • ͬ͘͡Γιϩ߈ུͷ࣌ؒΛ࣋ͭͷ΋˕ 26

Slide 27

Slide 27 text

·ͱΊ • ؾʹͳΔൃද͸ࢀߟจݙ΋೷͍ͯΈΔ • ࢥ͍੾ͬͯ௅ઓ͢Δͱ૝૾Ҏ্ͷֶͼ͕ಘΒΕΔ • ҰॹʹϋϯζΦϯʹ௅ઓͯ͠೰ΜͰσΟεΧογϣϯ͠Α͏ͥʂ 27

Slide 28

Slide 28 text

Special Thanks🙇 • ͓΋ͪϝλϧ͞Μ 28

Slide 29

Slide 29 text

S_Shimotoriʹ͍ͭͯ • X: S_Shimotori_pub • GitHub: S-Shimotori • ੜଉ஍: ࣗ୐ɺͨ·ʹ౦ژΨʔσϯςϥεلඌҪொ 29

Slide 30

Slide 30 text

͓·͚

Slide 31

Slide 31 text

ࢀߟจݙ • Swiftͷܕਪ࿦Λֶ΅͏ | Let's Learn About Type Inference in Swift - Speaker Deck • https://speakerdeck.com/omochi/lets-learn-about-type-inference-in-swift • omochi/SwiftTypeInferenceHandsOn: Swiftc߹॓ 2019/09/28 • https://github.com/omochi/SwiftTypeInferenceHandsOn • Θ͍Θ͍swiftc։ൃ߹॓ at ౬Տݪ ͓Μ΍Ͳܙʙܕਪ࿦ΞϧΰϦζϜΛֶͿʛsonson • https://note.com/sonson/n/n406f129fc993 31

Slide 32

Slide 32 text

ࢀߟจݙ • swift-syntax/Changelog.md at main · swiftlang/swift-syntax • https://github.com/swiftlang/swift-syntax/blob/main/Changelog.md • Quick Overview of SwiftParser • https://speakerdeck.com/kitasuke/quick-overview-of-swiftparser • 32

Slide 33

Slide 33 text

ૉࡐ • ;͖ͩ͠ૉࡐઐ໳αΠτʮϑΩμγσβΠϯʯ – ϑΩμγૉࡐ͕1000Ҏ্ू·ΔαΠτ • https://fukidesign.com/ 33