[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] ArrayBuffer, Concatenation and String-Array Conversion, a proposal
My notes in the body.
On 10/05/2010 12:55 PM, Chris Marrin wrote:
Also, you can do the equivalent of the proposed array concatenation by
simply providing a list of the arrays to one of the forms of the
It made it!
On Oct 5, 2010, at 12:17 PM, Samuel Kleiner wrote:
Here are a few proposals for the typed arrays specification, that I think would help with the intuitiveness of that proposal. First of all, array concatenation.
In the current spec, when concatenated via the + operator, arrays stringify.
(new Int32Array()+new Int32Array()).length == 38
In my proposed spec change, arrays would concatenate into the same type, if both sides were the same, otherwise an arraybuffer would be returned.
(new Int32Array()+new Int32Array()).length == 2
(new Int32Array()+new Int8Array()).length == 5
The use case for this would be building primitive structs, and also progressive downloads of arraybuffer data.
Converting strings to arrays:
In the current spec, no conversion is made:
RangeError: ArrayBufferView size is not a small enough positive integer.
In my proposed spec change, the constructor for the individual arraybuffer specialized types take string arguments, and instantiate an arraybuffer with the individual unicode code points bitmasked to the size of the data type, here 0xFF) This would be easy to understand and provide reasonable compression of data.
new Int8Array("data") == 100
One use case would be converting compressed vertex data embedded in json. This would also be a use case for immutable array buffers, if such are specified.
Converting arrays to strings:
Use case: I can't really come up with one, but it seems useful.
And it works like a charm!
You are currently subscribed to firstname.lastname@example.org.
To unsubscribe, send an email to email@example.com with
the following command in the body of your email: