[Public WebGL] Please make the ArrayBufferView constructor visible

Ben Vanik [email protected]
Sun Dec 9 10:20:12 PST 2012


Agreed! Having a giant if-chain of types is nasty and slow - every time I
have to do this I cringe.

On Saturday, December 8, 2012, Victor Costan wrote:

>
> Dear WebGL working group,
>
> ArrayBufferView is currently marked as [NoInterfaceObject] in the
> Typed Array IDL.
> https://www.khronos.org/registry/typedarray/specs/latest/typedarray.idl
>
> Higher-level abstractions need to be able to write "x instanceof
> ArrayBufferView". Currently, implementors have to do horrible things
> to work around the lack of an ArrayBufferView name. For example,
> Google Chrome's authors recommend this hack to obtain a reference to
> ArrayBufferView.
>
> var ArrayBufferView = (new Uint8Array(0)).__proto__.__proto__.constructor;
> Source: https://code.google.com/p/chromium/issues/detail?id=60449
>
> Please make ArrayBufferView available in the global namespace, so
> instanceof checks can work. I would suggest that the constructor
> should throw a TypeError exception if called, to be consistent with
> the current behavior of the above workaround. I haven't thought too
> much about that though. Also, given the above workaround, I don't
> think there is any security implication in making ArrayBufferView
> available in the global namespace.
>
> In case you're looking for a real-life application: I am the author of
> dropbox.js, a JavaScript library that serves as a client to the
> Dropbox API. I want to make it easy to my users to write files, so I
> let them pass anything that contains data -- Strings, Files, Blobs,
> ArrayBuffers, ArrayBufferViews. Not having ArrayBufferView available
> means I'll have to use the horrible hack suggested by the Chrome
> authors.
>
> Please consider making this change, so future Web developers can have
> a better life!
>
> Thank you very much,
>     Victor Costan
>
> Victor Costan | [email protected] <javascript:;> | www.costan.us | +1
> (646) 434-8887
> Massachusetts Institute of Technology
> Department of Electrical Engineering and Computer Science, B.S. '07,
> M.Eng '08, Ph.D. '14
> Sloan School of Management, B.S. '07
>
> -----------------------------------------------------------
> You are currently subscribed to [email protected] <javascript:;>.
> To unsubscribe, send an email to [email protected] <javascript:;> with
> the following command in the body of your email:
> unsubscribe public_webgl
> -----------------------------------------------------------
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20121209/2260d6bd/attachment.html>


More information about the public_webgl mailing list