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
Kotlin Dynamic type
Search
coe
September 26, 2023
Technology
0
290
Kotlin Dynamic type
集まれSwift好き!Swift愛好会 vol.77 @ DeNA
2023/09/26
coe
September 26, 2023
Tweet
Share
More Decks by coe
See All by coe
すべてのヘルスケアデータを紐解く.pdf
coe
0
2.1k
About HealthKit nutrition
coe
0
340
iOSDC 2023 Web in tvOS and watchOS
coe
1
540
iOSDC 2023 Push To Talk
coe
1
1.7k
iOSDC手で触れずにアプリを動かす技術
coe
1
1.4k
iOSDC令和時代のXML処理を考える
coe
3
2.1k
iOSDC 2021 Restore
coe
6
1.8k
詳解Storyboard
coe
7
3.4k
あなたの知らない連絡先の世界
coe
15
8k
Other Decks in Technology
See All in Technology
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
140
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.7k
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
Engineer Career Talk
lycorp_recruit_jp
0
190
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
170
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
130
Lexical Analysis
shigashiyama
1
150
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Facilitating Awesome Meetings
lara
50
6.1k
Code Review Best Practice
trishagee
64
17k
GraphQLとの向き合い方2022年版
quramy
43
13k
Scaling GitHub
holman
458
140k
A Philosophy of Restraint
colly
203
16k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Transcript
ڧ݄ %ZOBNJDUZQF ू·Ε4XJGU͖ʂ4XJGUѪձWPM ू·Ε,PUMJO͖ʂ,PUMJOѪձWPM!%F/"
w ڧ w J04ΤϯδχΞ
%ZOBNJDUZQF
w ڧ w J04Τ ϯδχ Ξ
%ZOBNJD UZQF
fun dynamicFun(x: dynamic): Unit { val dyn: dynamic = ...
} ,PUMJO%ZOBNJDUZQF
%ZOBNJDUZQF
%ZOBNJDUZQF w EZOBNJDܕ w WBMEZOEZOBNJDʜ w ͳΜͰೖΔ
fun dynamicFun(x: dynamic): Unit { }
fun dynamicFun(x: dynamic): Unit { } fun anyFun(x: Any): Unit
{ }
fun dynamicFun(x: dynamic): Unit { x.god } fun anyFun(x: Any):
Unit { x.god // ←ίϯύΠϧΤϥʔ }
%ZOBNJDUZQF w EZOBNJDܕ w WBMEZOEZOBNJDʜ w ͳΜͰೖΔ w ܕνΣοΫΛߦΘͳ͍ʢίϯύΠϧΤϥʔʹͳΒͳ͍ʣ
// xHuman fun dynamicFun(x: dynamic): Unit { x.back.left.left.up.scratch() } class
Back { val left: Back get() = Back() val right: Back get() = Back() val up: Back get() = Back() val down: Back get() = Back() fun scratch(): Unit { println(“ຬʂ”) } } class Human { val back = Back() }
%ZOBNJDUZQF w EZOBNJDܕ w WBMEZOEZOBNJDʜ w ͳΜͰೖΔ w ܕνΣοΫΛߦΘͳ͍ʢίϯύΠϧΤϥʔʹͳΒͳ͍ʣ w
ࣗ༝ʹϓϩύςΟؔΛݺΔ w EZOBNJDܕͷϓϩύςΟؔͷϦλʔϯEZOBNJDܕ
fun dynamicPlus(x: dynamic, y: dynamic): Unit { x + y
}
fun dynamicPlus(x: dynamic, y: dynamic): Unit { x + y
// 3 } dynamicPlus(1, 2)
fun dynamicPlus(x: dynamic, y: dynamic): Unit { x + y
// ڧ } dynamicPlus(“”, “ڧ”)
fun dynamicPlus(x: dynamic, y: dynamic): Unit { x + y
// iOSΤϯδχΞ } dynamicPlus(“iOS”, “ΤϯδχΞ”)
fun dynamicPlus(x: dynamic, y: dynamic): Unit { x + y
// 105ΤϯδχΞ } dynamicPlus(105, “ΤϯδχΞ”)
%ZOBNJDUZQF w EZOBNJDܕ w WBMEZOEZOBNJDʜ w ͳΜͰೖΔ w ܕνΣοΫߦΘͳ͍ʢίϯύΠϧΤϥʔʹͳΒͳ͍ʣ w
ࣗ༝ʹϓϩύςΟؔΛݺΔ w EZOBNJDܕͷϓϩύςΟEZOBNJDܕ w EZOBNJDಉ࢜ͷܭࢉՄೳ
͍͢͝ʂ
͡ΊΑ͏
,PUMJO+4
IUUQTLPUMJOMBOHPSHEPDTEZOBNJDUZQFIUNM %ZOBNJDUZQF
None