Skip to content

Conversation

gibson042
Copy link
Member

@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
Member Author

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

@gibson042 gibson042 merged commit a4b420a into tc39:main Mar 6, 2025
1 check passed
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