Can an Array have array indexed accessor properties and other curiosities??

Brendan Eich brendan at mozilla.com
Sun Feb 15 18:41:06 PST 2009


On Feb 15, 2009, at 3:14 PM, Allen Wirfs-Brock wrote:

>> -----Original Message-----
>> From: Brendan Eich [mailto:brendan at mozilla.com]
>> Sent: Sunday, February 15, 2009 12:41 PM
> ...
>>> It would be nice to have some concrete examples to backup the
>>> assertions in the first quote above. Does anyone know of actual use
>>> cases or concrete examples where users have exploited this
>>> capability in interesting ways.
>>
>> http://mxr.mozilla.org/mozilla-central/source/js/narcissus/jsexec.js#666
>> http://mxr.mozilla.org/mozilla-central/source/js/narcissus/jsexec.js#869
>>
> Interesting,  but not actually what I was asking about. Unless I'm  
> missing something, in both these cases "array index" named  
> properties are being defined on regular objects, not instances of  
> Array and nothing discussed in this thread so for would interfere  
> with that.

Oh, right -- hence the curses in those comments of mine.

I'll keep looking, but I don't know if I'll find the  
__define[GS]etter__ usage you seek. If I'm forced in this little  
debate to fall back on general principles, I'll stand with Mark and  
oppose any non-virtualizability for Array elements. That still smells  
wrong.


> What I was asking looking for was example of using "array index"  
> named properties with actual array instances.

Some implementations, notably v8, generalize their optimizations for  
"array index" named properties over all objects, not just Array  
instances.

/be


More information about the Es-discuss mailing list