[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] isBuffer, isTexture etc.
On Sat, Apr 24, 2010 at 02:56, Gregg Tavares <email@example.com>
I disagree. By that argument ctx.bindTexture should be ctx.bindTexture(in GLenum target, in WebGLObject texture)
I agree with Gregg, though the naming can be misleading (as Chris pointed out), I believe isTexture's rationale is to check that a texture object is _valid_ in the current context , not to check that the object _is_ a texture - something that would not require an API method in the first place (ie. to do that one would use standard instanceof).
I do not believe as well there is real use cases that would make weak-typing those is* functions a useful feature, on the other hand changing the signature to the related object type makes API's intent clearer to developers and can help catch logic errors earlier (possibly by static analysis even).
 : the object has been generated by current context or sharing is possible, and the object has not been created before a context loss.
 : using isBuffer when isTexture was intented for instance, imho this case of "typo" is way more likely to happen than usage of the supposed "type-checking" feature allowed by weak-typed is* functions.