Re: WebGL IDL for uniform1fv is not valid WebIDL

On 4/2/12 7:20 PM, Cameron McCormack wrote:
> I want to allow object with indexed properties to be passed to objects
> expecting a sequence<T> or T[] type, so that you can do for example:
>
> void f(sequence<Node> nodes);
>
> and be able to pass in a JS Array of Node objects or a NodeList. I make
> interfaces with indexed properties not distinguishable from sequences
> and arrays so that there isn't a value that would match both types.

Or you could make it distinguishable and check for the right interface 
before trying the generic conversion.

> I think removing the Float32Array overload will make passing JS Arrays
> of Numbers and Float32Array objects work.

But require copies in the process, no?  That seems highly undesirable in 
this case.

> But note that *any* object
> that has indexed properties will be allowed to be passed here, e.g. a
> Uint8Array. If we want to disallow that, then I think that is
> incompatible with the NodeList example above.

Not if we place requirements on the return values of the indexed 
properties or something.  But that can get complicated.

> But if we're fine with
> Uint8Array being passed in and matching the float[] overload

That seems up to the WebGL folks here.....

> then just
> changing those types to be distinguishable, and making the argument
> resolution algorithm match the specific interface types before the
> "catch all" array/sequence types should work.

Indeed.

-Boris

Received on Tuesday, 3 April 2012 00:27:18 UTC