tc39 / tc39/proposal-immutable-arraybuffer
[[DefineOwnProperty]]: Confusing note about redefinition always failing
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 38
- 派生
- 7
- PR 合并指标
- 30 天内没有已合并 PR
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提案的 [[DefineOwnProperty]] 算法以及 Immutable ArrayBuffer 规范中引用的 ValidateAndApplyPropertyDescriptor 步骤开始。将当前注释与提议的可变性检查和值比较进行对照。完成的标准是:用一致的算法步骤替换令人困惑的注释,并且链接的 TypedArray 行为仍得到准确规范。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100