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: Account for TypedArraySpeciesCreate species lookup #47

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

Conversation

gibson042
Copy link
Collaborator

@gibson042 gibson042 commented Feb 24, 2025

Fixes #46 by adding an optional accessMode parameter to TypedArraySpeciesCreate and passing in WRITE from %TypedArray%.prototype.{filter,map,slice} (but not from %TypedArray%.prototype.subarray, which returns without attempting any buffer manipulation). When the new parameter is WRITE, the result from TypedArrayCreateFromConstructor is enforced to be mutable.

Copy link

The rendered spec for this PR is available at https://tc39.es/proposal-immutable-arraybuffer/pr/47.

@anba
Copy link

anba commented Feb 25, 2025

Returning a zero-length, immutable TypedArray from https://tc39.es/ecma262/#sec-%typedarray%.from and https://tc39.es/ecma262/#sec-%typedarray%.of is still allowed with this change. Is this intentional? I think I'd prefer if those two methods match the methods calling TypedArraySpeciesCreate.

@gibson042
Copy link
Collaborator Author

It was intentional, but I can't remember why. Fixed.

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.

Missing checks for immutable objects returned from species constructors
2 participants