Skip to content

Commit a8b10f5

Browse files
authored
Change async_iterable<> type to async_sequence<> and async iterable<> declaration to async_iterable<>
This makes them more distinguishable from each other and prevents future LL(1) issues for declarations. Closes #1504.
1 parent 0b5f9dc commit a8b10f5

File tree

1 file changed

+60
-60
lines changed

1 file changed

+60
-60
lines changed

index.bs

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ The type of the attribute, after resolving typedefs, must not be a
16921692
[=nullable type|nullable=] or non-nullable version of any of the following types:
16931693

16941694
* a [=sequence type=]
1695-
* an [=async iterable type=]
1695+
* an [=async sequence type=]
16961696
* a [=dictionary type=]
16971697
* a [=record type=]
16981698
* a [=union type=]
@@ -3382,7 +3382,7 @@ the following algorithm returns <i>true</i>.
33823382
<th><div><span>interface-like</span></div>
33833383
<th><div><span>callback function</span></div>
33843384
<th><div><span>dictionary-like</span></div>
3385-
<th><div><span>async iterable</span></div>
3385+
<th><div><span>async sequence</span></div>
33863386
<th><div><span>sequence-like</span></div>
33873387
</thead>
33883388
<tr>
@@ -3526,7 +3526,7 @@ the following algorithm returns <i>true</i>.
35263526
<td>●
35273527
<td>●
35283528
<tr>
3529-
<th>async iterable
3529+
<th>async sequence
35303530
<td class="belowdiagonal">
35313531
<td class="belowdiagonal">
35323532
<td class="belowdiagonal">
@@ -3574,7 +3574,7 @@ the following algorithm returns <i>true</i>.
35743574
converted to a dictionary-like type.
35753575
</div>
35763576
1. The types are distinguishable, but when converting from an ECMAScript value,
3577-
a [=string object=] is never converted to an [=async iterable type=]
3577+
a [=string object=] is never converted to an [=async sequence type=]
35783578
(even if it has a {{%Symbol.iterator%}} method), if a [=string type=]
35793579
is also in the overload set or union.
35803580
</ol>
@@ -4130,10 +4130,10 @@ An [=interface=] can be declared to be asynchronously iterable by using an
41304130

41314131
<pre highlight="webidl" class="syntax">
41324132
interface interface_identifier {
4133-
async iterable&lt;value_type&gt;;
4134-
async iterable&lt;value_type&gt;(/* arguments... */);
4135-
async iterable&lt;key_type, value_type&gt;;
4136-
async iterable&lt;key_type, value_type&gt;(/* arguments... */);
4133+
async_iterable&lt;value_type&gt;;
4134+
async_iterable&lt;value_type&gt;(/* arguments... */);
4135+
async_iterable&lt;key_type, value_type&gt;;
4136+
async_iterable&lt;key_type, value_type&gt;(/* arguments... */);
41374137
};
41384138
</pre>
41394139

@@ -4212,7 +4212,7 @@ or [=regular operations=] with these names.
42124212
interface SessionManager {
42134213
Session getSessionForUser(DOMString username);
42144214

4215-
async iterable&lt;DOMString, Session&gt;;
4215+
async_iterable&lt;DOMString, Session&gt;;
42164216
};
42174217

42184218
[Exposed=Window]
@@ -4306,7 +4306,7 @@ When they are, the effect will be as you would expect.
43064306

43074307
<pre class="grammar" id="prod-AsyncIterable">
43084308
AsyncIterable :
4309-
"async" "iterable" "&lt;" TypeWithExtendedAttributes OptionalType "&gt;" OptionalArgumentList ";"
4309+
"async_iterable" "&lt;" TypeWithExtendedAttributes OptionalType "&gt;" OptionalArgumentList ";"
43104310
</pre>
43114311

43124312
<pre class="grammar" id="prod-OptionalArgumentList">
@@ -5728,7 +5728,7 @@ are known as <dfn id="dfn-object-type" export>object types</dfn>.
57285728
StringType Null
57295729
identifier Null
57305730
"sequence" "&lt;" TypeWithExtendedAttributes "&gt;" Null
5731-
"async_iterable" "&lt;" TypeWithExtendedAttributes "&gt;" Null
5731+
"async_sequence" "&lt;" TypeWithExtendedAttributes "&gt;" Null
57325732
"object" Null
57335733
"symbol" Null
57345734
BufferRelatedType Null
@@ -6223,32 +6223,32 @@ only [=list/items=] that are of type |T|.
62236223

62246224
<!-- Note: if we ever add synchronous iterable types, we should add a note here about why sequences and iterables are not the same. -->
62256225

