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
Context Receiversに思いを馳せる / Context Receivers
Search
uzzu
October 05, 2022
Technology
0
590
Context Receiversに思いを馳せる / Context Receivers
DroidKaigi2022 Dialogs - 2022/10/05 14:20-14:45
https://droidkaigi.jp/2022/timetable/363729
uzzu
October 05, 2022
Tweet
Share
More Decks by uzzu
See All by uzzu
StoreKitのこれまでとこれから / StoreKit 2 from 1
uzzu
5
11k
Autofill Framework
uzzu
0
90
アプリ内課金の最新事情 クライアントサイド編 / In-app Purchase in Cookpad 2019
uzzu
3
4.3k
Billing Client 2.0 acknowledgement
uzzu
0
16k
Promoting IAP対応から学ぶ外部アプリ内課金実装 / Promoting IAP and others
uzzu
2
1.3k
ブログ作り直した / My blog @ Othlo Tech
uzzu
0
120
新規アプリ開発を支えるユーザ・決済基盤
uzzu
2
2.6k
kotlin-mpp-library-tips
uzzu
1
6.2k
Coroutine Kyuin
uzzu
2
270
Other Decks in Technology
See All in Technology
AGIについてChatGPTに聞いてみた
blueb
0
130
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.2k
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
170
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
180
Platform Engineering for Software Developers and Architects
syntasso
1
510
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
SSMRunbook作成の勘所_20241120
koichiotomo
2
130
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
136
6.6k
Docker and Python
trallard
40
3.1k
Adopting Sorbet at Scale
ufuk
73
9.1k
We Have a Design System, Now What?
morganepeng
50
7.2k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
What's new in Ruby 2.0
geeforr
343
31k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Transcript
Context Receiversʹ ࢥ͍ΛͤΔ uzzu @ 2022/10/05 DroidKaigi 2022 DAY.01
Cluster, Inc. All Rights Reserved. 2 ҙ 2022/09࣌Ͱͷ ใΛݩʹൃද͓ͯ͠Γ·͢ ࢥ͍ΛͤΔ༰ͳͷͰओ؍ؚ·Ε͓ͯΓ·͢
Context Receiversݱࡏprototypeஈ֊Ͱ͢ ྃ͝ঝ͍ͩ͘͞
Cluster, Inc. All Rights Reserved. 3 ࣗݾհ @uzzu Cluster, Inc.
ιϑτΣΞΤϯδχΞ झຯ: VR, ࡶଟͳٕज़ݕূ, ಡॻ, DTM, ֨ήʔ, εϓϥ
Cluster, Inc. All Rights Reserved. 4 ClusterͷAndroidΞϓϦʹ͍ͭͯ AndroidΞϓϦ ࠾༻ใ AndroidΞϓϦΤϯδχΞืू
⬆ inroom (Unity as a Library) ⬅︎ outroom (Native App)ɹɹɹ
Cluster, Inc. All Rights Reserved. 5 ΞδΣϯμ ɾContext Receivers͕དྷΔ·Ͱͷ͓͞Β͍ ɾContext
Receiversͱɺ༻ྫ ɾContext Receiversͷ՝ɺࢥ͍ ɾ·ͱΊ
Cluster, Inc. All Rights Reserved. 6 ContextReceivers͕དྷΔ·Ͱͷ͓͞Β͍ KEEP(https://github.com/Kotlin/KEEP) YouTrack(https://youtrack.jetbrains.com/) Kotlin
Slack(https://kotlinlang.slack.com/) ͍͔ͭ͋͘Δ͕ͦͷதͰ2ͭͷissueΛൈਮ
Cluster, Inc. All Rights Reserved. 7 Compile-time Extension Interfaces https://github.com/Kotlin/KEEP/pull/87
2017/10ࠒ ɾ࠷ॳظʮType Classesʯͱ͍͏λΠτϧͰproposal͕ॻ͔Ε͍ͯͨ ɾʮ͍ͭʹKotlinʹܕΫϥε͕དྷΔ…?!ʯͱ͍͏ࣄͰք۾Γ্͕Δ
Cluster, Inc. All Rights Reserved. 8 Compile-time Extension Interfaces https://github.com/Kotlin/KEEP/pull/87
Cluster, Inc. All Rights Reserved. 9 Compile-time Extension Interfaces https://github.com/Kotlin/KEEP/pull/87
ɾcompanion objectͱͷׂͷॏෳ ɾJVMͱͷ૬ޓӡ༻ ɾෳͷϨγʔόʹର͢Δ֦ுߏจ͕ඞཁ ɾimplicit parameterͷ͠͞ ɾetc…
Cluster, Inc. All Rights Reserved. 10 Multiple receivers on extension
functions/properties https://youtrack.jetbrains.com/issue/KT-10468 https://youtrack.jetbrains.com/issue/KT-42435
Cluster, Inc. All Rights Reserved. 11 ͦͯ͠Context Receivers https://github.com/Kotlin/KEEP/issues/259 https://github.com/Kotlin/KEEP/blob/master/proposals/context-
receivers.md ឯ༨ۂંʹ͍ͭͯProposalʹॻ͔Ε͍ͯΔ (Alternative approaches and design tradeoffs) 1.6.20-M1 ʹͯPrototypeͱͯ͠ϦϦʔε https://blog.jetbrains.com/kotlin/2022/02/kotlin-1-6-20-m1- released/ freeCompilerArgs = listOf("-Xcontext-receivers")
Cluster, Inc. All Rights Reserved. 12 Context ReceiversͷGoal (ͷ͏ͪ2͚ͭͩհ) ɾίϯςΩετநԽΛهड़͢ΔͨΊͷ
ɹmember extension(ϝϯόʔ֦ு)ΛऔΓআ͘
Cluster, Inc. All Rights Reserved. 13 Context ReceiversͷGoal (ͷ͏ͪ2͚ͭͩհ)
Cluster, Inc. All Rights Reserved. 14 Context ReceiversͷGoal (ͷ͏ͪ2͚ͭͩհ)
Cluster, Inc. All Rights Reserved. 15 Context ReceiversͷGoal (ͷ͏ͪ2͚ͭͩհ)
Cluster, Inc. All Rights Reserved. 16 Context ReceiversͷGoal (ͷ͏ͪ2͚ͭͩհ) ɾKotlinͷܕγεςϜͰෳͷϨγʔόΛ࣋ͭ
ɹίʔυϒϩοΫΛදݱͰ͖ΔΑ͏ʹ͢Δ
Cluster, Inc. All Rights Reserved. 17 Context Receiversͷͦͷଞͷྫ ɾίϯετϥΫλͷӅṭ +
Contextࢀর
Cluster, Inc. All Rights Reserved. 18 Context Receiversͷͦͷଞͷྫ ɾOverloading(※ҙ͋Γ) ͜͏͍͏ίʔυॻ͔ͳ͍Ͱɺͳ༰Proposalʹهࡌ͞Ε͍ͯΔ
(contexts-and-coding-style)
Cluster, Inc. All Rights Reserved. 19 ɾContext Functionͷείʔϓ֊ͷਂ͞(ݕ౼த) ɾReflectionະରԠ(Prototypeஈ֊ͰΒͳͦ͏ͳؾ͕) ɾΤοδέʔεͷରԠ
(Kotlin 1.8.0ͰҰ෦मਖ਼ࡁ) ɾSyntax Highlighting(Τϥʔు͘ͷͰےͰ) ɾetc… Context Receiversͷ՝(Future Work)
Cluster, Inc. All Rights Reserved. 20 (ϓϩτλΠϓஈ֊Ͱͱ͔͍͘͏͖ Ͱͳ͍ͷঝͰ) ɾهड़ͷબࢶ͕ଟͯ͋͘Μ·Γࠓ·ͰͷKotlinΒ͘͠ͳ͍Α͏ͳؾ͕͢Δͷ͕ ɹݸਓతʹٯʹ໘ന͍
ɾCompile-time extensionํ໘Ͱ্͕ͬͨ՝͔ΒݟΔʹՄೳͳهड़ ɹ͜Ε͔ΒߜΒΕ͍ͯͬͯཉ͍͠ͳʔͱࢥ͍ͬͯΔ ɹ(ཞ༻͕ාͯ͘ਂ͘৮Εͳ͍ਓʑ͕͍ͦ͏ͳͷ͍ͬͨͳ͍ɺͱ͍͏ҙຯͰ) ɾݱঢ়Ͱᙱ͍ͱ͜Ζʹख͕ಧ͘ͷͰݸਓతʹॿ͔Δ Context Receiversͷࢥ͍
Cluster, Inc. All Rights Reserved. 21 Context Receiversͷࢥ͍ ɾͦͦͳͥ ”Context”
ʹͳͬͨͷ͔…ʁ ɹ=> Multiple receiversͷϓϩτλΠϓͷஈ֊Ͱ ɹɹύϥϝʔλΛஔ͖͑ΔͨΊʹ͋ΔΘ͚Ͱͳ͘ ɹɹؔݺͼग़͠ͷͨΊͷίϯςΩετΛՃ͢Δҝͷ ɹɹઃܭ͕ඞཁͩͱؾ͍ͮͨҝ ɹɹ=> ύϥϝʔλͷΘΓʹ༻͢Δ߹ʹ ɹɹɹهड़͕ʹͳΔΑ͏͍͑ͯͯ͠Δ ɹɹɹ=> ཞ༻͞Εͳ͍Α͏ʹ https://youtrack.jetbrains.com/issue/KT-10468/Multiple-receivers-on-extension-functionsproperties#focus=Comments-27-4608759.0-0
Cluster, Inc. All Rights Reserved. 22 Context Receiversͷࢥ͍ ɾͦͦͳͥ ”Context”
ʹͳͬͨͷ͔…ʁ ɹ=> Multiple receiversͷϓϩτλΠϓͷஈ֊Ͱ ɹɹύϥϝʔλΛஔ͖͑ΔͨΊʹ͋ΔΘ͚Ͱͳ͘ ɹɹؔݺͼग़͠ͷͨΊͷίϯςΩετΛՃ͢Δҝͷ ɹɹઃܭ͕ඞཁͩͱؾ͍ͮͨҝ ɹɹ=> ύϥϝʔλͷΘΓʹ༻͢Δ߹ʹ ɹɹɹهड़͕ʹͳΔΑ͏͍͑ͯͯ͠Δ ɹɹɹ=> ཞ༻͞Εͳ͍Α͏ʹ https://youtrack.jetbrains.com/issue/KT-10468/Multiple-receivers-on-extension-functionsproperties#focus=Comments-27-4608759.0-0 ͻΐͬͱͯ͠ਅ໘ʹimplicit parameterʹcode generationͳΓͰ ͪΌΜͱରԠͰ͖ΔΑ͏ʹɺ༨നͱ͍ͯͯ͠͠ΔͷͩΖ͏͔…ʁ ؾʹͳΔ…ͦΘͦΘ…ৄ͍͠ਓڭ͍͑ͯͩ͘͞
Cluster, Inc. All Rights Reserved. 23 ·ͱΊ ɾContext ReceiversܕΫϥεͷProposal͔Β
ɹෳͷϨγʔόʹର͢Δ֦ுߏจ͕ඞཁͱ͍͏ ɹྲྀΕͰ࡞ΒΕͨ ɾKotlinʹͯࣗ͘͠͠༝ͷߴ͍Proposal ɾָ͍͠ͷࠓ͚͔ͩ…ʁ ɹProposalΛಡΜͰָ͘͠ɹ ʂ
Context Receiversʹ ࢥ͍ΛͤΔ uzzu @ 2022/10/05 DroidKaigi 2022 DAY.01