AP2 makes laziness easy.

Tab Atkins Jr. jackalmage at gmail.com
Mon Aug 26 09:24:42 PDT 2013


On Mon, Aug 26, 2013 at 9:22 AM, Mark S. Miller <erights at google.com> wrote:
> On Mon, Aug 26, 2013 at 9:17 AM, Tab Atkins Jr. <jackalmage at gmail.com>
> wrote:
>>  What about .resolve()?
>
> pseudocode:
>
>         resolve(obj) => isPromise(obj) ? adopt(obj) : accept(obj)
>
> The isPromise above is nominal. If obj is a non-promise thenable, as in the
> example, it will be accepted, not adopted. The isThenable check happens
> *only* on the input side of .then, and so forcing only happens at that point
> as well.

Sounds good to me.

~TJ


More information about the es-discuss mailing list