
Ask HN: Is JavaScript abandoning Promises - bengg
Recently in a technical screening, a senior engineer asked me what I thought about Javascript moving away from Promises in favor of Observables. I replied that I didn&#x27;t know that Javascript was moving away from Promises, since Promises are part of the ES6 spec.<p>In general, I was blindsided by this. So my 2 questions are:<p>1. Is Javascript truly moving away from Promises in favor of Observables?<p>2. Where can I read about the direction that Javascript is taking, so that I can have an educated discussion on the future of Javascript?
======
WorldMaker
Promises aren't going anywhere. async/await is built on top of Promises, for
instance.

Observables are in position to be adopted by ECMAScript in a future spec
eventually, but they are still only at Stage 1 of the ES proposal process, and
also Observables don't exactly replace Promises so much as extend them.

An Observable can be thought of as a "stream" of promised values rather than
just a single promised value. It's a somewhat different paradigm. From the
Observable perspective a Promise is a simple Observable that produces a single
value and completes immediately after. So you can see Promises are useful in
an Observable world as something of a building block.

A good resource on Observables can be:
[http://reactivex.io/](http://reactivex.io/)

It's focused on the main cross-platform library for Observables (ReactiveX
which has implementations in .NET, Java, JS, more), but a lot of it is
applicable to Observables in general and it has a lot of good "marble"
diagrams that can help show why Observables can be powerful.

The dry Stage 1 ES spec itself is here: [https://github.com/tc39/proposal-
observable](https://github.com/tc39/proposal-observable)

------
justsml
Promises are one of those features misunderstood for 2 reasons. Several
leading _initial_ library implementations were broken from day 1, and
couldn't/wouldn't later introduce breaking changes to existing users.

Another factor dragging down the impression of Promises: Google search seems
to love returning 5+ year old articles. They almost universally suck. Even the
stuff I wrote back then was awful.

New articles are not necessarily spared, they often suffer from a number of
issues: Overly Simplistic examples, fragile function boundaries, leaky
variables, arbitrary 'design.'

I just updated my write-up on avoiding Promise anti-patterns:
[https://github.com/justsml/escape-from-callback-
mountain/wik...](https://github.com/justsml/escape-from-callback-
mountain/wiki/Beating-a-dead-horse%3F)

The main project's README shows how to rock modern Promises:
[https://github.com/justsml/escape-from-callback-
mountain/](https://github.com/justsml/escape-from-callback-mountain/)

------
ahookom
I keep hearing about async/await being a cleaner way to write asynchronous
code in JavaScript but async/await actually makes use of promises in the
implementation. That's what I would have talked about. For more:
[https://hackernoon.com/6-reasons-why-javascripts-async-
await...](https://hackernoon.com/6-reasons-why-javascripts-async-await-blows-
promises-away-tutorial-c7ec10518dd9)

------
borplk
Promises are not going anywhere.

