From ef043c8b4ef0f426350d06137b4ba5e6f779a4b6 Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Fri, 11 Jul 2025 14:34:08 -0700 Subject: [PATCH 1/4] Update all examples, and the lt for the type, to the new underscore'd token --- index.bs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.bs b/index.bs index 7e164e55..020deb8c 100644 --- a/index.bs +++ b/index.bs @@ -4129,10 +4129,10 @@ An [=interface=] can be declared to be asynchronously iterable by using an
     interface interface_identifier {
-      async iterable<value_type>;
-      async iterable<value_type>(/* arguments... */);
-      async iterable<key_type, value_type>;
-      async iterable<key_type, value_type>(/* arguments... */);
+      async_iterable<value_type>;
+      async_iterable<value_type>(/* arguments... */);
+      async_iterable<key_type, value_type>;
+      async_iterable<key_type, value_type>(/* arguments... */);
     };
 
@@ -4211,7 +4211,7 @@ or [=regular operations=] with these names. interface SessionManager { Session getSessionForUser(DOMString username); - async iterable<DOMString, Session>; + async_iterable<DOMString, Session>; }; [Exposed=Window] @@ -6222,7 +6222,7 @@ only [=list/items=] that are of type |T|. -

Async iterable types — async iterable<|T|>

+

Async iterable types — async iterable<|T|>

An async iterable type is a parameterized type whose values are references to objects that can produce an asynchronously iterable, possibly infinite, @@ -8230,7 +8230,7 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
To open an - async iterable<T> |iterable|: + async_iterable<T> |iterable|: 1. Let |iterator| be [=?=] GetIteratorFromMethod(|iterable|'s [=JS async iterable/object=], |iterable|'s [=JS async iterable/method=]). @@ -8302,7 +8302,7 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
         interface I {
-          Promise<DOMString> concatN(async iterable<DOMString> strings, unsigned long maxN);
+          Promise<DOMString> concatN(async_iterable<DOMString> strings, unsigned long maxN);
         };
     
From fa6f34acaa23a3009c6ab991ac7ce1ff4c0630eb Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Wed, 16 Jul 2025 16:40:38 -0700 Subject: [PATCH 2/4] Switch the value type to 'async sequence<>'. Undo the incorrect changes to the declaration. --- index.bs | 116 +++++++++++++++++++++++++++---------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/index.bs b/index.bs index 020deb8c..843dfc43 100644 --- a/index.bs +++ b/index.bs @@ -1691,7 +1691,7 @@ The type of the attribute, after resolving typedefs, must not be a [=nullable type|nullable=] or non-nullable version of any of the following types: * a [=sequence type=] -* an [=async iterable type=] +* an [=async sequence type=] * a [=dictionary type=] * a [=record type=] * a [=union type=] @@ -3381,7 +3381,7 @@ the following algorithm returns true.
interface-like
callback function
dictionary-like
-
async iterable
+
async sequence
sequence-like
@@ -3525,7 +3525,7 @@ the following algorithm returns true. ● ● - async iterable + async sequence @@ -3573,7 +3573,7 @@ the following algorithm returns true. converted to a dictionary-like type.
1. The types are distinguishable, but when converting from an ECMAScript value, - a [=string object=] is never converted to an [=async iterable type=] + a [=string object=] is never converted to an [=async sequence type=] (even if it has a {{%Symbol.iterator%}} method), if a [=string type=] is also in the overload set or union. @@ -4129,10 +4129,10 @@ An [=interface=] can be declared to be asynchronously iterable by using an
     interface interface_identifier {
-      async_iterable<value_type>;
-      async_iterable<value_type>(/* arguments... */);
-      async_iterable<key_type, value_type>;
-      async_iterable<key_type, value_type>(/* arguments... */);
+      async iterable<value_type>;
+      async iterable<value_type>(/* arguments... */);
+      async iterable<key_type, value_type>;
+      async iterable<key_type, value_type>(/* arguments... */);
     };
 
@@ -4211,7 +4211,7 @@ or [=regular operations=] with these names. interface SessionManager { Session getSessionForUser(DOMString username); - async_iterable<DOMString, Session>; + async iterable<DOMString, Session>; }; [Exposed=Window] @@ -5727,7 +5727,7 @@ are known as object types. StringType Null identifier Null "sequence" "<" TypeWithExtendedAttributes ">" Null - "async_iterable" "<" TypeWithExtendedAttributes ">" Null + "async" "sequence" "<" TypeWithExtendedAttributes ">" Null "object" Null "symbol" Null BufferRelatedType Null @@ -6222,32 +6222,32 @@ only [=list/items=] that are of type |T|. -

