Re: Promises: final steps

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:15:56 UTC