tc39 / tc39/proposal-immutable-arraybuffer

[[DefineOwnProperty]]: Confusing note about redefinition always failing

オープン
#52 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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:

  1. Let mutable be true.
  2. If IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, set mutable to false.
  3. If Desc has a [[Configurable]] field and Desc.[[Configurable]] is not mutable, return false.
  4. If Desc has an [[Enumerable]] field and Desc.[[Enumerable]] is false, return false.
  5. If IsAccessorDescriptor(Desc) is true, return false.
  6. If Desc has a [[Writable]] field and Desc.[[Writable]] is not mutable, return false.
  7. If Desc has a [[Value]] field, then
    1. If mutable is false, then
      1. Let current be TypedArrayGetElement(O, numericIndex).
      2. Assert: current is not undefined.
      3. Return SameValue(Desc.[[Value]], current).
    2. Perform ? TypedArraySetElement(O, numericIndex, Desc.[[Value]]).
  8. Return true.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提案の [[DefineOwnProperty]] アルゴリズムと、Immutable ArrayBuffer 仕様において参照されている ValidateAndApplyPropertyDescriptor の手順から始めます。現在の注記を、提案されている可変性のチェックおよび値の比較と比較します。混乱を招く注記が一貫したアルゴリズム手順に置き換えられ、リンク先の TypedArray の動作が引き続き正確に規定されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
documentation
issue の種類
ドキュメント
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。