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
Promises, Futures, and the Shape of Your Code
Search
Greg Heo
May 21, 2018
Technology
0
42
Promises, Futures, and the Shape of Your Code
Greg Heo
May 21, 2018
Tweet
Share
More Decks by Greg Heo
See All by Greg Heo
Concurrency From the Ground Up
gregheo
0
130
The least you need to know about hashing in Swift
gregheo
0
91
Shared Mutable State
gregheo
0
300
Shared, Exclusive, Mutable, Immutable
gregheo
0
96
Getting Under Swift’s Skin
gregheo
0
510
Sanitizing Threads for Fun & Profit
gregheo
0
94
Sanitizing All* The Things
gregheo
0
44
Thirteen Ways of Looking at a View Controller
gregheo
0
120
Five Unbelievable Secrets of Reactive Programming the Experts Don't Want You to Know!
gregheo
3
300
Other Decks in Technology
See All in Technology
AWS を使う上で知っておきたいオンプレミス知識/aws-on-premise-essentials
emiki
1
4.2k
[PlatformCon 24] Platform Orchestrators: The Missing Middle of Internal Developer Platforms?
danielbryantuk
1
170
「共通基盤」を超えよ! 今、Platform Engineeringに取り組むべき理由
jacopen
25
5.8k
長期運用プロジェクトでのMySQLからTiDB移行の検証
colopl
2
630
Tableau事例紹介 / Tableau Case Study of Eureka
kazuya_araki_tokyo
1
170
自動生成を活用した、運用保守コストを抑える Error/Alert/Runbook の一元集約管理 / Centralized management of Error/Alert/Runbook to minimize operational costs using automated code generation
biwashi
9
2.1k
キャラクター制御のためのプロンプト術 for LINE Bot
uezo
0
520
SREとその組織類型
tatsuo48
8
1.5k
0→1開発における技術選定において一番大切なこと
bicstone
1
320
Four keys改善の取り組み事例紹介
sansantech
PRO
3
230
Microsoft Cloudで開発ライフサイクルを保護する
kkamegawa
0
140
長期間TiDBを使ってきた話 @ 私たちはなぜNewSQLを使うのかTiDB選定5社が語る選定理由と活用LT / Experiences with TiDB Over Time
chibiegg
2
660
Featured
See All Featured
What the flash - Photography Introduction
edds
64
11k
Typedesign – Prime Four
hannesfritz
36
2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
20
1.6k
Web development in the modern age
philhawksworth
202
10k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
6
990
Rebuilding a faster, lazier Slack
samanthasiow
72
8.2k
The Pragmatic Product Professional
lauravandoore
24
5.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Become a Pro
speakerdeck
PRO
10
4.5k
Done Done
chrislema
178
15k
Statistics for Hackers
jakevdp
789
220k
Transcript
@gregheo C1 Mobile Summit
++++++++[>++++[>++>+ ++>+++>+<<<<-]>+>+>- >>+[<]<-]>>.>---.+++ ++++..+++.>>.<-.<.++ +.------.--------.>> +.>++.
None
None
None
None
None
!
networker.beginRequest(.read, success: { data in })
networker.beginRequest(.read, success: { data in parser.parseRaw(data) { result in }
})
networker.beginRequest(.read, success: { data in parser.parseRaw(data) { result in archiver.materialize(from:
result) { objects in } } })
networker.beginRequest(.read, success: { data in parser.parseRaw(data) { result in archiver.materialize(from:
result) { objects in dataStore.save(objects) { status in } } } })
networker.beginRequest(.read, success: { data in parser.parseRaw(data) { result in archiver.materialize(from:
result) { objects in dataStore.save(objects) { status in print("Save success!") } } } }) print("Hello 1") print("Hello 2")
⏰#
None
A B C X Y Z
networker.beginRequest(.read, success: { data in parser.parseRaw(data) { result in archiver.materialize(from:
result) { objects in dataStore.save(objects) { status in print("Save success!") } } } }) print("Hello 1") print("Hello 2")
⏰#
networker.beginRequest(.read, success: { data in parser.parseRaw(data) { result in archiver.materialize(from:
result) { objects in dataStore.save(objects) { status in print("Save success!") } } } })
Clojure
Future
(defn square [x] (* x x) )
(defn square [x] (future (* x x)) )
(defn saveToDisk [data] (future ( ... )) )
saveToDisk future completed? cancelled? value
@myFuture (deref myFuture)
A X Y future B C D (deref future)
Future
Promise
@myPromise (deref myPromise)
getValue promise realized? value promise deliver
Promise
❓
%&