array like objects

Brendan Eich brendan at mozilla.com
Mon Dec 7 19:21:11 PST 2009


On Dec 7, 2009, at 6:24 PM, Mike Samuel wrote:

> 2009/12/7 Yehuda Katz <wycats at gmail.com>:
>> Your strawman would support:
>> {0: "strawman", length: 0}
>> A better definition might be:
>>    o is an array like object if o[[Get]]('length') returns a Number  
>> one
>> greater than the largest numeric property, or 0 if no numeric  
>> properties
>> exist.
>
> By that better definition the array [,] is not array like.

Holes, yuck. Bringing up holes makes me sad. Prototype element of the  
same index shows through a hole :-(.

>>> The need to distinguish between the two in library code could be
>>> mooted if for (in) on arrays iterated over the array index  
>>> properties
>>> of arrays in numeric oder order first, followed by other  
>>> properties in
>>> insertion order, and host objects like NodeCollections followed  
>>> suit.

+1 on this -- it has come up before on-list, most recently in a thread  
where Maciej tested browser implementations extensively:

https://mail.mozilla.org/pipermail/es-discuss/2009-October/010060.html

/be


More information about the es-discuss mailing list