Skip to main content

Asynchronous Promises

Kris Kowal (Uber)
Average rating: ***..
(3.67, 12 ratings)
Slides:   1-PDF 

There is no single answer to the question, What is the point of promises? There is a journey of answers. The promise of promises—if you will—is that the road is longer than the road of threads, fibers, and bare callbacks.

The point of promises is to provide implicit asynchronous error propagation. The point of promises is to provide asynchronous analogies for “return” and “throw”. Combined with generators, you can bypass the analogy and use all of JavaScript’s control flow, including “for” and “if”, for asynchronous code. Promises can send messages into the future, over networks, and into other processes, to remote promises. These messages can be pipelined to overcome the latency of RPC. But the real point of promises is to help debugging by tracking causality, where stack traces fear to tread.

The point of promises is to provide an abstraction that will to serve you reliably, from DOMContentReady to distributed security.

Photo of Kris Kowal

Kris Kowal

Uber

Kris Kowal wrote and promoted the CommonJS module specification, popularized by Node.js. He also created ES5-Shim, Q promises, and Functional Reactive Bindings for MontageJS.