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

Re: [Public WebGL] Immutable variant of ArrayBuffer



On Sep 28, 2010, at 10:28 AM, Vladimir Vukicevic wrote:

> 
> ----- Original Message -----
>> In the current discussion of adding ArrayBuffer access to XHR, Maciej
>> brought up the point that an immutable variant of ArrayBuffer would
>> allow the raw XHR response buffer to be used directly with a copy. To
>> do this we would need an immutable version of ArrayBuffer as well as
>> all of the views. These would omit all the setters, but would
>> otherwise be the same.
>> 
>> Maciej also brings up the good point that such immutable types would
>> make it possible to pass data to Workers without having to deal with
>> thread-safe copy-on-write semantics.
>> 
>> I think we should add this functionality to the spec. Any thoughts
>> about this, or on how we could integrate immutability into the spec
>> the most cleanly?
> 
> This isn't a bad idea, and I've thought about it before.. but I think the tricky bit is enforcing the immutability efficiently.  It's doable, but I think the only place it really helps you is in XHR -- workers could pass immutable ArrayBuffers around, but you could also implement copy-on-write semantics there as an optimization.  I guess you could implement copy-on-write for the XHR case as well, which would certainly be simpler for the author than have to keep track of immutable variants of these things.

Sure, but immutability would be more efficient because you have to make copy-on-write thread safe. And there are cases like XHR where creating an immutable object would be simple and effective.

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




-----------------------------------------------------------
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: