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

Re: Do futures represent a pipeline? (was Re: Future cancellation)

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 1 May 2013 09:13:20 -0700
Message-ID: <CAAWBYDBP_WFBYiQcPNLrYwG8Shgn=UCaEaxx9ouow5bS=Gk=4g@mail.gmail.com>
To: Kevin Gadd <kevin.gadd@gmail.com>
Cc: "Sam L'ecuyer" <sam@cateches.is>, "public-script-coord@w3.org" <public-script-coord@w3.org>, es-discuss <es-discuss@mozilla.org>
On Tue, Apr 30, 2013 at 12:49 PM, Kevin Gadd <kevin.gadd@gmail.com> wrote:
> Thanks, the idea that .then() returns a new Promise is very very strange to
> me. What gets stored into that promise?

Yes, promises can be through of as pipelines.  The return value of
.then() is a *new promise*, which gains its value from the .then()
callbacks - if the callbacks return a value, it accepts/resolves with
the same value; if they throw, it rejects with the error.

The reasoning behind promises/futures is explained in more detail in
my blog posts <http://www.xanthir.com/b4PY0>
<http://www.xanthir.com/b4P_0> and Domenic's

> I think I see a lot of the historical confusion here as being rooted in the
> fact that the terms 'promise' and 'future' seem poorly-suited for describing
> a pipeline oriented primitive, if that's what these futures are. Maybe all
> discussion threads on futures need a big hairy disclaimer that tells people
> to read a description of what 'future' and 'promise' actually mean in this
> context :)

I think "future" is a pretty good name, personally - it means that the
callbacks will be run in the future. ^_^  But "promise" also kinda
works, and it's more common.  But DOMFuture definitely needs more
explanatory text (which I've promised to submit a pull request to

Received on Wednesday, 1 May 2013 16:14:07 UTC

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