4 ms·
ArrayBuffers have a byteLength and a maxByteLength and this is similar to Go's len and cap, with the `resize()` being equivalent to a reslice or append on the s
by morelisp 4y ago
ArrayBuffers have a byteLength and a maxByteLength and this is similar to Go's len and cap, with the `resize()` being equivalent to a reslice or append on the subview.
- iainmerrick 4y agoThe difference is that those operations are on the root ArrayBuffer in JS, not the TypedArray views on that buffer. In Go, the underlying array is fixed, and each slice independently has resize/reallocate operations. The JS approach seems better and more comprehensible to me. (I note also that MDN lists “resizable” and “maxByteLength” as new experimental features.)