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:46:30 +0100
Message-ID: <CADnb78iXLEhevfczTqzB-47ng+wJE1rn3XcMD51v3zjmP8q18g@mail.gmail.com>
To: Kevin Smith <zenparsing@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:25 PM, Kevin Smith <zenparsing@gmail.com> wrote:
>     Future.accept(Future.resolve(1)).then(value => {
>
>         console.log(value !== 1);
>         return Future.accept(Future.resolve(1));
>
>     }).then(value => {
>
>         console.log(value === 1);
>     });
>
> logs
>
> - true
> - true
>
> Is that what it should be doing, according to the DOM spec?  Anne, Alex?

No. Per the definition of the then() method and
http://dom.spec.whatwg.org/#concept-future-wrapper-callback then()
will just be invoked with the result of the future. Future.accept()
sets the result of the new future to the argument it was passed.
Future.resolve() sets the result of the future to the resolved value
(does unwrapping of a thenable).


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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC