A Challenge Problem for Promise Designers (was: Re: Futures)

Tab Atkins Jr. jackalmage at gmail.com
Thu Apr 25 22:40:04 PDT 2013


On Thu, Apr 25, 2013 at 8:52 PM, Mark S. Miller <erights at google.com> wrote:
> So how does the semantics of Q(x) differ from the semantics of
> Future.resolve(x) ?

I suppose you tell me?

You offered, as an example of why recursive unwrapping was useful,
some example code that used Q(val).then().  The surrounding
explanatory text suggested that this helped with the case where "val"
could be either a plain value *or* a promise.

I assumed this meant that Q() simple wraps its argument in a promise
(like Future.accept() does), resulting in either a promise or a
promise-for-a-promise, and .then() recursively unwrapped, so you ended
up with the plain value at the end.

If that's not the case, and Q() does the same "conditional wrapping"
that Future.resolve() does, then I don't understand the point of your
example, or how your OP in this thread supports the assertion that
recursive unwrapping is useful.

~TJ


More information about the es-discuss mailing list