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

@MattiasBuelens commented on this pull request.

Much better! Just a few small typos left, otherwise LGTM.

> +
+IDL <a lt="async iterable type">async iterable&lt;|T|&gt;</a> values are represented by a JavaScript
+object, a JavaScript method, and a flag indicating whether the method is expected to produce a
+<code>sync</code> or <code>async</code> iterator.
+
+<div id="js-to-async-iterable" algorithm="convert a JavaScript value to async iterable">
+    A JavaScript value |V| is [=converted to an IDL value|converted=]
+    to an IDL <a lt="async iterable type">async iterable&lt;<var ignore>T</var>&gt;</a> value as follows:
+
+    1.  If <a abstract-op>Type</a>(|V|) is not Object,
+        [=JavaScript/throw=] a <l spec=ecmascript>{{TypeError}}</l>.
+    1.  Let |method| be [=?=] <a abstract-op>GetMethod</a>(obj, %Symbol.asyncIterator%).
+    1.  If |method| is undefined:
+        1.  Set |syncMethod| to [=?=] <a abstract-op>GetMethod</a>(obj, %Symbol.iterator%).
+        1.  If |syncMethod| is undefined, [=JavaScript/throw=] a <l spec=ecmascript>{{TypeError}}</l>.
+        1   Return the IDL async iterable value that represents a reference to the JavaScript object

```suggestion
        1.  Return the IDL async iterable value that represents a reference to the JavaScript object
```

> +<h5 id="idl-async-iterator" lt="async-iterator" dfn export>Async iterators</h5>
+
+IDL <a lt="async-iterator">async-iterator</a> values are represented by JavaScript [=Iterator=]
+records.

```suggestion
<h5 id="idl-async-iterator" lt="async iterator" dfn export>Async iterators</h5>

IDL <a lt="async iterator">async iterator</a> values are represented by JavaScript [=Iterator=]
records.
```

> +
+<h5 id="idl-async-iterator" lt="async-iterator" dfn export>Async iterators</h5>
+
+IDL <a lt="async-iterator">async-iterator</a> values are represented by JavaScript [=Iterator=]
+records.
+
+Async iterators can only be created from an [=async iterable=] object.
+
+<h5 id="js-async-iterator-iteration">Iterating async iterator</h5>
+
+[=Async iterables=] are not directly iterated over. They are first opened, to create a new
+[=async iterator=], and then the [=async iterator=] is iterated over.
+
+<div algorithm>
+
+    To <dfn id="async-iterable-open" export lt="get an async iterable next value">get the next value</dfn> of an

```suggestion
    To <dfn id="async-iterable-open" export lt="open an async iterable">open</dfn> an
```

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

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

Received on Thursday, 18 July 2024 11:21:38 UTC