Suggestions for Set

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Oct 2 14:51:44 PDT 2012


On Oct 2, 2012, at 2:43 PM, Mark S. Miller wrote:

> 
> 
> On Tue, Oct 2, 2012 at 2:18 PM, Rick Waldron <waldron.rick at gmail.com> wrote:
> 
> The direct reasoning for the resolution was:
> 
> "Cannot be both iterable and array-like"
> 
> It's possible that this could be added to the agenda for november, if Brendan wants to discuss SpiderMonkey's experience implementing it. It seems to me that if they're not having issues then it's at least worth a mention.
> 
> Please do. I'd really like to see a more pleasant resolution if one can be found. What does SpiderMonkey actually do?
> 

This thread from July is relevant  https://mail.mozilla.org/pipermail/es-discuss/2012-July/023918.html 

In particular
> On Jul 5, 2012, at 10:54 AM, Brendan Eich wrote:
> 
> > Allen privately observed that Array forEach skips holes, matching for-in. That counts for a lot with me -- we have only a blind for(i=0;i<a.length;i++)... loop not skipping holes, but of course it wouldn't. That is weak precedent on which to build for-of.
> 
> Specifically, for consistency, I think
> 
>       array.forEach((v)=>console.log(v));
> 
> and
> 
>      for (let v of array) console.log(v);
> 
> should yield the same results.
> 
> [].forEach skips "holes" so the default iterator for arrays should too.  All the other "Array extras" also have the skipping behavior. 
> 
> > 
> > Map may win at some point, who knows? It's not winning if one wants an array, numeric indexing, .length, the usual prototype methods.
> 
> We could consider also have "dense" interators available:
> 
>      for (let v of array.denseValues) console.log(v);
> 
> 
> Allen
> 
> 
> 

Hopefully we don't have to re-discuss too much of this. 

allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121002/ede81d22/attachment.html>


More information about the es-discuss mailing list