On Jan 26, 2010, at 1:13 AM, Vladimir Vukicevic wrote:
1) I really liked the table in 5.14.3, which BYTES_PER_ELEMENT rather than 'Size', or have some other way to relate these two.
2) I'd like to see the WebIDL for everything
3) I think slice() should definitely return a reference to the original ArrayBuffer. You show the code you'd use make a copy, which I think is sufficient.
4) There is a good way to copy an ArrayBuffer:
var newBuf = (new Int8Array(otherArray.slice(1,10))).buffer;
Isn't that sufficient?
5) I think endianness will be the biggest issue here. I think we need a way to load data into the array in a machine independent way. For instance, there should be a way to put an array of bytes into a FloatArray, when the bytes are in different orders, like big, little endian and network order. I like using the term "network order" because I never remember if that's big or little endian. Maybe a serialize/deserialize semantic could be used? For instance:
var bytes; // data from the network
var floats = new FloatArray(bytes, NetworkOrder);
var outBytes = new ByteArray(floats, NetworkOrder);
Some or all of the Array classes would have a new ctor which would take a ByteArray (or UnsignedByteArray?) and an enum saying it's byte order. Likewise ByteArray would have a ctor which would take any of the other types and an enum. Would that be enough?
My biggest concern about this is getting it out the door quickly. Is ECMA the way to do that? Would it be better as a W3C recommendation?