From baf349bcee6e1713967c967a819cdafd266e05e9 Mon Sep 17 00:00:00 2001 From: Yulia Startsev Date: Wed, 16 Oct 2024 20:50:37 +0200 Subject: [PATCH] Normative: Remove Species check for TypedArrays ArrayBuffers and SharedArrayBuffers --- spec.html | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/spec.html b/spec.html index 2871f040e5..9061c77467 100644 --- a/spec.html +++ b/spec.html @@ -6572,6 +6572,12 @@

1. If IsConstructor(_S_) is *true*, return _S_. 1. Throw a *TypeError* exception. + +

Species constructor is only available for Array, RegExp and Promise built-in classes. It + will not be provided to any other built-in classes. Species are an expensive and complex + operation that did not end up being used by the community, resulting in the feature being + depricated.

+
@@ -40793,7 +40799,7 @@

%TypedArray%.prototype.filter ( _callback_ [ , _thisArg_ ] )

1. Append _kValue_ to _kept_. 1. Set _captured_ to _captured_ + 1. 1. Set _k_ to _k_ + 1. - 1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_captured_) »). + 1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_captured_) »). 1. Let _n_ be 0. 1. For each element _e_ of _kept_, do 1. Perform ! Set(_A_, ! ToString(𝔽(_n_)), _e_, *true*). @@ -41019,7 +41025,7 @@

%TypedArray%.prototype.map ( _callback_ [ , _thisArg_ ] )

1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callback_) is *false*, throw a *TypeError* exception. - 1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_len_) »). + 1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_len_) »). 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, 1. Let _Pk_ be ! ToString(𝔽(_k_)). @@ -41235,7 +41241,7 @@

%TypedArray%.prototype.slice ( _start_, _end_ )

1. Else if _relativeEnd_ < 0, let _endIndex_ be max(_srcArrayLength_ + _relativeEnd_, 0). 1. Else, let _endIndex_ be min(_relativeEnd_, _srcArrayLength_). 1. Let _countBytes_ be max(_endIndex_ - _startIndex_, 0). - 1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_countBytes_) »). + 1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_countBytes_) »). 1. If _countBytes_ > 0, then 1. Set _taRecord_ to MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. @@ -41347,7 +41353,7 @@

%TypedArray%.prototype.subarray ( _start_, _end_ )

1. Else, let _endIndex_ be min(_relativeEnd_, _srcLength_). 1. Let _newLength_ be max(_endIndex_ - _startIndex_, 0). 1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_), 𝔽(_newLength_) ». - 1. Return ? TypedArraySpeciesCreate(_O_, _argumentsList_). + 1. Return ? TypedArrayCreateSameType(_O_, _argumentsList_).

This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

@@ -41465,27 +41471,6 @@

get %TypedArray%.prototype [ %Symbol.toStringTag% ]

Abstract Operations for TypedArray Objects

- -

- TypedArraySpeciesCreate ( - _exemplar_: a TypedArray, - _argumentList_: a List of ECMAScript language values, - ): either a normal completion containing a TypedArray or a throw completion -

-
-
description
-
It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. Unlike ArraySpeciesCreate, which can create non-Array objects through the use of %Symbol.species%, this operation enforces that the constructor function creates an actual TypedArray.
-
- - 1. Let _defaultConstructor_ be the intrinsic object associated with the constructor name _exemplar_.[[TypedArrayName]] in . - 1. Let _constructor_ be ? SpeciesConstructor(_exemplar_, _defaultConstructor_). - 1. Let _result_ be ? TypedArrayCreateFromConstructor(_constructor_, _argumentList_). - 1. Assert: _result_ has [[TypedArrayName]] and [[ContentType]] internal slots. - 1. If _result_.[[ContentType]] is not _exemplar_.[[ContentType]], throw a *TypeError* exception. - 1. Return _result_. - -
-

TypedArrayCreateFromConstructor ( @@ -41517,7 +41502,8 @@

description
-
It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. Unlike TypedArraySpeciesCreate, which can construct custom TypedArray subclasses through the use of %Symbol.species%, this operation always uses one of the built-in TypedArray constructors.
+
It is used to specify the creation of a new TypedArray using a constructor function + that is derived from _exemplar_. This operation always uses one of the built-in TypedArray constructors.
1. Let _constructor_ be the intrinsic object associated with the constructor name _exemplar_.[[TypedArrayName]] in . @@ -43807,7 +43793,7 @@

ArrayBuffer.prototype.slice ( _start_, _end_ )

1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). 1. Else, let _final_ be min(_relativeEnd_, _len_). 1. Let _newLen_ be max(_final_ - _first_, 0). - 1. Let _ctor_ be ? SpeciesConstructor(_O_, %ArrayBuffer%). + 1. Let _ctor_ be %ArrayBuffer%. 1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »). 1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]). 1. If IsSharedArrayBuffer(_new_) is *true*, throw a *TypeError* exception. @@ -44125,7 +44111,7 @@

SharedArrayBuffer.prototype.slice ( _start_, _end_ )

1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). 1. Else, let _final_ be min(_relativeEnd_, _len_). 1. Let _newLen_ be max(_final_ - _first_, 0). - 1. Let _ctor_ be ? SpeciesConstructor(_O_, %SharedArrayBuffer%). + 1. Let _ctor_ be %SharedArrayBuffer%. 1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »). 1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]). 1. If IsSharedArrayBuffer(_new_) is *false*, throw a *TypeError* exception.