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

Re: Promises: final steps

From: Mark Miller <erights@gmail.com>
Date: Thu, 5 Sep 2013 13:15:29 -0400
Message-ID: <CAK5yZYiT9N3sX6P47Q-7sV9p8B9sTg3woOrE68KrpuqFbtb1Ug@mail.gmail.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
Cc: Kevin Smith <zenparsing@gmail.com>, Kris Kowal <kris.kowal@cixar.com>, "www-dom@w3.org" <www-dom@w3.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, es-discuss <es-discuss@mozilla.org>
On Thu, Sep 5, 2013 at 12:04 PM, Domenic Denicola <
domenic@domenicdenicola.com> wrote:

> From: Kevin Smith [zenparsing@gmail.com]
>
> > Indeed, for a non-GUI embedding like Node, they *must* be debuggable
> using just a console.
>
> This is an important point. A provisional idea that preserves our desire
> to not introduce new features to promises themselves, requiring user choice
> at authoring time, might be some kind of `console.unhandledRejections()`
> function which returns you a snapshot of the current unhandled rejections
> bucket.
>

That would be a global communications channel.



>
> > Another option is a static method which takes a promise and throws
> rejections ala done:
> >
> > ```js
> > Promise.throw(makeSomePromise.then(...));
> > ```
>
> I find these kind of things confusing. RSVP did something similar,
> introducing
>
> ```js
> RSVP.rethrow = r => setImmediate(() => throw r);
> ```
>
> so that you write
>
> ```js
> somePromise.then(...).catch(RSVP.rethrow); // actually RSVP uses `fail`.
> ```
>
> It's not clear to me why this, or your `Promise.throw`, is better than
>
> ```js
> somePromise.done(...)
> // or
> somePromise.then(...).done()
> ```
>

As I said, I think we will eventually add something that provides this or
similar functionality. But it does not need to be added to the subset this
repository seeks to define -- for the immediate needs of DOM. Since the
topic of this thread is "final steps", I'm just trying to be clear in this
context that this .done-ish issue is after these "final steps".

This is the kind of issue that is best decided after more experience with
several of these debugging aids, in both browser and server. So we should
of course continue to discuss these options on es-discuss regarding ES7.
Also, we won't have Weak References until ES7, and that bears on this
discussion and expected experience. FWIW, so far, I still like .done better
than the suggested alternatives.



> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
Text by me above is hereby placed in the public domain

  Cheers,
  --MarkM
Received on Thursday, 5 September 2013 17:16:03 UTC

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