W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2012

Re: WebGL IDL for uniform1fv is not valid WebIDL

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 02 Apr 2012 20:26:49 -0400
Message-ID: <4F7A43C9.2070103@mit.edu>
To: Cameron McCormack <cam@mcc.id.au>
CC: public webgl <public_webgl@khronos.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC