nodejs / nodejs-zh-CN

node.js 中文化 & 中文社区
https://nodejs.org/zh-cn/
Other
394 stars 62 forks source link

Implement unhandled rejection tracking for promises #109

Closed fengmk2 closed 9 years ago

fengmk2 commented 9 years ago

https://github.com/iojs/io.js/pull/758

https://gist.github.com/benjamingr/0237932cee84712951a2

mattma commented 9 years ago

I agreed with what the author said. It should be added to Promise A+ specs. 这个是很多Promise libraries (like bluebird, q, rsvp, etc) 都遵守的守则.

Promise 还有另外一个致命的问题,就是无法取消正在运行中的 Promise,很多用户都提出了质疑,但是看来没有任何解决办法. 我自己也问过很多 JS and Node.js 牛人, 结果是无解。

fengmk2 commented 9 years ago

嗯,我一直不太喜欢 Promise。。

285858315 commented 9 years ago

不知道Dart是不是也有类似的问题?

willin commented 9 years ago

why? Promise原则解决了很多问题啊

popomore commented 9 years ago

es7 很多实现都基于 promise,还是逃不了

magicdawn commented 9 years ago

@mattma 看看 Mozila 出的Task.js,可以取消正在运行的Task

Promise的abort 可以用 reject 模拟吗,例如reject (new AbortError)

XadillaX commented 9 years ago

我还是比较喜欢旧式的回调机制。

gxcsoccer commented 9 years ago

有了generator后就没用过promise

magicdawn commented 9 years ago

@gxcsoccer 在用co吧? https://github.com/tj/co/blob/master/index.js#L49

gxcsoccer commented 9 years ago

@magicdawn 明白你的意思,我是说接口层面的