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
アクセシビリティ試験の"その後"を仕組み化する
yuuumiravy
1
190
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
620
第3木曜LT会 #28
tinykitten
PRO
0
120
when storing skills in S3 file
watany
2
430
[RubyKaigi 2026] Require Hooks
palkan
1
280
【26新卒研修資料】TDD実装演習
dip_tech
PRO
0
160
空間オーディオの活用
objectiveaudio
0
120
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
610
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.5k
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
160
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
1
640
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
460
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Technical Leadership for Architectural Decision Making
baasie
3
350
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
280
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
BBQ
matthewcrist
89
10k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
350
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Balancing Empowerment & Direction
lara
6
1.1k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
How to train your dragon (web standard)
notwaldorf
97
6.6k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
350
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 ༗໊ͳөըΛࡐʹɺܭࢉػՊֶΛղઆ͍ͯ͠·͢