diff --git a/README.md b/README.md index 2ce4e70..bc73dd3 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,16 @@ Should trying to write data in an immutable ArrayBuffer via a TypedArray element
+Should the index properties of a TypedArray backed by an immutable ArrayBuffer be configurable and writable? + +
+
+ +No, TypedArray index properties should continue to track the state of the underlying buffer without individual bookkeeping. + +
+
+ Should TypedArray write methods (`copyWithin`, `fill`, `reverse`, `set`, etc.) throw when their backing ArrayBuffer is immutable but the targeted range is zero-length? If so, how early or late in the algorithm? The methods currently inspect arguments after ValidateTypedArray.
diff --git a/spec.emu b/spec.emu index c07e0c1..a1f7a62 100644 --- a/spec.emu +++ b/spec.emu @@ -20,6 +20,83 @@ contributors: Mark S. Miller, Richard Gibson

TypedArray Exotic Objects

+ +

+ [[GetOwnProperty]] ( + _P_: a property key, + ): a normal completion containing either a Property Descriptor or *undefined* +

+
+
for
+
a TypedArray _O_
+
+ + 1. If _P_ is a String, then + 1. Let _numericIndex_ be CanonicalNumericIndexString(_P_). + 1. If _numericIndex_ is not *undefined*, then + 1. Let _value_ be TypedArrayGetElement(_O_, _numericIndex_). + 1. If _value_ is *undefined*, return *undefined*. + 1. Let _mutable_ be *true*. + 1. If IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, set _mutable_ to *false*. + 1. Return the PropertyDescriptor { [[Value]]: _value_, [[Writable]]: *true* _mutable_, [[Enumerable]]: *true*, [[Configurable]]: *true* _mutable_ }. + 1. Return OrdinaryGetOwnProperty(_O_, _P_). + +
+ + +

+ [[DefineOwnProperty]] ( + _P_: a property key, + _Desc_: a Property Descriptor, + ): either a normal completion containing a Boolean or a throw completion +

+
+
for
+
a TypedArray _O_
+
+ + 1. If _P_ is a String, then + 1. Let _numericIndex_ be CanonicalNumericIndexString(_P_). + 1. If _numericIndex_ is not *undefined*, then + 1. If IsValidIntegerIndex(_O_, _numericIndex_) is *false*, return *false*. + 1. Let _mutable_ be *true*. + 1. If IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, set _mutable_ to *false*. + 1. If _Desc_ has a [[Configurable]] field and _Desc_.[[Configurable]] is *false* not _mutable_, return *false*. + 1. If _Desc_ has an [[Enumerable]] field and _Desc_.[[Enumerable]] is *false*, return *false*. + 1. If IsAccessorDescriptor(_Desc_) is *true*, return *false*. + 1. If _Desc_ has a [[Writable]] field and _Desc_.[[Writable]] is *false* not _mutable_, return *false*. + 1. If _Desc_ has a [[Value]] field and _mutable_ is *false* and SameValue(_Desc_.[[Value]], TypedArrayGetElement(_O_, _numericIndex_)) is *false*, return *false*. + 1. If _Desc_ has a [[Value]] field and _mutable_ is *true*, perform ? TypedArraySetElement(_O_, _numericIndex_, _Desc_.[[Value]]). + 1. Return *true*. + 1. Return ! OrdinaryDefineOwnProperty(_O_, _P_, _Desc_). + +
+ + +

+ [[Set]] ( + _P_: a property key, + _V_: an ECMAScript language value, + _Receiver_: an ECMAScript language value, + ): either a normal completion containing a Boolean or a throw completion +

+
+
for
+
a TypedArray _O_
+
+ + 1. If _P_ is a String, then + 1. Let _numericIndex_ be CanonicalNumericIndexString(_P_). + 1. If _numericIndex_ is not *undefined*, then + 1. If SameValue(_O_, _Receiver_) is *true*, then + 1. IsValidIntegerIndex(_O_, _numericIndex_) is *true* and IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, return *false*. + 1. Perform ? TypedArraySetElement(_O_, _numericIndex_, _V_). + 1. Return *true*. + 1. If IsValidIntegerIndex(_O_, _numericIndex_) is *false*, return *true*. + 1. Return ? OrdinarySet(_O_, _P_, _V_, _Receiver_). + +
+

TypedArraySetElement (