$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Swift5のOwnership
Search
8pockets
August 21, 2018
Programming
1
2k
Swift5のOwnership
8pockets
August 21, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
知られているようで知られていない JavaScriptの仕様 4選
syumai
0
640
Atomics APIを知る / Understanding Atomics API
ssssota
1
230
Java_プロセスのメモリ監視の落とし穴_NMT_で見抜けない_glibc_キャッシュ問題_.pdf
ntt_dsol_java
0
230
高単価案件で働くための心構え
nullnull
0
170
Evolving NEWT’s TypeScript Backend for the AI-Driven Era
xpromx
0
210
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
180
モビリティSaaSにおけるデータ利活用の発展
nealle
1
670
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
280
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
160
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
2
1k
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
4
1.5k
関数の挙動書き換える
takatofukui
4
750
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
56
14k
How to Ace a Technical Interview
jacobian
280
24k
Balancing Empowerment & Direction
lara
5
770
For a Future-Friendly Web
brad_frost
180
10k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
4 Signs Your Business is Dying
shpigford
186
22k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
680
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Documentation Writing (for coders)
carmenintech
76
5.1k
Navigating Team Friction
lara
190
16k
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