W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2010

Re: Adoption of the Typed Array Specification

From: Chris Marrin <cmarrin@apple.com>
Date: Wed, 19 May 2010 10:07:46 -0700
Cc: public-script-coord@w3.org
Message-Id: <A2592C32-A010-4652-B81B-B8CE634C8795@apple.com>
To: es-discuss@mozilla.org

On May 18, 2010, at 6:12 PM, Allen Wirfs-Brock wrote:

>> From: Kenneth Russell [mailto:kbr@google.com]
>> Out of curiosity what are the implications of the word "buffer"?
> 
> The usage isn't absolute, but the term "buffer" is often used to for areas of memory that hold transient data.  Often data that is being moved from one place or representation to another.  See, for example, the definitions  at http://www.cheap56k.com/glossary/Buffer.html and http://www.techweb.com/encyclopedia/defineterm.jhtml?term=buffer .
> 
> In the TypedArray proposal, ArrayBuffers are not necessarily used in such a transient manner.  They can be used to implement such buffers, but they may also be used to implement other storage use cases.  Such usage decisions are really in the domain of the application design, not the core library design.  To me, that raises a flag about the use of the term "Buffer" in that context.

I disagree with this assessment. The "transient" nature of buffers is not universal. One of your own citations define it as:

	A reserved segment of memory used to hold data while it is being processed

That's a very good description of what ArrayBuffer is. I also don't think we need to avoid "Array", especially if we keep the "Typed" prefix. TypedArrays are very much like the Array object, except that the data is typed. Perhaps we could use TypedArrayBuffer as the buffer object. That would match better with the base class of TypedArray, which specializes into Int8Array, etc. It seems like a rational naming for a family of objects.

We will never have the "perfect" name. We need something authors understand after reading the spec. The rest is just bikeshedding.

> 
> The use of "Array" also seems inappropriate.  In the TypedArrayProposal, ArrayBuffer isn't even used exclusively as the backing store for view objects that provide Array-like access.  It is also used as the backing store for DataView that provides heterogeneous data access.  In addition, ArrayBuffer (as currently spec'ed) doesn't directly provide any JavaScript array-like behaviors, so use of "Array" in its name also seems misleading for that reason.
> 
> That's why I would generally prefer an application and access neutral name such as Blob, BinaryData, ByteBlob, etc.


I dislike the term Blob, especially since the File API is using that term to mean a different object type. The name DataView is arguable since it doesn't match the conventions used in any of the other objects in this family, even though it is just a TypedArray that has API for heterogenous types. I have other opinions about DataView and how it is defined, but that is for another conversation.

-----
~Chris
cmarrin@apple.com
Received on Wednesday, 19 May 2010 17:08:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:02 UTC