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

Re: Deprecating Future's .then()

From: Mark S. Miller <erights@google.com>
Date: Wed, 5 Jun 2013 18:11:33 -0700
Message-ID: <CABHxS9jOr6uwHLWO1Vr65AehSpCh_5cOqZA=miNB+Tfz6aHzmw@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Sean Hogan <shogun70@westnet.com.au>, Anne van Kesteren <annevk@annevk.nl>, Sam Tobin-Hochstadt <samth@ccs.neu.edu>, "www-dom@w3.org" <www-dom@w3.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Alex Russell <slightlyoff@google.com>
Sean, this is quite clever.

Hi Tab, I'm glad that you're happy either way because I'm happy only one
way ;). Actually, this is an issue that we've already discussed over in Q
land.

In Q and in the Q style, a promise broken by a promise is not weird at all.
It wouldn't make sense to do anything like flattening this. The outer
promise, being broken, will never designate a value. The inner promise is
not there to designate the value that the outer promise designates. Rather,
the inner promise represents the reason explaining why the outer promise is
broken -- why the outer promise will never designate anything. The inner
promse might for example be a promise for an Error. If the inner promise is
pending, then we still know the outer promise is broken, but we don't yet
know the reason why.

    outer.then(onFulfill, onReject)

must invoke onReject(inner), passing the inner promise as the reason,
without waiting for the inner promise to resolve.



On Wed, Jun 5, 2013 at 5:56 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Thu, Jun 6, 2013 at 9:51 AM, Sean Hogan <shogun70@westnet.com.au>
> wrote:
> > Should the spec continue to allow this behavior?
> >
> > or ...
> >
> > Should the resolve algorithm - which is currently infinite unwrap for
> > accepted / fulfilled futures - also be infinite unwrap for rejected
> futures?
>
> I'm satisfied with either behavior.  It might be nice to have it
> mirror the then/chain behavior, where it fully-unwraps or
> single-unwraps as appropriate, but I'd likely be fine with both doing
> single-unwrapping or both doing full-unwrapping.
>
> ~TJ
>



-- 
    Cheers,
    --MarkM
Received on Thursday, 6 June 2013 01:12:04 UTC

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