W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: Futures

From: Anne van Kesteren <annevk@annevk.nl>
Date: Fri, 26 Apr 2013 19:51:00 +0100
Message-ID: <CADnb78iA7tmLPObNA6Z7Y5Ui+0164iD=gPr-Sw1vMBXHHfGOYg@mail.gmail.com>
To: Juan Ignacio Dopazo <dopazo.juan@gmail.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Brendan Eich <brendan@mozilla.com>, "Mark S. Miller" <erights@google.com>, Douglas Crockford <douglas@crockford.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Norbert Lindenberg <w3@norbertlindenberg.com>, Markus Lanthaler <markus.lanthaler@gmx.net>, EcmaScript <es-discuss@mozilla.org>
On Fri, Apr 26, 2013 at 7:44 PM, Juan Ignacio Dopazo
<dopazo.juan@gmail.com> wrote:
> I think Kevin's assertion is correct. According to the spec, callbacks are
> wrapped in something called a "future wrapper callback". When a promise is
> returned from the callback, the wrapper does this:
>
>> Let value be the result of invoking callback with argument as argument.
>> (...) run resolver's resolve with value and the synchronous flag set.
>
>
> resolve tries to adopt the promise by being recursive, effectively
> flattening the promise:
>>
>> If value is a JavaScript Object, set then to the result of calling the
>> JavaScript [[Get]] internal method of value with property name then.
>> If JavaScript IsCallable(then) is true [treats all thenables the same
>> way], run these substeps and then terminate these steps:
>> Call the JavaScript [[Call]] internal method of then with this value value
>> and resolve and reject as arguments.
>
> If resolved called the thenable's then() with accept and reject, it would
> only unwrap one layer.

Oops yeah. I guess that should be fixed. :/


--
http://annevankesteren.nl/
Received on Friday, 26 April 2013 18:51:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:13 UTC