On Apr 25, 2008, at 2:08 PM, Brendan Eich wrote:

> for (prop in obj) {
>      ... obj[prop] ...
> }
>
> to look like
>
> for each (value in obj) {
>      ... value ...
> }
>
> where obj might be an Array. The symmetry between for-each-in and for-
> in that E4X half-supports (viz, prototype property enumeration with
> shadowing, and deleted-after-loop-starts coherence) is broken.

Just in case this is not well-known, SpiderMonkey starting in Firefox  
1.5 supported E4X and made the for-each-in loop work for all object  
types, not just XML/XMLList. But not on Array element (indexed  
property) values only, in index order -- again property creation  
order, and named as well as indexed enumerable properties, are  
visited. This shares code with for-in and preserves the equivalence  
shown in the rewrite example above.

/be

_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to