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: Report assignment failure to canonical numeric properties of immutable TypedArrays #29

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

gibson042
Copy link
Collaborator

@gibson042 gibson042 commented Jan 12, 2025

Note that this includes non-integer-index but still canonical numeric properties such as "-0", "-1", "1.2", and String(2**53) = "9007199254740992", but does not include non-canonical-numeric properties such as "1.20", "1e3", and "0x20", which are not subject to special treatment and therefore can be set as on any ordinary object.

Ideally, TypedArrays would restrict special treatment of canonical numeric string properties to the strict subset that are integer indices (integers in the inclusive interval from 0 to 2**53 - 1), but that is out of scope for this PR.

The first two commits are separable editorial work, but kept in because they were performed over the course of the normative effort.

…ng properties of immutable-backed TypedArray instances

Note that this includes non-integer-index but still canonical numeric
properties such as "-0", "-1", "1.2", and String(2**53) =
"9007199254740992", but does not include non-canonical-numeric
properties such as "1.20", "1e3", and "0x20".

Ideally, TypedArrays would restrict special treatment of canonical
numeric string properties to the strict subset that are integer indices
(aligning with similar treatment in String), but that is out of scope
for this commit.
@gibson042 gibson042 requested review from erights and phoddie January 12, 2025 20:33
Copy link

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

@gibson042 gibson042 mentioned this pull request Jan 12, 2025
spec.emu Outdated
<p>It performs the following steps when called:</p>
<emu-alg>
1. Let _target_ be the *this* value.
1. <ins>NOTE: `Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~<ins>, ~write~</ins>).` here would observably change the observable calls into user code and thrown error when IsTypedArrayOutOfBounds returns *true* and _offset_ is negative. Such a change should be pursued.</ins>
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the rendered form at https://tc39.es/proposal-immutable-arraybuffer/pr/29/#sec-%typedarray%.prototype.set I see
image

Is this a symptom of malformed markup?

Copy link
Member

Choose a reason for hiding this comment

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

maybe this would render properly?

Suggested change
1. <ins>NOTE: `Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~<ins>, ~write~</ins>).` here would observably change the observable calls into user code and thrown error when IsTypedArrayOutOfBounds returns *true* and _offset_ is negative. Such a change should be pursued.</ins>
1. <ins>NOTE: `Let _taRecord_ be <del>? ValidateTypedArray(_O_, ~seq-cst~)</del><ins>? ValidateTypedArray(_O_, ~seq-cst~, ~write~)</ins>.` here would observably change the observable calls into user code and thrown error when IsTypedArrayOutOfBounds returns *true* and _offset_ is negative. Such a change should be pursued.</ins>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Collaborator

@erights erights left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Note: I only looked at the renderings, not the sources they were generated from.

@gibson042 gibson042 force-pushed the 2025-01-assignment-failure-reporting branch from 2fa7285 to 39c2484 Compare January 14, 2025 19:04
@gibson042 gibson042 merged commit 4f18004 into tc39:main Jan 14, 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.

4 participants