Skip to content

Commit

Permalink
docs: Update history/explainer with resolution of #19
Browse files Browse the repository at this point in the history
  • Loading branch information
js-choi committed Jul 17, 2022
1 parent 304bbe9 commit 3f26c95
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
12 changes: 11 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ Presented to [plenary meeting as an update on 2021-10-26][2021-10-26].

# 2021-12
Presented to [plenary meeting for Stage 2 on 2021-12-14][2021-12-14].
Was rejected due to need to clarify awaiting semantics
Was rejected due to need to clarify `await`ing semantics
with and without mapping-function arguments.

# 2022-07
Discussion occurred about `await`ing semantics and mapping functions in [issue
#19][]. It was eventually decided to match `for await` and the proposed
[AsyncIterator.prototype.toArray][iterator-helpers] by `await`ing values from
input sync iterators once, `await`ing values from input async iterators not at
all, and `await`ing results returned by mapping functions once.

[2021-08-31]: https://github.com/tc39/notes/blob/HEAD/meetings/2021-08/aug-31.md
[2021-10-26]: https://github.com/tc39/notes/blob/HEAD/meetings/2021-10/oct-26.md#arrayfromasync-update
[2021-12-14]: https://github.com/tc39/notes/blob/HEAD/meetings/2021-12/dec-14.md#arrayfromasync-for-stage-2
[issue #19]: https://github.com/tc39/proposal-array-from-async/issues/19
[iterator-helpers]: https://github.com/tc39/proposal-iterator-helpers
[iterator-helpers#168]: https://github.com/tc39/proposal-iterator-helpers/issues/168
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,24 @@ Array.fromAsync([], 1);
The [iterator-helpers][] proposal has toArray, which works with both sync and
async iterables.
[iterator-helpers]: https://github.com/tc39/proposal-iterator-helpers
```js
Array.from(gen())
gen().toArray()
Array.fromAsync(asyncGen())
asyncGen().toArray()
// Array.from

Array.from(input)
Iterator(input).toArray()

Array.from(input, mapfn)
Iterator(input).map(mapfn).toArray()

// Array.asyncFrom

Array.fromAsync(input)
AsyncIterator(input).toArray()

Array.fromAsync(input, mapfn)
AsyncIterator(input).map(mapfn).toArray()
```
toArray overlaps with both Array.from and Array.fromAsync. This is okay. They
Expand All @@ -422,7 +435,6 @@ something one element at a time is the same as building it [more than one]
element at a time, but sometimes it could be slow to build that way or produce
a structure with equivalent semantics but different performance properties.”
[iterator-helpers]: https://github.com/tc39/proposal-iterator-helpers
[tc39/proposal-iterator-helpers#156]: https://github.com/tc39/proposal-iterator-helpers/issues/156.
### TypedArray.fromAsync, Set.fromAsync, Object.fromEntriesAsync, etc.
Expand Down

0 comments on commit 3f26c95

Please sign in to comment.