typed array strawman proposal
kris.kowal at cixar.com
Tue Jan 26 23:25:43 PST 2010
On Tue, Jan 26, 2010 at 10:43 AM, Vladimir Vukicevic
<vladimir at mozilla.com> wrote:
> At Brendan's request, I've just added a new strawman proposal for ES typed
> arrays to the wiki. This proposal comes from the WebGL group, which needed
> a way of efficient access to and manipulation of native machine-type arrays;
> once we came up with a reasonable baseline API, it looked like something
> that would be generally useful as more interop and performance demands are
> placed on ES. "Typed arrays" is probably not the best name; but that's
> probably an easy bikeshed.
I've made three similar proposals over in CommonJS.
ArrayBuffer is a strict subset of what I'm calling ByteArray (which
incidentally fits the TypeArray pattern you establish in your
proposal). I think we could converge these proposals. Yours is most
similar to Binary/B. Binary/D adds some bit types and improved the
details a bit. Bineary/E abandoned the notion that binary types could
become natives in CommonJS, removed the bit types, and reduced the API
To get closer to your proposal, it would probably be easier to start
from yours and add rather than start from one of mine and subtract. I
recommend ByteArray for the name. It matches the pattern you
establish for Integer Arrays. Secondly, I think "slice" needs to
return an immutable fixed length type, or ought not be included.
Daniel Friesen proposed a "Range" type and a "range" method in
Binary/C which I incorporated in D and E. "range" is like slice but
returns a view of the underlying buffer region and supports the
relevant subset of the ByteArray API. With "range", there is no
expectation of indefinite consistency. I think the various aligned
typed arrays are a good idea, but I think CommonJS would be satisfied
if we were to agree on the byte array buffer type initially.
More information about the es-discuss