[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Do Typed Array need an isArray method?


I can agree your view JavaScript arrays are not the same to Typed arrays. However
it would good to have a method to identify that a Typed Arrays is a Typed Array.
My current approach to solve this dilemma is a hack and query for a bytelength > = 0 .



On 6/29/2012 11:23 AM, Kenneth Russell wrote:
I don't think it would be a good idea to make the Typed Array types
claim they're true JS arrays; they aren't. There are many properties
and behaviors of JS arrays that typed arrays deliberately don't

There seems to be motion in the ECMAScript working group to fold Typed
Arrays into the core language specification. If this happens, then
that group will figure out all of the corner cases associated with
making these types part of the language.


On Fri, Jun 29, 2012 at 11:06 AM, 3dmashup <3dmashup@comcast.net> wrote:
A conventional JavaScript   variable can be queried  to determine if its an
array with the Array.isArray(  x )  method.
Typed Arrays don't provide an equivalent metadata query.   Should there be a
method to determine whether a  Typed Array
variable is a Typed Array.  Here is a table of a properties for JavaScript
and Typed arrays.

The code to produce this table is attached.

Type Name isArray type of length element size byte length JavaScript Array true object 0 undefined undefined Float64Array false object 0 8 0 Float32Array false object 0 4 0 Int32Array false object 0 4 0 Int16Array false object 0 2 0 Int8Array false object 0 1 0 ArrayBuffer false object undefined undefined 0

----------------------------------------------------------- You are currently subscribed to public_webgl@khronos.org. To unsubscribe, send an email to majordomo@khronos.org with the following command in the body of your email: unsubscribe public_webgl -----------------------------------------------------------