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

Add species note to normative conventions #157

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codehag
Copy link
Contributor

@codehag codehag commented Oct 17, 2024

See: tc39/ecma262#3450

Wasn't sure how much detail we wanted here.


New Builtins, and any existing builtins that do not currently support @@species constructors should not be updated to support extensions via @@species. The @@species symbol can be made available but should not be referenced elsewhere.

NB: This convention is new as of 2025, TypedArray, SharedArrayBuffer, and ArrayBuffer have been updated to follow it. Array, Promise, and RegExp were not web compatible to change. No other builtins were using it at the time of update.
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
NB: This convention is new as of 2025, TypedArray, SharedArrayBuffer, and ArrayBuffer have been updated to follow it. Array, Promise, and RegExp were not web compatible to change. No other builtins were using it at the time of update.
NB: This convention is new as of 2025; TypedArray, SharedArrayBuffer, and ArrayBuffer have been updated to follow it. Array, Promise, and RegExp were not web compatible to change. No other builtins were using it at the time of update.


New Builtins, and any existing builtins that do not currently support @@species constructors should not be updated to support extensions via @@species. The @@species symbol can be made available but should not be referenced elsewhere.

NB: This convention is new as of 2025, TypedArray, SharedArrayBuffer, and ArrayBuffer have been updated to follow it. Array, Promise, and RegExp were not web compatible to change. No other builtins were using it at the time of update.
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
NB: This convention is new as of 2025, TypedArray, SharedArrayBuffer, and ArrayBuffer have been updated to follow it. Array, Promise, and RegExp were not web compatible to change. No other builtins were using it at the time of update.
NB: This convention is new as of 2025, TypedArray, SharedArrayBuffer, and ArrayBuffer have been updated to follow it. Although we would want this change to also apply to Array, Promise, and RegExp, that change was found to not be web compatible. No other builtins were using it at the time of update.

@@ -45,3 +45,9 @@ Any time an iterable or async-iterable value (a value that has a `Symbol.iterato
Although primitive Strings are default iterable (`String.prototype` has a `Symbol.iterator` method which enumerates code points), it is now considered a mistake to iterate a String without specifying whether the String is providing an abstraction over code units, code points, grapheme clusters, or something else.

NB: This convention is new as of 2024, and most earlier parts of the language do not follow it. In particular, positional destructuring (both binding and assignment), array spread, argument spread, for-of loops, `yield *`, the `Set` and `AggregateError` constructors, `Object.groupBy`, `Map.groupBy`, `Promise.all`, `Promise.allSettled`, `Promise.any`, `Promise.race`, `Array.from`, the static `from` methods on typed array constructors, and `Iterator.from` (Stage 3 at time of writing) all accept primitives where iterables are expected.

## New Builtins should not make use of @@species
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
## New Builtins should not make use of @@species
## New Builtins should not make use of `Symbol.species`


## New Builtins should not make use of @@species

New Builtins, and any existing builtins that do not currently support @@species constructors should not be updated to support extensions via @@species. The @@species symbol can be made available but should not be referenced elsewhere.
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
New Builtins, and any existing builtins that do not currently support @@species constructors should not be updated to support extensions via @@species. The @@species symbol can be made available but should not be referenced elsewhere.
New Builtins, and any existing builtins that do not currently support `Symbol.species` constructors should not be updated to support extensions via `Symbol.species`. The `Symbol.species` symbol can be made available but should not be referenced elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants