Allen Wirfs-Brock wrote:
On Oct 3, 2012, at 7:47 AM, Erik Arvidsson wrote:

On Wed, Oct 3, 2012 at 3:24 AM, Andreas Rossberg<rossb...@google.com>  wrote:
On 3 October 2012 05:38, Brendan Eich<bren...@mozilla.com>  wrote:
Which is more important, iterating over holes (preserved if possible), or
skipping them and therefore spreading array-likes but not iterables?
I, for one, couldn't care less about holes. We shouldn't compromise
any useful feature just for the sake of preserving some array hole
craziness.
Filling in holes with undefined seems like the right thing to do.
People do not depend on holes.

Having Array.prototype.@iterator skip holes is bad because we don't
have the index so we don't know that anything was skipped.

To repeat myself; holes are not common and we should keep things
simple and having Array.prototype.@iterator iterate over array[0] to
array[length - 1] is the most expected result.



However, that would mean that Array.prototype.forEach and for-of over the same 
array are not always interchangeable.

Yes, that's the trade-off.

Holes are considered harmful, almost always a bug, so this is probably tolerable (or even helpful if it flushes out bugs when someone swaps forEach and for-of). Mainly holes are an anti-pattern.

/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to