Async iterable types — async iterable<|T|>

+

Async sequence types — async sequence<|T|>

-An async iterable type is a parameterized +An async sequence type is a parameterized type whose values are references to objects that can produce an asynchronously iterable, possibly infinite, sequence of values of type |T|. Unlike [=sequences=], which are fixed-length lists where all values are known in advance, the asynchronously -iterable sequences created by async iterables are lazy. Their values may be produced asynchronously +iterable sequences created by async sequences are lazy. Their values may be produced asynchronously only during iteration, and thus the values or length might not be known at the time the async -iterable is created. +sequence is created. -Async iterables are passed by reference in language bindings where they are represented by an object. -This means that passing an async iterable to a [=platform object=] will result in a reference to the -async iterable being kept by that object. Similarly, any async iterable returned from a platform +Async sequences are passed by reference in language bindings where they are represented by an object. +This means that passing an async sequence to a [=platform object=] will result in a reference to the +async sequence being kept by that object. Similarly, any async sequence returned from a platform object will be a reference to the same object and modifications made to it will be visible to the platform object. This is in contrast to sequences, which are always passed by value. -Note: Async iterables cannot be constructed from IDL. If returned from an operation, or used as the -type of a dictionary member, the async iterable will have originated from the host environment and -have been turned into an IDL type via a language binding. Instead of returning an async iterable +Note: Async sequences cannot be constructed from IDL. If returned from an operation, or used as the +type of a dictionary member, the async sequence will have originated from the host environment and +have been turned into an IDL type via a language binding. Instead of returning an async sequence from an IDL operation, the operation might want to return an [=interface=] that has an [=asynchronously iterable declaration=]. -Async iterables must not be used as the type of an [=attribute=] or [=constant=]. +Async sequences must not be used as the type of an [=attribute=] or [=constant=]. -There is no way to represent an async iterable value in IDL. +There is no way to represent an async sequence value in IDL.

Record types — record<|K|, |V|>

@@ -8183,19 +8183,19 @@ JavaScript Array values. -

Async iterables — async iterable<|T|>

+

Async sequences — async sequence<|T|>

-In the JavaScript binding, IDL [=async iterable type|async iterable=] values are represented by +In the JavaScript binding, IDL [=async sequence type|async sequence=] values are represented by a [=struct=] with the following [=struct/items=]: -* object, a JavaScript value -* method, a JavaScript value -* type, either "sync" or "async" +* object, a JavaScript value +* method, a JavaScript value +* type, either "sync" or "async"
A JavaScript value |V| is [=converted to an IDL value|converted=] - to an IDL async iterable<T> value as follows: + to an IDL async sequence<T> value as follows: 1. If |V| [=is not an Object=], then [=JavaScript/throw=] a {{TypeError}}. @@ -8203,24 +8203,24 @@ a [=struct=] with the following [=struct/items=]: 1. If |method| is undefined: 1. Set |syncMethod| to [=?=] GetMethod(obj, {{%Symbol.iterator%}}). 1. If |syncMethod| is undefined, [=JavaScript/throw=] a {{TypeError}}. - 1. Return an IDL [=async iterable=] value with [=JS async iterable/object=] set to |V|, - [=JS async iterable/method=] set to |syncMethod|, and [=JS async iterable/type=] set to + 1. Return an IDL [=async sequence=] value with [=JS async sequence/object=] set to |V|, + [=JS async sequence/method=] set to |syncMethod|, and [=JS async sequence/type=] set to "sync". - 1. Return an IDL [=async iterable=] value with [=JS async iterable/object=] set to |V|, - [=JS async iterable/method=] set to |method|, and [=JS async iterable/type=] set to + 1. Return an IDL [=async sequence=] value with [=JS async sequence/object=] set to |V|, + [=JS async sequence/method=] set to |method|, and [=JS async sequence/type=] set to "async".
-
- An IDL async iterable<T> value |V| is +
+ An IDL async sequence<T> value |V| is [=converted to a JavaScript value|converted=] to a JavaScript object as follows: - 1. Return |V|'s [=JS async iterable/object=]. + 1. Return |V|'s [=JS async sequence/object=].
-
Iterating async iterators
+
Iterating async sequences
-An [=async iterable=] is not directly iterated over. Instead, it is first opened to create +An [=async sequence=] is not directly iterated over. Instead, it is first opened to create an [=async iterator=]. The [=async iterator=] can be asynchronously iterated over to produce values. Async iterators are [=structs=] with the following [=struct/items=]: @@ -8229,12 +8229,12 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
- To open an - async_iterable<T> |iterable|: + To open an + async sequence<T> |sequence|: - 1. Let |iterator| be [=?=] GetIteratorFromMethod(|iterable|'s - [=JS async iterable/object=], |iterable|'s [=JS async iterable/method=]). - 1. If |iterable|'s [=JS async iterable/type=] is "sync", set |iterator| to + 1. Let |iterator| be [=?=] GetIteratorFromMethod(|sequence|'s + [=JS async sequence/object=], |sequence|'s [=JS async sequence/method=]). + 1. If |sequence|'s [=JS async sequence/type=] is "sync", set |iterator| to CreateAsyncFromSyncIterator(|iterator|). 1. Return an [=async iterator=] value with [=JS async iterator/underlying record=] set to |iterator| and [=JS async iterator/type parameter=] set to |T|. @@ -8293,28 +8293,28 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
-
+
concatN is an [=operation=] that returns a promise that will be fulfilled with the - concatenation of all the strings yielded by the async iterable passed to it. It stops - concatenating and closes the iterator once the async iterable has yielded maxN + concatenation of all the strings yielded by the async sequence passed to it. It stops + concatenating and closes the iterator once the async sequence has yielded maxN strings.
         interface I {
-          Promise<DOMString> concatN(async_iterable<DOMString> strings, unsigned long maxN);
+          Promise<DOMString> concatN(async sequence<DOMString> strings, unsigned long maxN);
         };
     
- The concatN(|iterable|, |maxN|) method steps are: + The concatN(|sequence|, |maxN|) method steps are: 1. Let |promise| be [=a new promise=]. 1. Let |result| be the empty string. 1. Let |n| be 0. - 1. Let |iterator| be the result of opening |iterable|. - 1. Let |step| be a sequence of steps that will be used to process the async iterable: + 1. Let |iterator| be the result of opening |sequence|. + 1. Let |step| be a sequence of steps that will be used to process the async sequence: 1. Let |next| be the result of getting the next value of |iterator|. 1. [=React=] to |next|: - If |next| was fulfilled with value |v|: @@ -8905,18 +8905,18 @@ that correspond to the union's [=member types=]. 1. If |types| includes {{object}}, then return the IDL value that is a reference to the object |V|. 1. If |V| [=is an Object=], then: - 1. If |types| includes an [=async iterable type=], then + 1. If |types| includes an [=async sequence type=], then 1. If |types| does not include a [=string type=] or |V| does not have a \[[StringData]] [=/internal slot=], then 1. Let |asyncMethod| be [=?=] GetMethod(|V|, {{%Symbol.asyncIterator%}}). 1. If |asyncMethod| is not undefined, - return an IDL [=async iterable=] value with [=JS async iterable/object=] - set to |V|, [=JS async iterable/method=] set to |syncMethod|, and - [=JS async iterable/type=] set to "async". + return an IDL [=async sequence=] value with [=JS async sequence/object=] + set to |V|, [=JS async sequence/method=] set to |syncMethod|, and + [=JS async sequence/type=] set to "async". 1. Let |syncMethod| be [=?=] GetMethod(|V|, {{%Symbol.iterator%}}). 1. If |syncMethod| is not undefined, - return an IDL [=async iterable=] value with [=JS async iterable/object=] - set to |V|, [=JS async iterable/method=] set to |syncMethod|, and - [=JS async iterable/type=] set to "sync". + return an IDL [=async sequence=] value with [=JS async sequence/object=] + set to |V|, [=JS async sequence/method=] set to |syncMethod|, and + [=JS async sequence/type=] set to "sync". 1. If |types| includes a [=sequence type=], then 1. Let |method| be [=?=] GetMethod(|V|, {{%Symbol.iterator%}}). 1. If |method| is not undefined, @@ -11491,7 +11491,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]] 1. Otherwise: if |V| [=is an Object=] and there is an entry in |S| that has one of the following types at position |i| of its type list, - * an [=async iterable type=] + * an [=async sequence type=] * a [=nullable type|nullable=] version of any of the above types * an [=annotated type=] whose [=annotated types/inner type=] is one of the above types * a [=union type=], [=nullable type|nullable=] union type, or [=annotated type|annotated=] union type @@ -11681,7 +11681,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]] Generally, the inspection of the value at the distinguishing argument index does not have any side effects, and the only side effects in the overload resolution algorithm are the result of converting the JavaScript values to IDL values. - (An exception exists when one of the overloads has an [=async iterable type=], [=sequence type=] + (An exception exists when one of the overloads has an [=async sequence type=], [=sequence type=] or [=frozen array type=] at the distinguishing argument index. In this case, we attempt to get the {{%Symbol.asyncIterator%}} / {{%Symbol.iterator%}} property to determine the appropriate overload, and perform the conversion of the distinguishing argument From fbcf7c8679742d29a509f81741be0d2ea11728ea Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Wed, 16 Jul 2025 17:20:06 -0700 Subject: [PATCH 3/4] 'async sequence' isn't LL(1), use 'async_sequence' instead. --- index.bs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.bs b/index.bs index 843dfc43..50af8a3d 100644 --- a/index.bs +++ b/index.bs @@ -5727,7 +5727,7 @@ are known as object types. StringType Null identifier Null "sequence" "<" TypeWithExtendedAttributes ">" Null - "async" "sequence" "<" TypeWithExtendedAttributes ">" Null + "async_sequence" "<" TypeWithExtendedAttributes ">" Null "object" Null "symbol" Null BufferRelatedType Null @@ -6222,7 +6222,7 @@ only [=list/items=] that are of type |T|. -

