Skip to content

Commit 41c6e63

Browse files
authored
Use an "end of iteration" signal instead of undefined
The use of undefined as a sentinel for the end of iteration was problematic for value iterators, where the possible value space could contain undefined.
1 parent 4a3c045 commit 41c6e63

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

index.bs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,13 +4354,13 @@ Prose accompanying an [=interface=] with an [=asynchronously iterable declaratio
43544354
<dfn id="dfn-get-the-next-iteration-result" export>get the next iteration result</dfn> algorithm.
43554355
This algorithm receives the instance of the [=interface=] that is being iterated, as well as the
43564356
async iterator itself (which can be useful for storing state).
4357-
It must return a {{Promise}} that either rejects, resolves with undefined to signal the end of the
4358-
iteration, or resolves with one of the following:
4357+
It must return a {{Promise}} that either rejects, resolves with a special <dfn export>end of
4358+
iteration</dfn> value to signal the end of the iteration, or resolves with one of the following:
43594359

43604360
: for [=value asynchronously iterable declarations=]:
43614361
:: a value of the type given in the declaration;
43624362
: for [=pair asynchronously iterable declarations=]:
4363-
:: a tuple containing a value of the first type given in the declaration, and a value of the second type given in the declaration.
4363+
:: a [=pair=] containing a value of the first type given in the declaration, and a value of the second type given in the declaration.
43644364

43654365
The prose may also define an <dfn export>asynchronous iterator return</dfn> algorithm. This
43664366
algorithm receives the instance of the [=interface=] that is being iterated, the async iterator
@@ -4434,7 +4434,7 @@ or have any [=inherited interfaces=] that have [=interface members=] with these
44344434
Note: |iterator|'s [=SessionManager async iterator/current state=] might no longer be
44354435
present in the open sessions.
44364436
1. If |key| is null, then:
4437-
1. Resolve |promise| with undefined.
4437+
1. Resolve |promise| with [=end of iteration=].
44384438
1. Otherwise:
44394439
1. Let |session| be the <code class="idl">Session</code> object corresponding to |key|.
44404440
1. Resolve |promise| with (|username|, |session|).
@@ -12531,7 +12531,7 @@ The \[[Prototype]] [=internal slot=] of an [=asynchronous iterator prototype obj
1253112531
1. Let |fulfillSteps| be the following steps, given |next|:
1253212532
1. Set |object|'s [=default asynchronous iterator object/ongoing promise=] to
1253312533
null.
12534-
1. If |next| is <emu-val>undefined</emu-val>, then:
12534+
1. If |next| is [=end of iteration=], then:
1253512535
1. Set |object|'s [=default asynchronous iterator object/is finished=] to true.
1253612536
1. Return [=!=] [$CreateIterResultObject$](<emu-val>undefined</emu-val>,
1253712537
<emu-val>true</emu-val>).

0 commit comments

Comments
 (0)