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
Having fun with Kotlin fun()
Search
Adnan A M
September 21, 2018
Programming
0
97
Having fun with Kotlin fun()
Slides from my talk at droidcon Vienna 2018.
Adnan A M
September 21, 2018
Tweet
Share
More Decks by Adnan A M
See All by Adnan A M
Abridge Coding Guidelines
adnan321
0
58
A developer's guide to wealth
adnan321
0
270
What the Hook ?
adnan321
0
90
Scoping Your Storage
adnan321
2
170
What The Context ?
adnan321
2
230
Putting Work Manager To Work
adnan321
0
110
OOP To FP
adnan321
1
210
Putting Work Manager To Work
adnan321
1
170
A slice of Android Slices - droidcon London 2018
adnan321
0
120
Other Decks in Programming
See All in Programming
はじめてのカスタムエージェント【GitHub Copilot Agent Mode編】
satoshi256kbyte
0
140
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
240
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
0
190
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
12
3.1k
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
150
愛される翻訳の秘訣
kishikawakatsumi
3
370
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
7
4.2k
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
180
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
180
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
300
これならできる!個人開発のすゝめ
tinykitten
PRO
0
140
Cap'n Webについて
yusukebe
0
160
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
How to make the Groovebox
asonas
2
1.9k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.3k
Paper Plane
katiecoart
PRO
0
45k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.5k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
54
48k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
190
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
110
Tell your own story through comics
letsgokoyo
0
770
Transcript
Having fun with Kotlin fun()
What is a function ?
“ Quote a long definition from Wikipedia here….. OR fun
myFunction() { // pretty awesome function right here }
Kotlin, give us a function !
Kotlin, give us a function !
Local Functions Functions within functions
None
Can’t unit test inner function Caveats/Gotchas Kotlin function doesn’t see
local declarations in advance
Single Expression Functions
None
Top Level Functions Extend functionality
Extension Functions Extend functionality
Extension function
Resolved Statically Under the hood Receiver Object The static function
is passed in the receiver object as a parameter
Companion objects/Static classes Caveats/Gotchas Member Functions Win
Named Arguments Thou shall name parameters
None
None
None
None
Default Parameters
None
Java interop isn’t great, must specify all parameters when calling
Caveats/Gotchas
Lambda Expressions
None
Anonymous functions
None
Higher Order Functions
None
None
None
None
None
None
None
inline functions
None
None
Let’s inline all Higher Order Functions ! Caveats/Gotchas No access
to private variables/members
None
Non local returns
None
None
None
None
None
Standard Functions
“ let, also, apply, run & with
None
None
“ Scoping functions
let
Usage of let
None
apply
Usage of apply
None
also
Usage of also
None
run
Usage of run
None
“ Transformation vs Mutating functions
“ also, apply - Mutating Functions
“ run, let - Transformation Functions
Danke Any questions? You can find me at: ◇ @AdnanM0123
Slide Theme ◇ Presentation template by SlidesCarnival ◇ Photographs by
Unsplash