Why the ECMAScript 2015 Promises don't have finally methods?

# Behrang Saeedzadeh (9 years ago)

I was just wondering why finally didn't make it into the ECMAScript 2015 spec's Promises?

They seem to me to be necessary for many use cases.

# Benjamin Gruenbaum (9 years ago)

The reason ECMAScript 2015 promises do not have finally is because it wasn't necessary for the initial proposal and things were 'running late' already and it was possible to ship without it. Shipping fast enabled us to include promises in ECMAScript 2015.

It is entirely possible (and dare I say - likely) that finally will be included in a future version, note that when promise cancellation makes it in - finally might have specific semantics for that so it's probably better to wait for it for until we have cancellable promises.

Quoting Domenic from a previous esdiscuss discussion:

Although I find the arbitrary division of features into "ES6" and "ES7"

distasteful personally: yes, ES6 will not be adding new APIs. That doesn't mean that Promise.prototype.finally won't ship in all major browsers before other ES6 features do. But it does mean that we won't be submitting a document to the Ecma general assembly with Promise.prototype.finally before we submit one with proper tail calls.

Some context:

# C. Scott Ananian (9 years ago)

You can get Promise #finally by using a helper library, like prfun.

But the finally method in particular has a quirk, see the end of: cscott/prfun/blob/master/README.md#promisefinallyfunction-handler--promise

It would be nice to resolve that properly before standardization.

# Behrang Saeedzadeh (9 years ago)

Thanks for the explanation guys. Looking forward to see both of cancellation and finally in ECMAScript 2016! :) (as well as async/await)...

On an unrelated note, does anyone know if any of Firefox, Edge, and Safari/WebKit have plans to implement the full ECMAScript 2015 by the end of 2015?