From d0e5feb46c175ae878648074a88e13fd5ce569b7 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Wed, 30 Oct 2024 22:38:09 -0700 Subject: [PATCH] Editorial: fix linking and change spelling of iterator interfaces (#3459) --- spec.html | 162 +++++++++++++++++++++++++++--------------------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/spec.html b/spec.html index 40a9f5fd25..7b7a588bc1 100644 --- a/spec.html +++ b/spec.html @@ -102,7 +102,7 @@

Introduction

Focused development of the sixth edition started in 2009, as the fifth edition was being prepared for publication. However, this was preceded by significant experimentation and language enhancement design efforts dating to the publication of the third edition in 1999. In a very real sense, the completion of the sixth edition is the culmination of a fifteen year effort. The goals for this edition included providing better support for large applications, library creation, and for use of ECMAScript as a compilation target for other languages. Some of its major enhancements included modules, class declarations, lexical block scoping, iterators and generators, promises for asynchronous programming, destructuring patterns, and proper tail calls. The ECMAScript library of built-ins was expanded to support additional data abstractions including maps, sets, and arrays of binary numeric values as well as additional support for Unicode supplementary characters in strings and regular expressions. The built-ins were also made extensible via subclassing. The sixth edition provides the foundation for regular, incremental language and library enhancements. The sixth edition was adopted by the General Assembly of June 2015.

ECMAScript 2016 was the first ECMAScript edition released under Ecma TC39's new yearly release cadence and open development process. A plain-text source document was built from the ECMAScript 2015 source document to serve as the base for further development entirely on GitHub. Over the year of this standard's development, hundreds of pull requests and issues were filed representing thousands of bug fixes, editorial fixes and other improvements. Additionally, numerous software tools were developed to aid in this effort including Ecmarkup, Ecmarkdown, and Grammarkdown. ES2016 also included support for a new exponentiation operator and adds a new method to `Array.prototype` called `includes`.

ECMAScript 2017 introduced Async Functions, Shared Memory, and Atomics along with smaller language and library enhancements, bug fixes, and editorial updates. Async functions improve the asynchronous programming experience by providing syntax for promise-returning functions. Shared Memory and Atomics introduce a new memory model that allows multi-agent programs to communicate using atomic operations that ensure a well-defined execution order even on parallel CPUs. It also included new static methods on Object: `Object.values`, `Object.entries`, and `Object.getOwnPropertyDescriptors`.

-

ECMAScript 2018 introduced support for asynchronous iteration via the AsyncIterator protocol and async generators. It also included four new regular expression features: the `dotAll` flag, named capture groups, Unicode property escapes, and look-behind assertions. Lastly it included object rest and spread properties.

+

ECMAScript 2018 introduced support for asynchronous iteration via the async iterator protocol and async generators. It also included four new regular expression features: the `dotAll` flag, named capture groups, Unicode property escapes, and look-behind assertions. Lastly it included object rest and spread properties.

ECMAScript 2019 introduced a few new built-in functions: `flat` and `flatMap` on `Array.prototype` for flattening arrays, `Object.fromEntries` for directly turning the return value of `Object.entries` into a new Object, and `trimStart` and `trimEnd` on `String.prototype` as better-named alternatives to the widely implemented but non-standard `String.prototype.trimLeft` and `trimRight` built-ins. In addition, it included a few minor updates to syntax and semantics. Updated syntax included optional catch binding parameters and allowing U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) in string literals to align with JSON. Other updates included requiring that `Array.prototype.sort` be a stable sort, requiring that `JSON.stringify` return well-formed UTF-8 regardless of input, and clarifying `Function.prototype.toString` by requiring that it either return the corresponding original source text or a standard placeholder.

ECMAScript 2020, the 11th edition, introduced the `matchAll` method for Strings, to produce an iterator for all match objects generated by a global regular expression; `import()`, a syntax to asynchronously import Modules with a dynamic specifier; `BigInt`, a new number primitive for working with arbitrary precision integers; `Promise.allSettled`, a new Promise combinator that does not short-circuit; `globalThis`, a universal way to access the global `this` value; dedicated `export * as ns from 'module'` syntax for use within modules; increased standardization of `for-in` enumeration order; `import.meta`, a host-populated object available in Modules that may contain contextual information about the Module; as well as adding two new syntax features to improve working with “nullish” values (*undefined* or *null*): nullish coalescing, a value selection operator; and optional chaining, a property access and function invocation operator that short-circuits if the value to access/invoke is nullish.

ECMAScript 2021, the 12th edition, introduced the `replaceAll` method for Strings; `Promise.any`, a Promise combinator that short-circuits when an input value is fulfilled; `AggregateError`, a new Error type to represent multiple errors at once; logical assignment operators (`??=`, `&&=`, `||=`); `WeakRef`, for referring to a target object without preserving it from garbage collection, and `FinalizationRegistry`, to manage registration and unregistration of cleanup operations performed when target objects are garbage collected; separators for numeric literals (`1_000`); and `Array.prototype.sort` was made more precise, reducing the amount of cases that result in an implementation-defined sort order.

@@ -1230,7 +1230,7 @@

The Symbol Type

Well-Known Symbols

Well-known symbols are built-in Symbol values that are explicitly referenced by algorithms of this specification. They are typically used as the keys of properties whose values serve as extension points of a specification algorithm. Unless otherwise specified, well-known symbols values are shared by all realms ().

Within this specification a well-known symbol is referred to using the standard intrinsic notation where the intrinsic is one of the values listed in .

- Previous editions of this specification used a notation of the form @@name, where the current edition would use `%Symbol.name%`. In particular, the following names were used: @@asyncIterator, @@hasInstance, @@isConcatSpreadable, @@iterator, @@match, @@matchAll, @@replace, @@search, @@species, @@split, @@toPrimitive, @@toStringTag, and @@unscopables. + Previous editions of this specification used a notation of the form @@name, where the current edition would use `%Symbol.name%`. In particular, the following names were used: @@asyncIterator, @@hasInstance, @@isConcatSpreadable, @@iterator, @@match, @@matchAll, @@replace, @@search, @@species, @@split, @@toPrimitive, @@toStringTag, and @@unscopables. @@ -1254,7 +1254,7 @@

Well-Known Symbols

*"Symbol.asyncIterator"* @@ -1287,7 +1287,7 @@

Well-Known Symbols

*"Symbol.iterator"* @@ -1309,7 +1309,7 @@

Well-Known Symbols

*"Symbol.matchAll"* @@ -3320,7 +3320,7 @@

Well-Known Intrinsic Objects

@@ -3674,7 +3674,7 @@

Well-Known Intrinsic Objects

@@ -3706,7 +3706,7 @@

Well-Known Intrinsic Objects

@@ -3858,7 +3858,7 @@

Well-Known Intrinsic Objects

@@ -3890,7 +3890,7 @@

Well-Known Intrinsic Objects

@@ -4041,7 +4041,7 @@

Well-Known Intrinsic Objects

- A method that returns the default AsyncIterator for an object. Called by the semantics of the `for`-`await`-`of` statement. + A method that returns the default async iterator for an object. Called by the semantics of the `for`-`await`-`of` statement.
- A method that returns the default Iterator for an object. Called by the semantics of the for-of statement. + A method that returns the default iterator for an object. Called by the semantics of the for-of statement.
- A regular expression method that returns an iterator, that yields matches of the regular expression against a string. Called by the `String.prototype.matchAll` method. + A regular expression method that returns an iterator that yields matches of the regular expression against a string. Called by the `String.prototype.matchAll` method.
- The prototype of Array iterator objects () + The prototype of Array Iterator objects ()
- The prototype of Iterator Helper Objects () + The prototype of Iterator Helper objects ()
- The prototype of Map iterator objects () + The prototype of Map Iterator objects ()
- The prototype of Set iterator objects () + The prototype of Set Iterator objects ()
- The prototype of String iterator objects () + The prototype of String Iterator objects ()
- The prototype of wrapped Iterator objects returned by Iterator.from () + The prototype of wrapped iterator objects returned by Iterator.from ()
@@ -6943,7 +6943,7 @@

Operations on Iterator Objects

Iterator Records

-

An Iterator Record is a Record value used to encapsulate an Iterator or AsyncIterator along with the `next` method.

+

An Iterator Record is a Record value used to encapsulate an iterator or async iterator along with the `next` method.

Iterator Records have the fields listed in .

@@ -6968,7 +6968,7 @@

Iterator Records

an Object @@ -7244,11 +7244,11 @@

CreateIteratorResultObject ( _value_: an ECMAScript language value, _done_: a Boolean, - ): an Object that conforms to the IteratorResult interface + ): an Object that conforms to the IteratorResult interface

description
-
It creates an object that conforms to the IteratorResult interface.
+
It creates an object that conforms to the IteratorResult interface.
1. Let _obj_ be OrdinaryObjectCreate(%Object.prototype%). @@ -7266,7 +7266,7 @@

description
-
It creates an Iterator () object record whose `next` method returns the successive elements of _list_.
+
It creates an Iterator Record whose [[NextMethod]] returns the successive elements of _list_.
1. Let _closure_ be a new Abstract Closure with no parameters that captures _list_ and performs the following steps when called: @@ -22421,12 +22421,12 @@

Runtime Semantics: Evaluation

EnumerateObjectProperties ( _O_: an Object, - ): an Iterator + ): an iterator object

- 1. Return an Iterator object () whose `next` method iterates over all the String-valued keys of enumerable properties of _O_. The iterator object is never directly accessible to ECMAScript code. The mechanics and order of enumerating the properties is not specified but must conform to the rules specified below. + 1. Return an iterator object whose `next` method iterates over all the String-valued keys of enumerable properties of _O_. The iterator object is never directly accessible to ECMAScript code. The mechanics and order of enumerating the properties is not specified but must conform to the rules specified below.

The iterator's `throw` and `return` methods are *null* and are never invoked. The iterator's `next` method processes object properties to determine whether the property key should be returned as an iterator value. Returned property keys do not include keys that are Symbols. Properties of the target object may be deleted during enumeration. A property that is deleted before it is processed by the iterator's `next` method is ignored. If new properties are added to the target object during enumeration, the newly added properties are not guaranteed to be processed in the active enumeration. A property name will be returned by the iterator's `next` method at most once in any enumeration.

Enumerating the properties of the target object includes enumerating properties of its prototype, and the prototype of the prototype, and so on, recursively; but a property of a prototype is not processed if it has the same name as a property that has already been processed by the iterator's `next` method. The values of [[Enumerable]] attributes are not considered when determining if a property of a prototype object has already been processed. The enumerable property names of prototype objects must be obtained by invoking EnumerateObjectProperties passing the prototype object as the argument. EnumerateObjectProperties must obtain the own property keys of the target object by calling its [[OwnPropertyKeys]] internal method. Property attributes of the target object must be obtained by calling its [[GetOwnProperty]] internal method.

@@ -22467,7 +22467,7 @@

For-In Iterator Objects

-

A For-In Iterator is an object that represents a specific iteration over some specific object. For-In Iterator objects are never directly accessible to ECMAScript code; they exist solely to illustrate the behaviour of EnumerateObjectProperties.

+

A For-In Iterator is an object that represents a specific iteration over some specific object. For-In Iterator objects are never directly accessible to ECMAScript code; they exist solely to illustrate the behaviour of EnumerateObjectProperties.

@@ -22493,7 +22493,7 @@

The %ForInIteratorPrototype% Object

