On Apr 28, 2008, at 6:04 PM, Waldemar Horwat wrote:
> Brendan Eich wrote:
>> 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.
>
> I'm baffled trying to figure out what you're trying to say in the
> last paragraph.
Let me try again:
I added for-each-in support for all types when implementing E4X in
SpiderMonkey, not just for XMLList and XML types. But I did not make
for-each-in do anything different given an array object on the right
of 'in' from what the for-in would do if you used the loop variable
to index into the array to get the value produced in the loop
variable by for-each-in.
Does that help?
/be
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss