Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: Remove Species check for TypedArrays ArrayBuffers and SharedArrayBuffers #3450

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

codehag
Copy link
Contributor

@codehag codehag commented Oct 16, 2024

This is a first stab at removing the Species check for TA, ABs, and SABs, in line with our review of the webcompat of it all: https://docs.google.com/presentation/d/1J0xct8EHUC90P6QpggISxuAp_5L_qaDa3SZ9gQaB0kA/edit#slide=id.p

There is a note in there about deprecating this behavior, but I wasn't 100% sure how to do that. Comments welcome.

cc @mgaudet

@codehag codehag force-pushed the remove-species-TA-SAB-AB branch 2 times, most recently from baf349b to 9d5da42 Compare October 16, 2024 20:01
@bakkot bakkot added the editor call to be discussed in the next editor call label Oct 16, 2024
@ljharb ljharb added normative change Affects behavior required to correctly evaluate some ECMAScript source text pending stage 4 This proposal has not yet achieved stage 4, but may otherwise be ready to merge. labels Oct 16, 2024
@ljharb ljharb marked this pull request as draft October 16, 2024 20:07
@@ -6572,6 +6572,12 @@ <h1>
1. If IsConstructor(_S_) is *true*, return _S_.
1. Throw a *TypeError* exception.
</emu-alg>
<emu-note>
<p>Species constructor is only available for Array, RegExp and Promise built-in classes. It
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Species constructor is only available for Array, RegExp and Promise built-in classes. It
<p>Species constructor is only available for Array, RegExp, and Promise built-in classes. It

spec.html Outdated
Comment on lines 43795 to 43796
1. Let _ctor_ be %ArrayBuffer%.
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Let _ctor_ be %ArrayBuffer%.
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
1. Let _new_ be ? Construct(%ArrayBuffer%, « 𝔽(_newLen_) »).

spec.html Outdated
Comment on lines 44113 to 44114
1. Let _ctor_ be %SharedArrayBuffer%.
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Let _ctor_ be %SharedArrayBuffer%.
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
1. Let _new_ be ? Construct(%SharedArrayBuffer%, « 𝔽(_newLen_) »).

Copy link
Contributor

@bakkot bakkot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also update Annex F.

Looks good other than my comments.

<p>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
deprecated.</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editors discussed this and we think that capturing "we aren't going to do this anymore" probably doesn't belong in the spec itself. Instead, how-we-work/normative-conventions.md would be a good place for capturing this for the committee's benefit, and MDN for the community's.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this note be removed entirely or should the comment about species constructor availability stay?

@@ -41517,7 +41502,7 @@ <h1>
</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put oldids="typedarray-species-create" in the emu-clause for TypedArrayCreateSameType so that existing links to the old AO get redirected here.

@@ -41517,7 +41502,7 @@ <h1>
</h1>
<dl class="header">
<dt>description</dt>
<dd>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.</dd>
<dd>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.</dd>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<dd>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.</dd>
<dd>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. Prior to the 2025 edition of the specification some TypedArray methods made use of SpeciesCreate, but that functionality has been removed.</dd>

zloirock added a commit to zloirock/core-js that referenced this pull request Oct 17, 2024
@@ -6572,6 +6572,9 @@ <h1>
1. If IsConstructor(_S_) is *true*, return _S_.
1. Throw a *TypeError* exception.
</emu-alg>
<emu-note>
<p>Species constructor is only available for Array, RegExp, and Promise built-in classes. </p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Species constructor is only available for Array, RegExp, and Promise built-in classes. </p>
<p>Species constructor is only available for Array, RegExp, and Promise built-in classes.</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor call to be discussed in the next editor call normative change Affects behavior required to correctly evaluate some ECMAScript source text pending stage 4 This proposal has not yet achieved stage 4, but may otherwise be ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants