Killing `Promise.fulfill`

Kevin Smith zenparsing at gmail.com
Mon Aug 19 19:17:04 PDT 2013


Thanks Mark.

To clarify my overly brief interjection, I tend to favor the conceptual
simplicity of the earlier "DOM" API.  Specifically:

- no "flatMap"
- the output of then is single-unwrapped
- no recursive unwrapping

I find it more simple from a conceptual standpoint because each promise
simply resolves to some value (possibly a promise) which can be accessed
via then.

If I remember correctly, AP2 was motivated by the need to support both
recursive unrwapping and single-unwrapping with a single API.  It is a
clever solution, to be sure.  But can we not simply provide a recursive
unwrapping helper function?

    Promise.when(unknown).then(unwrapped => console.log(unwrapped));

In this case, `unwrapped` will be the result of recursively unwrapping
`unknown`, if `unknown` is a promise, and the value `unknown` otherwise.

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130819/2ac4d62f/attachment.html>


More information about the es-discuss mailing list