Re: What type should .findAll return

On 11/13/11 8:51 AM, Allen Wirfs-Brock wrote:
> It's relevant to this discussion because you have to decide what "web developers" actually mean when they say "Array".

Yes, agreed.

> The most important point is that [[Class]] is neither the only nor the most important distinguishing characteristic of ECMAScript built-in Arrays.

Agreed on the former; I don't think it matters that much how "important" 
it is.  It's just a distinguishing characteristic, period.

>> The standard does not specify many aspects of implementation behavior, including but not limited to performance characteristics.
>
> Such as??  While there are still non-performance aspects  of implementation that are not yet fully specified we are working hard to eliminate (or at least minimize them).  WRT Array, other than performance (including space efficiency) and some aspects of the sort function, what do you think isn't fully specified in ES5.1?

For arrays specifically, I believe performance and space are the only 
issues off the top of my head, other than the sort thing you mention.

>> It seems to me that there is a serious disconnect here between the way people are thinking about the standard for arrays and the simple "it needs to act just like an array in all observable ways" request from web developers.
>
> "all observable ways" means no methods that aren't already on Array.prototype.  I might think if would be fine for .findAll to just return an actual Array instance.  But others seem to want to augment that behavior so "all observable ways" does not seem to apply.

Yeah, different people have different definitions of "all observable 
ways" too... ;)

>> For purposes of the ES spec, all that matters is the precise specification of arrays.  For purposes of web developers and web specs trying to return array-like objects, these things the standard doesn't care about matter.
>
> I have to say that I think you are totally mischaracterizing the ES spec and the position of TC39.

Unless the ES spec starts mandating something about array performance, I 
don't think I am.  Note that I don't think this is a problem for ES per 
se.  I do think that for the nodelists we're considering here mandating 
that they should perform like arrays do would not be an unreasonable 
requirement on the DOM side.

>> See above.  It's 100% relevant to the public-webapps aspects of this discussion.
>
> Still not clear,  are you saying that all implementation are expect to apply the same optimizations?

I think expecting implementations to apply the same optimizations to 
these lists as to things created with |new Array| would not be 
unreasonable.  These optimizations may differ in different 
implementations, of course.

-Boris

Received on Sunday, 13 November 2011 02:26:09 UTC