6226-
<h4 id="idl-async-iterable-type" lt="async iterable" dfn export>Async iterable types — async iterable&lt;|T|&gt;</h4>
6226+
<h4 id="idl-async-iterable-type" lt="async_sequence|async sequence" dfn export>Async sequence types — async_sequence&lt;|T|&gt;</h4>
62276227

6228-
An <dfn lt="async iterable type" export>async iterable type</dfn> is a parameterized
6228+
An <dfn lt="async sequence type" export>async sequence type</dfn> is a parameterized
62296229
type whose values are references to objects that can produce an asynchronously iterable, possibly infinite,
62306230
sequence of values of type |T|.
62316231

62326232
Unlike [=sequences=], which are fixed-length lists where all values are known in advance, the asynchronously
6233-
iterable sequences created by async iterables are lazy. Their values may be produced asynchronously
6233+
iterable sequences created by async sequences are lazy. Their values may be produced asynchronously
62346234
only during iteration, and thus the values or length might not be known at the time the async
6235-
iterable is created.
6235+
sequence is created.
62366236

6237-
Async iterables are passed by reference in language bindings where they are represented by an object.
6238-
This means that passing an async iterable to a [=platform object=] will result in a reference to the
6239-
async iterable being kept by that object. Similarly, any async iterable returned from a platform
6237+
Async sequences are passed by reference in language bindings where they are represented by an object.
6238+
This means that passing an async sequence to a [=platform object=] will result in a reference to the
6239+
async sequence being kept by that object. Similarly, any async sequence returned from a platform
62406240
object will be a reference to the same object and modifications made to it will be visible to the
62416241
platform object. This is in contrast to sequences, which are always passed by value.
62426242

6243-
Note: Async iterables cannot be constructed from IDL. If returned from an operation, or used as the
6244-
type of a dictionary member, the async iterable will have originated from the host environment and
6245-
have been turned into an IDL type via a language binding. Instead of returning an async iterable
6243+
Note: Async sequences cannot be constructed from IDL. If returned from an operation, or used as the
6244+
type of a dictionary member, the async sequence will have originated from the host environment and
6245+
have been turned into an IDL type via a language binding. Instead of returning an async sequence
62466246
from an IDL operation, the operation might want to return an [=interface=] that has an
62476247
[=asynchronously iterable declaration=].
62486248

6249-
Async iterables must not be used as the type of an [=attribute=] or [=constant=].
6249+
Async sequences must not be used as the type of an [=attribute=] or [=constant=].
62506250

6251-
There is no way to represent an async iterable value in IDL.
6251+
There is no way to represent an async sequence value in IDL.
62526252

62536253
<h4 id="idl-record" lt="record" dfn export>Record types — record&lt;|K|, |V|&gt;</h4>
62546254

@@ -8184,44 +8184,44 @@ JavaScript Array values.
81848184
</div>
81858185

81868186

8187-
<h4 id="js-async-iterable">Async iterablesasync iterable&lt;|T|&gt;</h4>
8187+
<h4 id="js-async-iterable">Async sequencesasync_sequence&lt;|T|&gt;</h4>
81888188

8189-
In the JavaScript binding, IDL [=async iterable type|async iterable=] values are represented by
8189+
In the JavaScript binding, IDL [=async sequence type|async sequence=] values are represented by
81908190
a [=struct=] with the following [=struct/items=]:
81918191

8192-
* <dfn for="JS async iterable">object</dfn>, a JavaScript value
8193-
* <dfn for="JS async iterable">method</dfn>, a JavaScript value
8194-
* <dfn for="JS async iterable">type</dfn>, either "<code>sync</code>" or "<code>async</code>"
8192+
* <dfn for="JS async sequence">object</dfn>, a JavaScript value
8193+
* <dfn for="JS async sequence">method</dfn>, a JavaScript value
8194+
* <dfn for="JS async sequence">type</dfn>, either "<code>sync</code>" or "<code>async</code>"
81958195

81968196

8197-
<div id="js-to-async-iterable" algorithm="convert a JavaScript value to async iterable">
8197+
<div id="js-to-async-iterable" algorithm="convert a JavaScript value to async sequence">
81988198
A JavaScript value |V| is [=converted to an IDL value|converted=]
8199-
to an IDL <a lt="async iterable">async iterable&lt;<var ignore>T</var>&gt;</a> value as follows:
8199+
to an IDL <a lt="async sequence">async_sequence&lt;<var ignore>T</var>&gt;</a> value as follows:
82008200

