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
Swift5のOwnership
Search
8pockets
August 21, 2018
Programming
1
1.9k
Swift5のOwnership
8pockets
August 21, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
Better Code Design in PHP
afilina
PRO
0
130
RubyLSPのマルチバイト文字対応
notfounds
0
120
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
960
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Click-free releases & the making of a CLI app
oheyadam
2
120
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.5k
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Jakarta EE meets AI
ivargrimstad
0
600
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
Become a Pro
speakerdeck
PRO
25
5k
Unsuck your backbone
ammeep
668
57k
Building Applications with DynamoDB
mza
90
6.1k
Scaling GitHub
holman
458
140k
A Modern Web Designer's Workflow
chriscoyier
693
190k
We Have a Design System, Now What?
morganepeng
50
7.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Practical Orchestrator
shlominoach
186
10k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Site-Speed That Sticks
csswizardry
0
28
Transcript
Swift5ͷOwnership ΑΓࡉ͔͍ϝϞϦཧ
ࣗݾհ • ࢁᏴޗ @8pockets • Python, Go, PHP, Swift, C++
• swiftྺ
࣍ • Swift5ʹ͍ͭͯ • ݱঢ়ͷ՝ͱOwnershipಋೖͷཧ༝ • Ownershipͷ̏ͭͷػೳ
Swift5ʹ͍ͭͯ Early 2019 ϦϦʔε༧ఆ • ABI(Application Binary Interface)ͷ҆ఆԽ • ඪ४ϥΠϒϥϦʹඞཁͱͳΔδΣωϦΫε
• API resilience • Memory ownership model ࢀߟɿhttps://github.com/apple/swift-evolution
Ownershipಋೖͷཧ༝ $16ͷੑೳΛ׆͔͖͠Δ
ݱঢ়ͷ՝ • ࢀরΧϯτͱϢχʔΫੑͷݕࠪΦʔόʔϔου • ͍ͭͰΛίϐʔͰ͖Δঢ়ଶͩͱόοϑΝ͕Ұ ൠʹώʔϓ֬อ͞ΕΔɻελοΫ֬อʹ͢ΔͱΑ Γޮత SwiftͰCOWܕ͕͘ΘΕ͖ͯͨɻ͚Ͳ͍͘ Β͔ͷ͋Δɻ
ݱঢ়ͷ՝ •ίϐʔΦϯϥΠτ (Copy-On-Write) ίϐʔཁٻ͞ΕͯɺίϐʔΛͨ͠;ΓΛͯ͠ɺͱΓ ͋͑ͣݪຊΛͦͷ··ࢀর͢Δɺݪຊ·ͨίϐʔͷ ͲͪΒ͔Λॻ͖͑Α͏ͱͨ࣌͠ʹίϐʔ͕ى͜Δ ͜ΕʹΑͬͯ͋ΔఔͷύϑΥʔϚϯεͷΛΧόʔ ͍ͯͨ͠ɻ ΑΓߴͳνϡʔχϯάΛՄೳʹͨ͠ͷ͕Ownership
Ownershipಋೖͷཧ༝ ͜Ε·ͰϝϞϦίϐʔ͍ͯͨ͠໘ͰɺϦιʔεΛି͠ ͨΓआΓͨΓͰ͖ΔΑ͏ʹͳΓɺΑΓߴʹॲཧ͕ॻ͚ Δ ར༻έʔε • ԻॲཧͳͲͷϦΞϧλΠϜੑΛඞཁͱ͢Δॲཧ • αʔόʔαΠυSwift
Ownershipͷ̏ͭͷػೳ
Ownershipͷ̏ͭͷػೳ • ഉଞଇ - The Law of Exclusivity • shared
- Shared values • ίϐʔෆՄೳͳܕ - moveonly
ഉଞଇ • Swift4ͰϦϦʔεࡁ • ͋Δͷॻ͖ࠐΈΞΫηε͕ഉଞతͰ͋Δ ࣄΛڧ੍͢ΔɻͦͷଞͷΞΫηε͕ಉ࣌ʹੜ ͡ΔࣄΛېࢭ
ഉଞଇ ؔͷJOPVUҾʹมΛ͢ GVODGPP @UNQJOPVU4USJOH @UNQJOPVU4USJOH \^ WBSB4USJOHlUFTU GPP B B
ˠিಥ NVUBUJOHGVODͳϝιουΛݺͿ WBSY FYUFOTJPO*OU\ NVUBUJOHGVODBTTJHO3FTVMU0G @GVODUJPO *OU \ TFMGGVODUJPO ^ ^ YBTTJHO3FTVMU0G\Y ^ˠিಥ
shared GVODTBNQMF WBMVFTIBSFETUSJOH \ WBMVFมMFUͷΑ͏ʹѻΘΕΔɻ ^ ίϐʔ͕Ͱ͖ͳ͍ܕΛ࡞ΕΔΑ͏ʹͳΔ
shared ௨ৗͷҾ ؔΛݺͼग़͢ࡍʹ͕ίϐʔ͞ΕΔͨΊɺ ίετ͕͔͔Δ inoutࢀর ͦͷετϨʔδͷϙΠϯλΛ͚ͩ͢Ͱ͋Γɺ ͦͷΑ͏ͳίϐʔίετ͕͔͔Βͣߴ ॻ͖ࠐΈՄೳ sharedࢀর JOPVUͷಡΈऔΓઐ༻
ݺͼग़͠ଆʹΞϯύαϯυ Λ͚ͭΔඞཁ͕ͳ͍
ίϐʔෆՄೳͳܕ NPWFPOMZTUSVDU)PHF\^ WBSB)PHF B͔ΒCʹϦιʔεͷॴ༗ݖ͕Ҡಈ BࣗಈͰղ์͞ΕΔ WBSCNPWF B ίϯύΠϧΤϥʔ
QSJOU B ίϐʔ͕Ͱ͖ͳ͍ܕΛ࡞ΕΔΑ͏ʹͳΔ
ίϐʔෆՄೳͳܕ มശͰͳ͘ɺʹ͚ͭͨϥϕϧ WBSB)PHF WBSCNPWF B ॴ༗ऀ͕͍ͳ͘ͳͬͨϦιʔεࣗಈͰղ์͞ΕΔ
END