isPropertyEnumerable is going to stay broken?
Brendan Eich
brendan at mozilla.org
Mon Sep 10 16:24:16 PDT 2007
On Sep 10, 2007, at 2:41 PM, Neil Mix wrote:
> I think this is what Garrett is referring to:
>
> js> function f() {}
> js> f.prototype.foo = "blah";
> blah
> js> var x = new f();
> js> print(x.propertyIsEnumerable("foo"));
> false
> js> for (var n in x) print(n);
> foo
>
> And I have to agree with him, the method is confusing.
Sure, but that ship sailed (https://bugzilla.mozilla.org/show_bug.cgi?
id=57048#c4).
> Based on its
> name, I'd expect it to return true if the property can be enumerated
> via for-in loop on the given object, regardless of where the property
> exists in the prototype chain.
My question remains: is this an incompatible change that will help
more than it hurts, and otherwise be worth making?
Even with the change, hasOwnProperty and propertyIsEnumerable are
different, but from Garrett's latest mail it's clear that we agree
they're functionally the same for most user-defined properties in
their directly-owning objects.
Enumerability is a weak concept. I wish I'd left it out back in 1995,
when I was over-minimizing elsewhere.
/be
More information about the Es4-discuss
mailing list