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
Using Future
Search
DAloG
November 01, 2015
Programming
0
93
Using Future
I will try to explore concept of Async state and Future monad
DAloG
November 01, 2015
Tweet
Share
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
200
Redux + MQTT
dalog
1
780
От задач к проблемам
dalog
1
260
Unlimited power of Data-Driven UI
dalog
4
650
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.9k
2 years of Redux in iOS. Lessons learned
dalog
0
380
Why unidirectional architecture matter for iOS.
dalog
1
290
Mobile backend without REST
dalog
2
110
Self managed teams 101
dalog
0
150
Other Decks in Programming
See All in Programming
旅行プランAIエージェント開発の裏側
ippo012
1
370
「リーダーは意思決定する人」って本当?~ 学びを現場で活かす、リーダー4ヶ月目の試行錯誤 ~
marina1017
0
250
GUI操作LLMの最新動向: UI-TARSと関連論文紹介
kfujikawa
0
1k
Constant integer division faster than compiler-generated code
herumi
2
700
私の後悔をAWS DMSで解決した話
hiramax
4
160
Understanding Ruby Grammar Through Conflicts
yui_knk
1
140
CSC305 Summer Lecture 12
javiergs
PRO
0
130
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
950
Nuances on Kubernetes - RubyConf Taiwan 2025
envek
0
200
LLMOpsのパフォーマンスを支える技術と現場で実践した改善
po3rin
8
990
パッケージ設計の黒魔術/Kyoto.go#63
lufia
1
230
Infer入門
riru
4
1.6k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Fireside Chat
paigeccino
39
3.6k
Designing for Performance
lara
610
69k
The Pragmatic Product Professional
lauravandoore
36
6.8k
Into the Great Unknown - MozCon
thekraken
40
2k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Side Projects
sachag
455
43k
Gamification - CAS2011
davidbonilla
81
5.4k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
The Invisible Side of Design
smashingmag
301
51k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.6k
Transcript
USING FUTURES @daloog
ABOUT skype: nobidon
[email protected]
https://speakerdeck.com/dalog
ASYNC VS PARALLEL
ASYNC DO THINGS AT DEFERENT TIME
PARALLEL DO THINGS AT THE SAME TIME
GCD
GCD
NSOPERATION
NSOPERATION
[ _ TARGET: ACTION: ]
DELEGATE
STRATEGY AND CALLBACK
BLOCK
CALLBACK!!!
SIGNATURE DANCE
None
None
None
None
None
None
None
None
None
None
SEPARATE WORK FROM RESULT DELIVERY
SETTER
T -> ()
GETTER
() -> T
T -> U IS (GET, SET) -> ()
T -> U (() -> T, U -> ()) ->
()
None
ASYNC?
ASYNC GETTER
() -> T (T -> ()) -> () SET ->
()
SET<T> -> () FUTURE<T>
ASYNC SETTER
T -> () () -> (T -> ()) () ->
SET
() -> SET<T> PROMISE<T>
GETTER + SETTER = STATE
PROMISE + FUTURE = ASYNC STATE
ASYNC STATE >>> STATE
WHY THIS IS SO HARD???
ACTUALLY NOT
THINK ABOUT FUTURE AS A BOX
BOX WILL BE OPENED. SOMEDAY. MAYBE.
A = B C = A
CHAIN?
T -> U U -> K T -> K
T -> F<U> U -> F<K> T -> F<K>
(F<U> , U -> F<K>) -> F<K>
AND THEN
FLAT MAP
ERROR?
TRY<T, E>
FUTURE<T, E> = FUTURE<TRY<T, E>>
WHAT CAN BE FUTURE?
ANYTHING
UI
USING FUTURES FOR REVERSING UI FLOW. HTTPS://MEDIUM.COM/P/D3F5B7CA32D9/ EDIT
VM -> F<ACTION>
NETWORK BLUETOOTH …
EXPOSE F<> AS PUBLIC API
ALWAYS
USE ANY LIB • https://github.com/BoltsFramework/Bolts-iOS • https://github.com/mxcl/PromiseKit • https://github.com/Thomvis/BrightFutures •
https://realm.io/news/swift-summit-javier-soto-futures/ • https://realm.io/news/swift-tasks-nevyn-bengtsson/
ALL LIBS EQUAL ITS JUST ASYNC STATE
FUTURE / PROMISE ASYNC GET/SET