The %ForInIteratorPrototype% object:

    -
  • has properties that are inherited by all For-In Iterator Objects.
  • +
  • has properties that are inherited by all For-In Iterator objects.
  • is an ordinary object.
  • has a [[Prototype]] internal slot whose value is %Iterator.prototype%.
  • is never directly accessible to ECMAScript code.
  • @@ -35631,7 +35631,7 @@

    String.prototype [ %Symbol.iterator% ] ( )

    -

    This method returns an Iterator object () that iterates over the code points of a String value, returning each code point as a String value.

    +

    This method returns an iterator object that iterates over the code points of a String value, returning each code point as a String value.

    It performs the following steps when called:

    1. Let _O_ be ? RequireObjectCoercible(*this* value). @@ -35666,13 +35666,13 @@

    length

    String Iterator Objects

    -

    A String Iterator is an object, that represents a specific iteration over some specific String instance object. There is not a named constructor for String Iterator objects. Instead, String iterator objects are created by calling certain methods of String instance objects.

    +

    A String Iterator is an object that represents a specific iteration over some specific String instance object. There is not a named constructor for String Iterator objects. Instead, String Iterator objects are created by calling certain methods of String instance objects.

    The %StringIteratorPrototype% Object

    The %StringIteratorPrototype% object:

      -
    • has properties that are inherited by all String Iterator Objects.
    • +
    • has properties that are inherited by all String Iterator objects.
    • is an ordinary object.
    • has a [[Prototype]] internal slot whose value is %Iterator.prototype%.
    • has the following properties:
    • @@ -38706,7 +38706,7 @@

      lastIndex

      RegExp String Iterator Objects

      -

      A RegExp String Iterator is an object, that represents a specific iteration over some specific String instance object, matching against some specific RegExp instance object. There is not a named constructor for RegExp String Iterator objects. Instead, RegExp String Iterator objects are created by calling certain methods of RegExp instance objects.

      +

      A RegExp String Iterator is an object that represents a specific iteration over some specific String instance object, matching against some specific RegExp instance object. There is not a named constructor for RegExp String Iterator objects. Instead, RegExp String Iterator objects are created by calling certain methods of RegExp instance objects.

      @@ -38741,7 +38741,7 @@

      The %RegExpStringIteratorPrototype% Object

      The %RegExpStringIteratorPrototype% object:

        -
      • has properties that are inherited by all RegExp String Iterator Objects.
      • +
      • has properties that are inherited by all RegExp String Iterator objects.
      • is an ordinary object.
      • has a [[Prototype]] internal slot whose value is %Iterator.prototype%.
      • has the following properties:
      • @@ -38862,7 +38862,7 @@

        Array.from ( _items_ [ , _mapper_ [ , _thisArg_ ] ] )

        1. Let _defineStatus_ be Completion(CreateDataPropertyOrThrow(_A_, _Pk_, _mappedValue_)). 1. IfAbruptCloseIterator(_defineStatus_, _iteratorRecord_). 1. Set _k_ to _k_ + 1. - 1. NOTE: _items_ is not an Iterable so assume it is an array-like object. + 1. NOTE: _items_ is not iterable so assume it is an array-like object. 1. Let _arrayLike_ be ! ToObject(_items_). 1. Let _len_ be ? LengthOfArrayLike(_arrayLike_). 1. If IsConstructor(_C_) is *true*, then @@ -40275,7 +40275,7 @@

        length

        Array Iterator Objects

        -

        An Array Iterator is an object, that represents a specific iteration over some specific Array instance object. There is not a named constructor for Array Iterator objects. Instead, Array iterator objects are created by calling certain methods of Array instance objects.

        +

        An Array Iterator is an object that represents a specific iteration over some specific Array instance object. There is not a named constructor for Array Iterator objects. Instead, Array Iterator objects are created by calling certain methods of Array instance objects.

        @@ -40320,7 +40320,7 @@

        The %ArrayIteratorPrototype% Object

        The %ArrayIteratorPrototype% object:

          -
        • has properties that are inherited by all Array Iterator Objects.
        • +
        • has properties that are inherited by all Array Iterator objects.
        • is an ordinary object.
        • has a [[Prototype]] internal slot whose value is %Iterator.prototype%.
        • has the following properties:
        • @@ -40625,7 +40625,7 @@

          %TypedArray%.from ( _source_ [ , _mapper_ [ , _thisArg_ ] ] )

          1. Set _k_ to _k_ + 1. 1. Assert: _values_ is now an empty List. 1. Return _targetObj_. - 1. NOTE: _source_ is not an Iterable so assume it is already an array-like object. + 1. NOTE: _source_ is not an iterable object, so assume it is already an array-like object. 1. Let _arrayLike_ be ! ToObject(_source_). 1. Let _len_ be ? LengthOfArrayLike(_arrayLike_). 1. Let _targetObj_ be ? TypedArrayCreateFromConstructor(_C_, « 𝔽(_len_) »). @@ -41731,7 +41731,7 @@

          _TypedArray_ ( ..._args_ )

          1. Let _values_ be ? IteratorToList(? GetIteratorFromMethod(_firstArgument_, _usingIterator_)). 1. Perform ? InitializeTypedArrayFromList(_O_, _values_). 1. Else, - 1. NOTE: _firstArgument_ is not an Iterable so assume it is already an array-like object. + 1. NOTE: _firstArgument_ is not an iterable object, so assume it is already an array-like object. 1. Perform ? InitializeTypedArrayFromArrayLike(_O_, _firstArgument_). 1. Return _O_. 1. Else, @@ -42269,7 +42269,7 @@

          Properties of Map Instances

          Map Iterator Objects

          -

          A Map Iterator is an object, that represents a specific iteration over some specific Map instance object. There is not a named constructor for Map Iterator objects. Instead, map iterator objects are created by calling certain methods of Map instance objects.

          +

          A Map Iterator is an object that represents a specific iteration over some specific Map instance object. There is not a named constructor for Map Iterator objects. Instead, map iterator objects are created by calling certain methods of Map instance objects.

          @@ -42311,7 +42311,7 @@

          The %MapIteratorPrototype% Object

          The %MapIteratorPrototype% object:

            -
          • has properties that are inherited by all Map Iterator Objects.
          • +
          • has properties that are inherited by all Map Iterator objects.
          • is an ordinary object.
          • has a [[Prototype]] internal slot whose value is %Iterator.prototype%.
          • has the following properties:
          • @@ -42901,7 +42901,7 @@

            Properties of Set Instances

            Set Iterator Objects

            -

            A Set Iterator is an ordinary object, with the structure defined below, that represents a specific iteration over some specific Set instance object. There is not a named constructor for Set Iterator objects. Instead, set iterator objects are created by calling certain methods of Set instance objects.

            +

            A Set Iterator is an ordinary object, with the structure defined below, that represents a specific iteration over some specific Set instance object. There is not a named constructor for Set Iterator objects. Instead, set iterator objects are created by calling certain methods of Set instance objects.

            @@ -42941,7 +42941,7 @@

            The %SetIteratorPrototype% Object

            The %SetIteratorPrototype% object:

              -
            • has properties that are inherited by all Set Iterator Objects.
            • +
            • has properties that are inherited by all Set Iterator objects.
            • is an ordinary object.
            • has a [[Prototype]] internal slot whose value is %Iterator.prototype%.
            • has the following properties:
            • @@ -46349,9 +46349,9 @@

              Common Iteration Interfaces

              An interface is a set of property keys whose associated values match a specific specification. Any object that provides all the properties as described by an interface's specification conforms to that interface. An interface is not represented by a distinct object. There may be many separately implemented objects that conform to any interface. An individual object may conform to multiple interfaces.

              -

              The Iterable Interface

              -

              The Iterable interface includes the property described in :

              - +

              The Iterable Interface

              +

              The iterable interface includes the property described in :

              +

- An object that conforms to the Iterator or AsyncIterator interface. + An object that conforms to the iterator interface or the async iterator interface.
@@ -46371,10 +46371,10 @@

The Iterable Interface

`%Symbol.iterator%`
- a function that returns an Iterator object + a function that returns an iterator object - The returned object must conform to the Iterator interface. + The returned object must conform to the iterator interface.
@@ -46382,9 +46382,9 @@

The Iterable Interface

-

The Iterator Interface

-

An object that implements the Iterator interface must include the property in . Such objects may also implement the properties in .

- +

The Iterator Interface

+

An object that implements the iterator interface must include the property in . Such objects may also implement the properties in .

+ @@ -46404,18 +46404,18 @@

The Iterator Interface

*"next"*
- a function that returns an IteratorResult object + a function that returns an IteratorResult object - The returned object must conform to the IteratorResult interface. If a previous call to the `next` method of an Iterator has returned an IteratorResult object whose *"done"* property is *true*, then all subsequent calls to the `next` method of that object should also return an IteratorResult object whose *"done"* property is *true*. However, this requirement is not enforced. + The returned object must conform to the IteratorResult interface. If a previous call to the `next` method of an iterator has returned an IteratorResult object whose *"done"* property is *true*, then all subsequent calls to the `next` method of that object should also return an IteratorResult object whose *"done"* property is *true*. However, this requirement is not enforced.
-

