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

Re: [Public WebGL] getContext multiple context language



On Jan 22, 2010, at 6:08 PM, Vladimir Vukicevic wrote:

> On 1/22/2010 6:01 PM, Chris Marrin wrote:
>> I  think I get why you pass the attrs as 'object' rather than WebGLContextAttributes, but I wonder if it would be better to have a common subclass (ContextAttributes?) that we derive WebGLContextAttributes from and is the type of the 'attributes' param. I'm not sure it makes much difference, but I think we should use strong typing unless there's a reason not to.
>> 
> 
> We could, but I'm not sure if it would add any value -- that object would look like:
> 
> interface CanvasContextAttributes { };
> 
> Requiring that all attributes objects derive from this might be nice, but some contexts may want to use a plain string for attributes; I don't think we should restrict those unnecessarily.


But I think that would subvert the mechanism. Passing a DOMString in place of an 'object' is not really legal IDL. It would work fine in ECMAScript because both are derived from the same object, but again, it subverts the entire object oriented nature of IDL.

If we really thought it was important to all both objects and strings for the attributes we should use 'any'. That would be technically valid, but not very object oriented. I wouldn't be too concerned if the API didn't allow a pure string to be passed. That's bad API design anyway.

-----
~Chris
cmarrin@apple.com




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