Re: [whatwg/webidl] Add `async iterable<T>` type to WebIDL (PR #1397)

@lucacasonato commented on this pull request.



> +[=asynchronously iterable declaration=].
+
+Async iterables must not be used as the type of an [=attribute=] or [=constant=].
+
+There is no way to represent an async iterable value in IDL.
+
+<h5 id="idl-async-iterator-object" lt="async-iterator" dfn export>Async iterator objects</h5>
+
+An <dfn lt="async iterator" export>async iterator&lt;|T|&gt;</dfn> value is a reference to an object
+that can produce a sequence of values asynchronously. The async iterator value is parameterized by a
+type |T|, which defines the types of values produced by this async iterator.
+
+Async iterators, unlike sequences, do not have a fixed length and can be infinite. Values are
+asynchronously produced as the async iterator is iterated over.
+
+Async iterators are values, not types, and thus cannot be used as a type in IDL. They can only be

I moved it down to the JS language section, and added some other wording up here to express that IDL async iterables are themselves not being iterated over, but produce a value that is being iterated over (without referencing `[=async iterator=]`).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1397#discussion_r1696888687
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1397/review/2207566929@github.com>

Received on Tuesday, 30 July 2024 12:36:26 UTC