Arguments may be passed to the `next` function but their interpretation and validity is dependent upon the target Iterator. The for-of statement and other common users of Iterators do not pass any arguments, so Iterator objects that expect to be used in such a manner must be prepared to deal with being called with no arguments.

+

Arguments may be passed to the `next` function but their interpretation and validity is dependent upon the target iterator. The for-of statement and other common users of Iterators do not pass any arguments, so iterator objects that expect to be used in such a manner must be prepared to deal with being called with no arguments.

- + @@ -46435,10 +46435,10 @@

The Iterator Interface

*"return"* @@ -46446,23 +46446,23 @@

The Iterator Interface

*"throw"*
- a function that returns an IteratorResult object + a function that returns an IteratorResult object - The returned object must conform to the IteratorResult interface. Invoking this method notifies the Iterator object that the caller does not intend to make any more `next` method calls to the Iterator. The returned IteratorResult object will typically have a *"done"* property whose value is *true*, and a *"value"* property with the value passed as the argument of the `return` method. However, this requirement is not enforced. + The returned object must conform to the IteratorResult interface. Invoking this method notifies the iterator object that the caller does not intend to make any more `next` method calls to the iterator. The returned IteratorResult object will typically have a *"done"* property whose value is *true*, and a *"value"* property with the value passed as the argument of the `return` method. However, this requirement is not enforced.
- a function that returns an IteratorResult object + a function that returns an IteratorResult object - The returned object must conform to the IteratorResult interface. Invoking this method notifies the Iterator object that the caller has detected an error condition. The argument may be used to identify the error condition and typically will be an exception object. A typical response is to `throw` the value passed as the argument. If the method does not `throw`, the returned IteratorResult object will typically have a *"done"* property whose value is *true*. + The returned object must conform to the IteratorResult interface. Invoking this method notifies the iterator object that the caller has detected an error condition. The argument may be used to identify the error condition and typically will be an exception object. A typical response is to `throw` the value passed as the argument. If the method does not `throw`, the returned IteratorResult object will typically have a *"done"* property whose value is *true*.
-

Typically callers of these methods should check for their existence before invoking them. Certain ECMAScript language features including `for`-`of`, `yield*`, and array destructuring call these methods after performing an existence check. Most ECMAScript library functions that accept Iterable objects as arguments also conditionally call them.

+

Typically callers of these methods should check for their existence before invoking them. Certain ECMAScript language features including `for`-`of`, `yield*`, and array destructuring call these methods after performing an existence check. Most ECMAScript library functions that accept iterable objects as arguments also conditionally call them.

-

The AsyncIterable Interface

-

The AsyncIterable interface includes the properties described in :

- +

The Async Iterable Interface

+

The async iterable interface includes the properties described in :

+ @@ -46473,17 +46473,17 @@

The AsyncIterable Interface

- - + +
`%Symbol.asyncIterator%`a function that returns an AsyncIterator objectThe returned object must conform to the AsyncIterator interface.a function that returns an async iterator objectThe returned object must conform to the async iterator interface.
-

The AsyncIterator Interface

-

An object that implements the AsyncIterator interface must include the properties in . Such objects may also implement the properties in .

- +

The Async Iterator Interface

+

An object that implements the async iterator interface must include the properties in . Such objects may also implement the properties in .

+ @@ -46494,19 +46494,19 @@

The AsyncIterator Interface

- +
*"next"*a function that returns a promise for an IteratorResult objecta function that returns a promise for an IteratorResult object -

The returned promise, when fulfilled, must fulfill with an object that conforms to the IteratorResult interface. If a previous call to the `next` method of an AsyncIterator has returned a promise for an IteratorResult object whose *"done"* property is *true*, then all subsequent calls to the `next` method of that object should also return a promise for an IteratorResult object whose *"done"* property is *true*. However, this requirement is not enforced.

+

The returned promise, when fulfilled, must fulfill with an object that conforms to the IteratorResult interface. If a previous call to the `next` method of an async iterator has returned a promise for an IteratorResult object whose *"done"* property is *true*, then all subsequent calls to the `next` method of that object should also return a promise for an IteratorResult object whose *"done"* property is *true*. However, this requirement is not enforced.

-

Additionally, the IteratorResult object that serves as a fulfillment value should have a *"value"* property whose value is not a promise (or "thenable"). However, this requirement is also not enforced.

+

Additionally, the IteratorResult object that serves as a fulfillment value should have a *"value"* property whose value is not a promise (or "thenable"). However, this requirement is also not enforced.

-

Arguments may be passed to the `next` function but their interpretation and validity is dependent upon the target AsyncIterator. The `for`-`await`-`of` statement and other common users of AsyncIterators do not pass any arguments, so AsyncIterator objects that expect to be used in such a manner must be prepared to deal with being called with no arguments.

+

Arguments may be passed to the `next` function but their interpretation and validity is dependent upon the target async iterator. The `for`-`await`-`of` statement and other common users of AsyncIterators do not pass any arguments, so async iterator objects that expect to be used in such a manner must be prepared to deal with being called with no arguments.

- + @@ -46517,20 +46517,20 @@

The AsyncIterator Interface

- + - +
*"return"*a function that returns a promise for an IteratorResult objecta function that returns a promise for an IteratorResult object -

The returned promise, when fulfilled, must fulfill with an object that conforms to the IteratorResult interface. Invoking this method notifies the AsyncIterator object that the caller does not intend to make any more `next` method calls to the AsyncIterator. The returned promise will fulfill with an IteratorResult object which will typically have a *"done"* property whose value is *true*, and a *"value"* property with the value passed as the argument of the `return` method. However, this requirement is not enforced.

+

The returned promise, when fulfilled, must fulfill with an object that conforms to the IteratorResult interface. Invoking this method notifies the async iterator object that the caller does not intend to make any more `next` method calls to the async iterator. The returned promise will fulfill with an IteratorResult object which will typically have a *"done"* property whose value is *true*, and a *"value"* property with the value passed as the argument of the `return` method. However, this requirement is not enforced.

-

Additionally, the IteratorResult object that serves as a fulfillment value should have a *"value"* property whose value is not a promise (or "thenable"). If the argument value is used in the typical manner, then if it is a rejected promise, a promise rejected with the same reason should be returned; if it is a fulfilled promise, then its fulfillment value should be used as the *"value"* property of the returned promise's IteratorResult object fulfillment value. However, these requirements are also not enforced.

+

Additionally, the IteratorResult object that serves as a fulfillment value should have a *"value"* property whose value is not a promise (or "thenable"). If the argument value is used in the typical manner, then if it is a rejected promise, a promise rejected with the same reason should be returned; if it is a fulfilled promise, then its fulfillment value should be used as the *"value"* property of the returned promise's IteratorResult object fulfillment value. However, these requirements are also not enforced.

*"throw"*a function that returns a promise for an IteratorResult objecta function that returns a promise for an IteratorResult object -

The returned promise, when fulfilled, must fulfill with an object that conforms to the IteratorResult interface. Invoking this method notifies the AsyncIterator object that the caller has detected an error condition. The argument may be used to identify the error condition and typically will be an exception object. A typical response is to return a rejected promise which rejects with the value passed as the argument.

+

The returned promise, when fulfilled, must fulfill with an object that conforms to the IteratorResult interface. Invoking this method notifies the async iterator object that the caller has detected an error condition. The argument may be used to identify the error condition and typically will be an exception object. A typical response is to return a rejected promise which rejects with the value passed as the argument.

-

If the returned promise is fulfilled, the IteratorResult fulfillment value will typically have a *"done"* property whose value is *true*. Additionally, it should have a *"value"* property whose value is not a promise (or "thenable"), but this requirement is not enforced.

+

If the returned promise is fulfilled, the IteratorResult object fulfillment value will typically have a *"done"* property whose value is *true*. Additionally, it should have a *"value"* property whose value is not a promise (or "thenable"), but this requirement is not enforced.

@@ -46541,9 +46541,9 @@

The AsyncIterator Interface

-

The IteratorResult Interface

-

The IteratorResult interface includes the properties listed in :

- +

The IteratorResult Interface

+

The IteratorResult interface includes the properties listed in :

+ @@ -46587,13 +46587,13 @@

The IteratorResult Interface

Iterator Helper Objects

-

