archives

« Bugzilla Issues Index

#3696 — 22.2.3.22.2%TypedArray%.prototype.set: Add constructor parameter to CloneArrayBuffer ?


22.2.3.22.2%TypedArray%.prototype.set(typedArray [, offset ] )

The temporary buffer allocation in 24.a can trigger possible side-effects. Since the temporary buffer is only required to properly explain the intended semantics, unnecessary side-effects should be minimized. (The temporary buffer isn't even always necessary, for example when overlapping regions of the same buffer are used. But it's easier to explain the algorithm using a copy - implementations can figure out when it's safe to omit that copy.)

Proposal: Add an optional `bufferConstructor` parameter to 24.1.1.4 CloneArrayBuffer and set that optional parameter to %ArrayBuffer% in 22.2.3.22.2%TypedArray%.prototype.set.


22.2.3.22.2%TypedArray%.prototype.set(typedArray [, offset ] )
---
24.a Let srcBuffer be CloneArrayBuffer(srcBuffer, srcByteOffset, %ArrayBuffer%).
---


24.1.1.4 CloneArrayBuffer( srcBuffer, srcByteOffset )
---
1. Assert: ...
2. If bufferConstructor is not present, then
a. Let bufferConstructor be SpeciesConstructor(srcBuffer, %ArrayBuffer%).
b. ReturnIfAbrupt(bufferConstructor).
c. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception.
3. Else,
a. Assert: IsConstructor(bufferConstructor) is true.
---


fixed in rev32 editor's draft


fixed in rev32 draft