Tab Atkins Jr.
jackalmage at gmail.com
Tue Aug 20 08:32:27 PDT 2013
On Tue, Aug 20, 2013 at 7:08 AM, Mark S. Miller <erights at google.com> wrote:
> Hi Anne, Thanks for the reminder. My message of last night fell into that
> same old trap (ignoring the storage cost) and that previous reversal of mine
> is still mostly correct, However, the missing operation is not .fulfill for
> the reasons Domenic correctly explains. It is .accept (possibly named .of)
> because it observably differs from .resolve only to .flatMap observers;
> whereas the distinction between "pending", "fulfilled" and "rejected" is
> observable to .then observers.
I have no idea what happened in this thread, because people keep
referring to "the earlier X" where by "earlier" they mean "in another
unnamed thread, days/weeks ago" rather than just enumerating what
they're talking about. (This kind of thing is acceptable while the
other threads are ongoing in parallel; it's not when the threads have
been paged out of people's heads.)
But in this paragraph, specifically, what are you talking about, Mark?
What is this "missing operation", who needs it, and why?
>From what I understood talking to Domenic, here's what we needed:
1. Promise.resolve() and Promise.reject(). These just take a value
and wrap it in a Promise, putting it on the success or failure track.
2. Promise#then() and Promise#flatMap(). flatMap waits for pending
promises to become resolved or rejected, and calls its callbacks
accordingly; then() waits for pending or resolved promises to become
fulfilled or rejected, and calls its callbacks accordingly.
3. The resolved value of a promise (what's passed to the success
callback of flatMap()) is simply the value in the promise. The
fulfilled value of a promise (what's passed to the success callback of
then()) depends on what's inside the promise: if it's a plain value,
that's the fulfilled value; if it's a promise, its that promise's
Do you think we need anything else? If so, why, and for what purpose?
(Note that if anyone thinks we need something that eagerly flattens a
promise, rather than flattening happening implicitly via the
definition of "fulfilled value" for then(), realize that this eager
flattening operation is hostile to lazy promises. While this might be
*useful* in some cases, it's probably not something we need or want in
the core language, or if we do, it should be given an appropriately
descriptive name, rather than yet another synonym for "accept".)
More information about the es-discuss