Async sequence types — async sequence<|T|>

+

Async sequence types — async_sequence<|T|>

An async sequence type is a parameterized type whose values are references to objects that can produce an asynchronously iterable, possibly infinite, @@ -8183,7 +8183,7 @@ JavaScript Array values.
-

Async sequences — async sequence<|T|>

+

Async sequences — async_sequence<|T|>

In the JavaScript binding, IDL [=async sequence type|async sequence=] values are represented by a [=struct=] with the following [=struct/items=]: @@ -8195,7 +8195,7 @@ a [=struct=] with the following [=struct/items=]:
A JavaScript value |V| is [=converted to an IDL value|converted=] - to an IDL async sequence<T> value as follows: + to an IDL async_sequence<T> value as follows: 1. If |V| [=is not an Object=], then [=JavaScript/throw=] a {{TypeError}}. @@ -8212,7 +8212,7 @@ a [=struct=] with the following [=struct/items=]:
- An IDL async sequence<T> value |V| is + An IDL async_sequence<T> value |V| is [=converted to a JavaScript value|converted=] to a JavaScript object as follows: 1. Return |V|'s [=JS async sequence/object=]. @@ -8230,7 +8230,7 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
To open an - async sequence<T> |sequence|: + async_sequence<T> |sequence|: 1. Let |iterator| be [=?=] GetIteratorFromMethod(|sequence|'s [=JS async sequence/object=], |sequence|'s [=JS async sequence/method=]). @@ -8302,7 +8302,7 @@ an [=async iterator=]. The [=async iterator=] can be asynchronously iterated ove
         interface I {
-          Promise<DOMString> concatN(async sequence<DOMString> strings, unsigned long maxN);
+          Promise<DOMString> concatN(async_sequence<DOMString> strings, unsigned long maxN);
         };
     
From 053e1b1fe1f53a085abd2cafdc4aaa14545e1828 Mon Sep 17 00:00:00 2001 From: "Tab Atkins Jr." Date: Sun, 20 Jul 2025 15:07:28 -0700 Subject: [PATCH 4/4] Switch `async iterable<>` to `async_iterable<>`, per issue discussion --- index.bs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.bs b/index.bs index 50af8a3d..fb5fd0e5 100644 --- a/index.bs +++ b/index.bs @@ -4129,10 +4129,10 @@ An [=interface=] can be declared to be asynchronously iterable by using an
     interface interface_identifier {
-      async iterable<value_type>;
-      async iterable<value_type>(/* arguments... */);
-      async iterable<key_type, value_type>;
-      async iterable<key_type, value_type>(/* arguments... */);
+      async_iterable<value_type>;
+      async_iterable<value_type>(/* arguments... */);
+      async_iterable<key_type, value_type>;
+      async_iterable<key_type, value_type>(/* arguments... */);
     };
 
@@ -4211,7 +4211,7 @@ or [=regular operations=] with these names. interface SessionManager { Session getSessionForUser(DOMString username); - async iterable<DOMString, Session>; + async_iterable<DOMString, Session>; }; [Exposed=Window] @@ -4305,7 +4305,7 @@ When they are, the effect will be as you would expect.
     AsyncIterable :
-        "async" "iterable" "<" TypeWithExtendedAttributes OptionalType ">" OptionalArgumentList ";"
+        "async_iterable" "<" TypeWithExtendedAttributes OptionalType ">" OptionalArgumentList ";"
 
@@ -8193,7 +8193,7 @@ a [=struct=] with the following [=struct/items=]:
 * type, either "sync" or "async"
 
 
-
+
A JavaScript value |V| is [=converted to an IDL value|converted=] to an IDL async_sequence<T> value as follows: