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

Re: [Public WebGL] Typed Array spec updates: strawman proposals



On Fri, Apr 22, 2011 at 9:23 PM, Ben Vanik <ben.vanik@gmail.com> wrote:
> It be useful to have an exception thrown on writes to closed arrays, just as
> exceptions are thrown on writes to read-only arrays.
> If I were in a large, multi-threaded application and trying to debug
> flakiness it'd be a lot easier to identify write-after-postMessage cases as
> opposed to random code just not doing anything. I like setting all the sizes
> to zero, but on writes you'd get range exceptions and other things that
> aren't immediately traceable to the close action.

There's a problem with doing this: according to JavaScript semantics,
using the [] operator to fetch a missing property is supposed to
return "undefined", and performing an assignment to a missing property
is supposed to add the property to the object. This means that if we
set the lengths to zero during the close operation, then we can't
throw exceptions from the getters and setters. (Earlier versions of
the typed array spec used to do this in various situations, and we had
to back off from doing so.)

An alternative would be to indicate the closed property in another
way, leave the length property alone, and begin to throw exceptions
for all reads and writes to the previously valid indexed properties.

(I personally prefer setting the lengths to zero, because I think
doing so makes it more apparent what happened.)

-Ken

> --
> Ben Vanik
> http://www.noxa.org
>
>
> On Fri, Apr 22, 2011 at 7:22 PM, Ben Vanik <ben.vanik@gmail.com> wrote:
>>
>> Love it!
>> Two comments:
>> Any reason that it's 'copyRange' instead of 'slice'? 'copyRange' is more
>> explicit, but 'slice' is more consistent.
>> 'isReadOnly' should probably be 'readOnly' (the name that is used
>> elsewhere in the html spec, for example on the <input> element).
>>
>> --
>> Ben Vanik
>> http://www.noxa.org
>>
>>
>> On Fri, Apr 22, 2011 at 6:20 PM, Kenneth Russell <kbr@google.com> wrote:
>>>
>>> The Typed Array editors' draft has been updated:
>>>
>>> http://www.khronos.org/registry/typedarray/specs/latest/
>>>
>>> with changes supporting the following functionality:
>>>
>>>  - Ability to copy sections of an ArrayBuffer
>>>  - Read-only ArrayBuffers
>>>  - Support for zero-copy data transfer via postMessage by defining the
>>> behavior of ArrayBuffers and ArrayBufferViews under structured clone
>>>
>>> The changes are clearly highlighted in the spec with "Strawman proposal".
>>>
>>> The strawman proposal for the behavior of ArrayBuffers and views under
>>> structured clone was discussed informally between Mozilla and Google,
>>> and has undergone some iteration. (Earlier iterations involved making
>>> an explicit API call to achieve transfer of ownership, and having the
>>> default behavior perform a copy.) The current behavior was preferred
>>> by members of the TC-39 committee, because it achieves unsurprising
>>> performance characteristics.
>>>
>>> We believe that these changes will be efficiently implementable in
>>> current JavaScript engines and web browsers.
>>>
>>> Your feedback on these changes would be greatly appreciated. Please
>>> send them to the list.
>>>
>>> Thanks,
>>>
>>> -Ken
>>> -----------------------------------------------------------
>>> You are currently subscribed to public_webgl@khronos.org.
>>> To unsubscribe, send an email to majordomo@khronos.org with
>>> the following command in the body of your email:
>>> unsubscribe public_webgl
>>> -----------------------------------------------------------
>>>
>>
>
>

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