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
Understanding Subtype in 5 Minutes
Search
Ryosuke TAKASHIMA
September 06, 2019
Programming
190
0
Share
Understanding Subtype in 5 Minutes
Ryosuke TAKASHIMA
September 06, 2019
More Decks by Ryosuke TAKASHIMA
See All by Ryosuke TAKASHIMA
GCP native cloud migration
rst76
1
540
Cloud migration of the essential service
rst76
1
620
About purely functional language
rst76
0
150
performance-tuning-of-the-microservice.pdf
rst76
0
1.6k
red-black-tree.pdf
rst76
0
94
Fun of Types
rst76
0
61
Embedded Probabilistic Programming
rst76
0
380
Other Decks in Programming
See All in Programming
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
130
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
730
Programming with a DJ Controller — not vibe coding
m_seki
3
750
Oxlintとeslint-plugin-react-hooks 明日から始められそう?
t6adev
0
320
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
170
Claude Codeをカスタムして自分だけのClaude Codeを作ろう
terisuke
0
160
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
480
ハーネスエンジニアリングとは?
kinopeee
13
6.6k
CDK Deployのための ”反響定位”
watany
5
920
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
420
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
970
過去のレビュー知見をSkillsで資産化した話
pkshadeck
PRO
0
300
Featured
See All Featured
Building AI with AI
inesmontani
PRO
1
960
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
790
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
230
Mind Mapping
helmedeiros
PRO
1
180
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
160
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
270
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
The Curse of the Amulet
leimatthew05
1
12k
Evolving SEO for Evolving Search Engines
ryanjones
0
190
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Transcript
̑ͰΘ͔Δ෦ܕ ΤϜεϦʔ ߴౡ྄༞ʢ@rst76ʣ
ͳͥʁ
෦ܕͱ w ܕͷ্Լʢแؚʣؔ෦ܕؔ w ԼҐͷܕΛ෦ܕͱݺͿ w +BWBͷ߹ɺܧঝͰ࣮ݱ w ܕͷมԽʹͱͳ͏෦ܕؔͷมԽ ෆมɾڞมɾม
Object Number Integer ্Ґͷܕ ԼҐͷܕ ࢠ
෦ܕؔ̍ w ্Ґͷܕ͕ظ͞Ε͍ͯΔͱ͜ΖʹɺԼҐͷܕΛ͏͜ͱͰ͖Δ Function<Object, String> objFunc = o -> o.toString()
+ "!!!"; objFunc.apply(76); // => "76!!!" objFunc.apply("ten"); // => "ten!!!"
෦ܕؔ̎ w ԼҐͷܕ͕ظ͞Ε͍ͯΔͱ͜Ζʹɺ্ҐͷܕΛ͏͜ͱͰ͖ͳ͍ Function<Integer, String> intFunc = i -> Integer.toString(i
/ 2) + "???"; intFunc.apply(76); // => "39???" intFunc.apply(new Object()); // => Compile Error
ؔͷ߹̍ w ؔܕ Function<Function<Number, String>, String> numFuncFunc = f ->
f.apply(76.0); Function<Number, String> numFunc = n -> Integer.toString(n.intValue() / 4) + "..."; numFuncFunc.apply(numFunc); // => "19..."
ؔͷ߹̎ w ҾͰؔ͢ͷҾɺԼҐͷܕʹͰ͖ͳ͍ʂ ؔ͢ɺҾͷܕʹ࿙Εͳ͘ରԠͰ͖Δʢఆ֎Ͱͳ͍ʣඞཁ͕͋Δ Function<Function<Number, String>, String> numFuncFunc = f
-> f.apply(76.0); Function<Integer, String> intFunc = i -> Integer.toString(i * 2) + "???"; numFuncFunc.apply(intFunc); // => CompileError
ؔͷ߹̏ w ٯʹ্ҐͷܕΛҾʹͱΔؔͳΒɾɾɾ Function<Function<? super Number, String>, String> numFuncFunc =
f -> f.apply(76.0); Function<Object, String> objFunc = o -> o.toString() + "!!!"; numFuncFunc.apply(objFunc); // => "76.0!!!"
·ͱΊ w ܕͷ্ԼؔɺؔͷҾͰٯస͢Δˠม w ܕָ͍͠ʂ w ָ͍ؔ͠ʂʂ
એ w ʰϫϯεɾΞϙϯɾΞϯɾΞϧΰϦζϜʱ ɹͱ͍͏ຊΛ༁͠·ͨ͠ w ༗໊ͳөըΛࡐʹɺܭࢉػՊֶΛղઆ͍ͯ͠·͢