tc39 / tc39/proposal-immutable-arraybuffer
[[DefineOwnProperty]]: Confusing note about redefinition always failing
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 38
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
This note in [[DefineOwnProperty]] caused confusion during code view:
NOTE: Attempting to redefine an immutable value always fails, even if the new value would be cast to the current value.
Maybe just inline ValidateAndApplyPropertyDescriptor and replace https://tc39.es/proposal-immutable-arraybuffer/#sec-typedarray-defineownproperty, steps 1.b.ii-viii with:
- Let mutable be true.
- If IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, set mutable to false.
- If Desc has a [[Configurable]] field and Desc.[[Configurable]] is not mutable, return false.
- If Desc has an [[Enumerable]] field and Desc.[[Enumerable]] is false, return false.
- If IsAccessorDescriptor(Desc) is true, return false.
- If Desc has a [[Writable]] field and Desc.[[Writable]] is not mutable, return false.
- If Desc has a [[Value]] field, then
- If mutable is false, then
- Let current be TypedArrayGetElement(O, numericIndex).
- Assert: current is not undefined.
- Return SameValue(Desc.[[Value]], current).
- Perform ? TypedArraySetElement(O, numericIndex, Desc.[[Value]]).
- Return true.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposal's [[DefineOwnProperty]] algorithm and the referenced ValidateAndApplyPropertyDescriptor steps in the Immutable ArrayBuffer specification. Compare the current note with the proposed mutable checks and value comparison. Done means the confusing note is replaced by consistent algorithm steps and the linked TypedArray behavior remains accurately specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100