proposal-iterator-helpers
proposal-iterator-helpers copied to clipboard
fixes #230: don't await non-objects returned from functions passed to AsyncIterator HoFs
Fixes #230. This is only observable in the number of ticks taken to complete the method. It is always at least 1 because the async iteration protocol itself requires awaiting the IteratorResult object, so no Zalgo issues.
Maybe makes sense somehow to extend it to awaiting only thenables? However, sure, it's not so simple and is controversial.
Why would we want to do this here when we don't do it for await itself?
It would be weird if a syntactic await did not in fact wait. But there's no syntactic await here.
No, but there's the equivalent of a return from an async function, which i'd expect to say the same.
It's true we could reasonably have had this fast-path there as well. Probably still could, for that matter.