for-in statement: Enumerating prototype properties

# Brendan Eich (16 years ago)

On Feb 2, 2010, at 10:53 AM, Brendan Eich wrote:

On Feb 2, 2010, at 9:47 AM, Allen Wirfs-Brock wrote:

As it stands today for ES5, any of your observed results for Test 1
seem acceptable. FF result 2 seems wrong from a user perspective
(some names show up more than once in the enumeration) but this is
not explicitly forbidden by the specification. That's probably an
oversight although Mozilla might argue otherwise.

It's an oversight in the sense that I agree duplicate names are
surprising and not something intended.

To follow up on this thread, I wanted to let folks know that I filed
this bug:

bugzilla.mozilla.org/show_bug.cgi?id=548903

We will fix it. Taking a snapshot (with shadowing) of enumerable
properties for the directly referenced object and its prototypes is
better for performance, as well as POLAstonishment in corner cases,
and of course interop with other browsers.

A future ES standard will specify for-in better. More on that in a
separate post.