[Webkit-unassigned] [Bug 120112] Typed Arrays have no public facing API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 16 16:45:19 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=120112

--- Comment #33 from Geoffrey Garen <ggaren at apple.com> ---
> > While this follows the JSC naming scheme, it also makes the API a bit more
> > cumbersome to use: now, every time you want to get the data pointer or type
> > of a typed array, you first have to check if the JSValueRef you got in your
> > function call is a JSObjectRef (using JSValueIsObject()). Allowing for
> > JSValues to be passed into these functions (i.e.
> > "JSValueGetTypedArrayDataPtr") would be much more convenient, but also not
> > reflect the truth that a Typed Array is a JSObject, not a JSValue.
> 
> Yeah.  Personally, I would not object to JSValueGetTypedArrayType in
> addition to JSObjectGetTypedArrayType, particularly since
> JSValueGetTypedArrayType has a very obvious spec and could even be
> implemented in terms of the other APIs.

The fact that JSObject is separate from JSValue, requiring a type check and cast before use, is a mistake, which is fixed in the modern Objective-C API. But I think it's good to adhere to the mistake in the C API so that the API remains internally consistent. 

It's easy for clients to fix the mistake by writing their own 2 line JSValue wrappers for JSObject functions, and indeed that's what we do in WebKit.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151016/7b46ada7/attachment-0001.html>


More information about the webkit-unassigned mailing list