ArrayBuffer neutering

Allen Wirfs-Brock allen at
Wed May 21 08:19:04 PDT 2014

On May 21, 2014, at 2:02 AM, Dmitry Lomov wrote:

> >
> >> Finally, I note that the current Khronos spec. doesn't provide much guidance in this regard.  The thing it has that is most similar to the other array methods is the 'subarray' method and it doesn't explicitly say anything about what happens when it is applied to a TypedArray with an underlying neutered ArrayBuffer.
> >
> > It isn't clear to me that it needs to. Starting from a view which is
> > pointing to a neutered ArrayBuffer, there is no way to create a
> > subarray of any nonzero length.
> No, but it seems highly unlikely that anybody doing myTypedArray.subarray(5,10) actually wants to get back a 0-length array is myTypedArray happens to be neutered.
> Maybe, but I believe we have been shipping 'subarray' with exactly this behavior for quite a while now, and speccing it otherwise will be a compat hazard.

I didn't say that the pre-existing subarray method should change its behavior.  But I am proposing that the new methods being added by ES6 fail hard if they encounter a neutered object.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list