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

Re: Promises: Auto-assimilating thenables returned by .then() callbacks: yay/nay?

From: Sam Tobin-Hochstadt <samth@ccs.neu.edu>
Date: Fri, 3 May 2013 22:10:04 -0400
Message-ID: <CAK=HD+YgWMpLAYr57jYX+iL=saYWd=U51qha5sLdnaSt2_gN9A@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: "Tab Atkins, Jr." <jackalmage@gmail.com>, Domenic Denicola <domenic@domenicdenicola.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, "Mark S. Miller" <erights@google.com>
On Fri, May 3, 2013 at 7:17 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>
> Third, there's the question of what a nested promise actually means.
> Normally a promise represents "a value after some time". But what does
> a nested promise mean? "A value after a longer time" obviously isn't
> correct since there are no time constraints associated with a promise.
> "A promise after some time" also isn't really meaningful given that
> that simply means "A value after some time after some time".

I've been staying out of all of the promises discussions, but this
just doesn't make any sense at all.  A function of no arguments is a
"computation that produces a value".  By a similar argument to yours,
functions of no arguments that produce the same aren't meaningful,
because it's a "computation that produces a computation that produces
a value".  I hope we can all see that this in fact makes perfect
sense.

Similarly, a promise is a data structure that represents an
asynchronous computation producing a result.  It makes perfect sense
for that result to be yet again a similar data structure.  This is not
to prescribe what should be done with that result, but it is
_perfectly_ meaningful.

Sam
Received on Saturday, 4 May 2013 02:10:52 UTC

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