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 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions normative-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
codehag marked this conversation as resolved.
Show resolved Hide resolved

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.
codehag marked this conversation as resolved.
Show resolved Hide resolved

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.

codehag marked this conversation as resolved.
Show resolved Hide resolved
Loading