w3ctag / promises-guide

A guide for spec authors on how to use Promises in prose and WebIDL.
https://www.w3.org/2001/tag/doc/promises-guide
192 stars 24 forks source link

Add more advice on when not to use Promises #65

Open plinss opened 4 years ago

plinss commented 4 years ago

https://github.com/w3ctag/design-principles/issues/138 was caused by a use of Promises that were never expected to resolve. That API has since been redesigned. We should advise against using promises that only reject.

atanassov commented 4 years ago

@plinss and I discussed during our May 2020 virtual f2f. Reading through the original issue and current state of the promises spec we propose adding a new sub-section and recommend that promises are not be used if there is no clear path for completion under normal circumstances.

annevk commented 4 years ago

What's an example of something that almost always throws?

plinss commented 4 years ago

There was a (since changed) API design, IIRC for wake lock, where a promise was used that never resolved but only rejected. We're advising not to do that.