82018201
1. If |V| [=is not an Object=], then
82028202
[=JavaScript/throw=] a <l spec=ecmascript>{{TypeError}}</l>.
82038203
1. Let |method| be [=?=] <a abstract-op>GetMethod</a>(obj, {{%Symbol.asyncIterator%}}).
82048204
1. If |method| is <emu-val>undefined</emu-val>:
82058205
1. Set |syncMethod| to [=?=] <a abstract-op>GetMethod</a>(obj, {{%Symbol.iterator%}}).
82068206
1. If |syncMethod| is undefined, [=JavaScript/throw=] a <l spec=ecmascript>{{TypeError}}</l>.
8207-
1. Return an IDL [=async iterable=] value with [=JS async iterable/object=] set to |V|,
8208-
[=JS async iterable/method=] set to |syncMethod|, and [=JS async iterable/type=] set to
8207+
1. Return an IDL [=async sequence=] value with [=JS async sequence/object=] set to |V|,
8208+
[=JS async sequence/method=] set to |syncMethod|, and [=JS async sequence/type=] set to
82098209
"<code>sync</code>".
8210-
1. Return an IDL [=async iterable=] value with [=JS async iterable/object=] set to |V|,
8211-
[=JS async iterable/method=] set to |method|, and [=JS async iterable/type=] set to
8210+
1. Return an IDL [=async sequence=] value with [=JS async sequence/object=] set to |V|,
8211+
[=JS async sequence/method=] set to |method|, and [=JS async sequence/type=] set to
82128212
"<code>async</code>".
82138213
</div>
82148214

8215-
<div id="async-iterable-to-js" algorithm="convert an async iterable to a JavaScript value">
8216-
An IDL <a lt="async iterable">async iterable&lt;<var ignore>T</var>&gt;</a> value |V| is
8215+
<div id="async-sequence-to-js" algorithm="convert an async sequence to a JavaScript value">
8216+
An IDL <a lt="async sequence">async_sequence&lt;<var ignore>T</var>&gt;</a> value |V| is
82178217
[=converted to a JavaScript value|converted=] to a JavaScript object as follows:
82188218

8219-
1. Return |V|'s [=JS async iterable/object=].
8219+
1. Return |V|'s [=JS async sequence/object=].
82208220
</div>
82218221

8222-
<h5 id="js-async-iterator-iteration">Iterating async iterators</h5>
8222+
<h5 id="js-async-sequence-iteration">Iterating async sequences</h5>
82238223

8224-
An [=async iterable=] is not directly iterated over. Instead, it is first opened to create
8224+
An [=async sequence=] is not directly iterated over. Instead, it is first opened to create
82258225
an [=async iterator=]. The [=async iterator=] can be asynchronously iterated over to produce values.
82268226

82278227
<dfn lt="async iterator" export>Async iterators</dfn> are [=structs=] with the following [=struct/items=]:
@@ -8230,12 +8230,12 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
82308230

82318231
<div algorithm>
82328232

8233-
To <dfn id="async-iterable-open" export lt="open an async iterable">open</dfn> an
8234-
<code><a lt="async iterable type">async iterable&lt;<var>T</var>&gt;</a></code> |iterable|:
8233+
To <dfn id="async-sequence-open" export lt="open an async sequence">open</dfn> an
8234+
<code><a lt="async sequence type">async_sequence&lt;<var>T</var>&gt;</a></code> |sequence|:
82358235

8236-
1. Let |iterator| be [=?=] <a abstract-op>GetIteratorFromMethod</a>(|iterable|'s
8237-
[=JS async iterable/object=], |iterable|'s [=JS async iterable/method=]).
8238-
1. If |iterable|'s [=JS async iterable/type=] is "<code>sync</code>", set |iterator| to
8236+
1. Let |iterator| be [=?=] <a abstract-op>GetIteratorFromMethod</a>(|sequence|'s
8237+
[=JS async sequence/object=], |sequence|'s [=JS async sequence/method=]).
8238+
1. If |sequence|'s [=JS async sequence/type=] is "<code>sync</code>", set |iterator| to
82398239
<a abstract-op>CreateAsyncFromSyncIterator</a>(|iterator|).
82408240
1. Return an [=async iterator=] value with [=JS async iterator/underlying record=] set to |iterator| and
82418241
[=JS async iterator/type parameter=] set to |T|.
@@ -8294,28 +8294,28 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
82948294

82958295
</div>
82968296

8297-
<div class="example" id="example-js-async-iterable">
8297+
<div class="example" id="example-js-async-sequence">
82988298

82998299
<code>concatN</code> is an [=operation=] that returns a promise that will be fulfilled with the
8300-
concatenation of all the strings yielded by the async iterable passed to it. It stops
8301-
concatenating and closes the iterator once the async iterable has yielded <var ignore>maxN</var>
8300+
concatenation of all the strings yielded by the async sequence passed to it. It stops
8301+
concatenating and closes the iterator once the async sequence has yielded <var ignore>maxN</var>
83028302
strings.
83038303

83048304
<pre>
83058305
interface I {
8306-
Promise&lt;DOMString> concatN(async iterable&lt;DOMString> strings, unsigned long maxN);
8306+
Promise&lt;DOMString> concatN(async_sequence&lt;DOMString> strings, unsigned long maxN);
83078307
};
83088308
</pre>
83098309

83108310
<div algorithm="concatN">
83118311

8312-
The <code>concatN(|iterable|, |maxN|)</code> method steps are:
8312+
The <code>concatN(|sequence|, |maxN|)</code> method steps are:
83138313

83148314
1. Let |promise| be [=a new promise=].
83158315
1. Let |result| be the empty string.
83168316
1. Let |n| be 0.
8317-
1. Let |iterator| be the result of <a lt="open an async iterable">opening</a> |iterable|.
8318-
1. Let |step| be a sequence of steps that will be used to process the async iterable:
8317+
1. Let |iterator| be the result of <a lt="open an async sequence">opening</a> |sequence|.
8318+
1. Let |step| be a sequence of steps that will be used to process the async sequence:
83198319
1. Let |next| be the result of <a lt="get an async iterator next value">getting the next value</a> of |iterator|.
83208320
1. [=React=] to |next|:
83218321
- If |next| was fulfilled with value |v|:
@@ -8906,18 +8906,18 @@ that correspond to the union's [=member types=].
89068906
1. If |types| includes {{object}}, then return the IDL value
89078907
that is a reference to the object |V|.
89088908
1. If |V| [=is an Object=], then:
8909-
1. If |types| includes an [=async iterable type=], then
8909+
1. If |types| includes an [=async sequence type=], then
89108910
1. If |types| does not include a [=string type=] or |V| does not have a \[[StringData]] [=/internal slot=], then
89118911
1. Let |asyncMethod| be [=?=] <a abstract-op>GetMethod</a>(|V|, {{%Symbol.asyncIterator%}}).
89128912
1. If |asyncMethod| is not <emu-val>undefined</emu-val>,
8913-
return an IDL [=async iterable=] value with [=JS async iterable/object=]
8914-
set to |V|, [=JS async iterable/method=] set to |syncMethod|, and
8915-
[=JS async iterable/type=] set to "<code>async</code>".
8913+
return an IDL [=async sequence=] value with [=JS async sequence/object=]
8914+
set to |V|, [=JS async sequence/method=] set to |syncMethod|, and
8915+
[=JS async sequence/type=] set to "<code>async</code>".
89168916
1. Let |syncMethod| be [=?=] <a abstract-op>GetMethod</a>(|V|, {{%Symbol.iterator%}}).
89178917
1. If |syncMethod| is not <emu-val>undefined</emu-val>,
8918-
return an IDL [=async iterable=] value with [=JS async iterable/object=]
8919-
set to |V|, [=JS async iterable/method=] set to |syncMethod|, and
8920-
[=JS async iterable/type=] set to "<code>sync</code>".
8918+
return an IDL [=async sequence=] value with [=JS async sequence/object=]
8919+
set to |V|, [=JS async sequence/method=] set to |syncMethod|, and
8920+
[=JS async sequence/type=] set to "<code>sync</code>".
89218921
1. If |types| includes a [=sequence type=], then
89228922
1. Let |method| be [=?=] <a abstract-op>GetMethod</a>(|V|, {{%Symbol.iterator%}}).
89238923
1. If |method| is not <emu-val>undefined</emu-val>,
@@ -11492,7 +11492,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
1149211492
1. Otherwise: if |V| [=is an Object=] and
1149311493
there is an entry in |S| that has one of the
1149411494
following types at position |i| of its type list,
11495-
* an [=async iterable type=]
11495+
* an [=async sequence type=]
1149611496
* a [=nullable type|nullable=] version of any of the above types
1149711497
* an [=annotated type=] whose [=annotated types/inner type=] is one of the above types
1149811498
* a [=union type=], [=nullable type|nullable=] union type, or [=annotated type|annotated=] union type
@@ -11682,7 +11682,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
1168211682
Generally, the inspection of the value at the distinguishing argument index does not have any
1168311683
side effects, and the only side effects in the overload resolution algorithm are the result of
1168411684
converting the JavaScript values to IDL values.
11685-
(An exception exists when one of the overloads has an [=async iterable type=], [=sequence type=]
11685+
(An exception exists when one of the overloads has an [=async sequence type=], [=sequence type=]
1168611686
or [=frozen array type=] at the distinguishing argument index.
1168711687
In this case, we attempt to get the {{%Symbol.asyncIterator%}} / {{%Symbol.iterator%}} property
1168811688
to determine the appropriate overload, and perform the conversion of the distinguishing argument

0 commit comments

Comments
 (0)