javascript – 为什么等待*从async/await提案中删除?

它似乎记录的唯一地方是this issue threadthe actual specification.但是,删除的原因并没有张贴在我能找到的任何地方.


好了,自述文件before it was removed的最新版本已经提到了该段落中的所有内容:

await* and parallelism

In generators, both yield and yield* can be used. In async
functions, only await is allowed. The direct analogoue of yield*
does not make sense in async functions because it would need to
repeatedly await the inner operation, but does not know what value to
pass into each await (for yield*, it just passes in undefined
because iterators do not accept incoming values).

It has been suggested that the syntax could be reused for different
semantics – sugar for Promise.all. This would accept a value that is
an array of Promises, and would (asynchronously) return an array of
values returned by the promises. This is expected to be one of the
most common Promise-related oprerations that would not yet have syntax
sugar after the core of this proposal is available.



您可以查看issue 8issue 29中的讨论.

最后,关于更强大武器(并行性)的建议仍在进行中.查看async iteration,async generatorsobservables.可能有一些可以使用await *关键字比简单的promises数组更好.

async / await提议是最小的,只引入必要的原语.关于可能的扩展没有自行决定,应该单独讨论.

转载注明原文:javascript – 为什么等待*从async/await提案中删除? - 代码日志