An Iterator Helper object is an ordinary object that represents a lazy transformation of some specific source iterator object. There is not a named constructor for Iterator Helper objects. Instead, Iterator Helper objects are created by calling certain methods of Iterator instance objects.

+

An Iterator Helper object is an ordinary object that represents a lazy transformation of some specific source iterator object. There is not a named constructor for Iterator Helper objects. Instead, Iterator Helper objects are created by calling certain methods of Iterator instance objects.

The %IteratorHelperPrototype% Object

The %IteratorHelperPrototype% object:

    -
  • has properties that are inherited by all Iterator Helper Objects.
  • +
  • has properties that are inherited by all Iterator Helper objects.
  • is an ordinary object.
  • has a [[Prototype]] internal slot whose value is %Iterator.prototype%.
  • has the following properties:
  • @@ -47054,7 +47054,7 @@

    The %AsyncIteratorPrototype% Object

  • is an ordinary object.
-

All objects defined in this specification that implement the AsyncIterator interface also inherit from %AsyncIteratorPrototype%. ECMAScript code may also define objects that inherit from %AsyncIteratorPrototype%. The %AsyncIteratorPrototype% object provides a place where additional methods that are applicable to all async iterator objects may be added.

+

All objects defined in this specification that implement the async iterator interface also inherit from %AsyncIteratorPrototype%. ECMAScript code may also define objects that inherit from %AsyncIteratorPrototype%. The %AsyncIteratorPrototype% object provides a place where additional methods that are applicable to all async iterator objects may be added.

@@ -47069,7 +47069,7 @@

%AsyncIteratorPrototype% [ %Symbol.asyncIterator% ] ( )

Async-from-Sync Iterator Objects

-

An Async-from-Sync Iterator object is an async iterator that adapts a specific synchronous iterator. Async-from-Sync Iterator objects are never directly accessible to ECMAScript code. There is not a named constructor for Async-from-Sync Iterator objects. Instead, Async-from-Sync iterator objects are created by the CreateAsyncFromSyncIterator abstract operation as needed.

+

An Async-from-Sync Iterator object is an async iterator that adapts a specific synchronous iterator. Async-from-Sync Iterator objects are never directly accessible to ECMAScript code. There is not a named constructor for Async-from-Sync Iterator objects. Instead, Async-from-Sync Iterator objects are created by the CreateAsyncFromSyncIterator abstract operation as needed.

@@ -47094,7 +47094,7 @@

The %AsyncFromSyncIteratorPrototype% Object

The %AsyncFromSyncIteratorPrototype% object:

    -
  • has properties that are inherited by all Async-from-Sync Iterator Objects.
  • +
  • has properties that are inherited by all Async-from-Sync Iterator objects.
  • is an ordinary object.
  • has a [[Prototype]] internal slot whose value is %AsyncIteratorPrototype%.
  • is never directly accessible to ECMAScript code.
  • @@ -48574,7 +48574,7 @@

    prototype

    Generator Objects

    -

    A Generator is created by calling a generator function and conforms to both the Iterator and Iterable interfaces.

    +

    A Generator is created by calling a generator function and conforms to both the iterator interface and the iterable interface.

    Generator instances directly inherit properties from the initial value of the *"prototype"* property of the generator function that created the instance. Generator instances indirectly inherit properties from %GeneratorPrototype%.

    @@ -48818,7 +48818,7 @@

    GetGeneratorKind ( ): ~non-generator~, ~sync~, or ~async~

    GeneratorYield ( - _iteratorResult_: an Object that conforms to the IteratorResult interface, + _iteratorResult_: an Object that conforms to the IteratorResult interface, ): either a normal completion containing an ECMAScript language value or an abrupt completion

    @@ -48887,7 +48887,7 @@

    AsyncGenerator Objects

    -

    An AsyncGenerator is created by calling an async generator function and conforms to both the AsyncIterator and AsyncIterable interfaces.

    +

    An AsyncGenerator is created by calling an async generator function and conforms to both the async iterator interface and the async iterable interface.

    AsyncGenerator instances directly inherit properties from the initial value of the *"prototype"* property of the async generator function that created the instance. AsyncGenerator instances indirectly inherit properties from %AsyncGeneratorPrototype%.