Re: Proposal for Promise.prototype.flatten

2019-04-24 Thread Bergi
Hello, I oppose this proposal. In my opinion, mixing normal exceptions (promise rejections) with result-error-tuples is rather inconsistent than a more consistent interface. The only thing it might interface better with are node.js-style callbacks, but we already deprecated those in favour of

Re: Proposal for Promise.prototype.flatten

2019-04-24 Thread Jordan Harband
Would this not work? async function test(promise1, promise2, promise3) { const val1 = await promise1.catch(); // ignore exceptions const [val2, val3] = [] = await Promise.all([promise2, promise3]).catch(); await Promise.all([promise1, promise2, promise3]); // throw to caller return val1

Re: Proposal for Promise.prototype.flatten

2019-04-23 Thread guest271314
The term "flatten" or "flatmap" has also been used to refer to "flattening" a nested array; and/or "flattening" (output) of a potentially (arbitrarily) nested data structure (synchronous and asynchronous input/output). "easier to read" is subjective; depends on the expectations of the reader.

Proposal for Promise.prototype.flatten

2019-04-23 Thread Aaron Silvas
https://github.com/asilvas/proposal-promise-flatten Looking for interest, and TC39 champion. The basic idea is to provide a simpler, more consistent interface, and easier to read code over using try/catches for async code paths. Regardless of which errors are handled or ignored, it's treated as