Cancelable promises proposal
Logan Smyth
loganfsmyth at gmail.com
Wed Aug 5 02:51:21 UTC 2015
Glen, sorry if this has been covered in other discussions, but it's not
clear to me so I wanted to ask. Are there some example use-cases where
being able to `.ignore` is preferable to having the promise reject? Promise
chains are about defining flows of data and I can't really see a case where
you'd want to disconnect a promise handler without informing promises
farther down the chain, like your `.then(log)` in your example. To me
anyway, the proposed `.ignore` seems like it adds boat-loads of complexity
with unclear goals.
Also to your question about adding multiple handlers, if that handler has
side-effects, then it would definitely cause bugs if the same promise were
returned for multiple calls to `.then` with the same callback.
On Tue, Aug 4, 2015 at 5:32 PM, Glen Huang <curvedmark at gmail.com> wrote:
>
> On Aug 4, 2015, at 1:32 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com>
> wrote:
>
> only promises that has passed through their initialization the callback
> would be cancelable,and this could be reflected through a `.cancelable`
> property
>
>
> That's precisely the problem. When you made a mistake and thought a
> function should have the ability to abort, you wouldn't reflect
> that `.cancelable` property, you would simply call abort(). Passing a
> different object makes this less likely to happen since it's not thenable.
>
>
> and pragmatists would never find out what should be the behavior once
> aborted 'cause Promise can only reject and never be ignored.
>
>
> What do you think of the ignore() method I proposed?
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150804/8fa89fbd/attachment.html>
More information about the es-discuss
mailing list