Closed zenparsing closed 10 years ago
The for-of statement is expanded to enable iteration over async iterators.
Within an async function, we perform a nominal type check against the result of next
, throw
, or return
. If the result is a Promise, then we await the result. Otherwise, we assume it must be an IteratorResult
.
async function af() {
for (let line of readLines("some/file"))
console.log(line);
}
Should we create an async iteration statement? For example:
How important is such a statement?