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
84
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
32
A developer's guide to wealth
adnan321
0
240
What the Hook ?
adnan321
0
63
Scoping Your Storage
adnan321
2
140
What The Context ?
adnan321
2
190
Putting Work Manager To Work
adnan321
0
86
OOP To FP
adnan321
1
190
Putting Work Manager To Work
adnan321
1
140
A slice of Android Slices - droidcon London 2018
adnan321
0
97
Other Decks in Programming
See All in Programming
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
140
Fast JSX: Don't clone props object #28768
yossydev
1
120
Let's learn code review
riofujimon
2
400
Apache Hive 4 on Treasure Data
ryukobayashi
0
330
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
930
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
340
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
920
使ってみよう Azure AI Document Intelligence
kosmosebi
2
320
Fragment Composition of GraphQL
quramy
7
1k
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
370
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
430
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
340
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
227
16k
Building a Scalable Design System with Sketch
lauravandoore
456
32k
Building Your Own Lightsaber
phodgson
99
5.7k
How GitHub (no longer) Works
holman
304
140k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
Bash Introduction
62gerente
604
210k
Side Projects
sachag
451
41k
Web development in the modern age
philhawksworth
202
10k
Code Review Best Practice
trishagee
55
15k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
116
18k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
GraphQLとの向き合い方2022年版
quramy
32
12k
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