isPropertyEnumerable is going to stay broken?
Garrett Smith
dhtmlkitchen at gmail.com
Mon Sep 10 14:21:05 PDT 2007
On 9/10/07, Brendan Eich <brendan at mozilla.org> wrote:
> On Sep 10, 2007, at 1:28 PM, Garrett Smith wrote:
>
> > It's possible to crawl the prototype chain, true. I did not know some
> > implementations crawl the __proto__ for propertyIsEnumerable. Which
> > ones do this?
>
> None that I know of. That bug is old and SpiderMonkey was fixed way
> back then to follow ES3.
>
> > hasOwnProperty does not check the prototype chain
>
> That is what its name implies. That's necessary.
>
> > propertyIsEnumerable does not check the prototype chain
> > propertyIsEnumerable returns all enumerable properties in an object
> > instance
>
> You must mean "returns true for" in the last sentence above. I would
> say "obj.propertyIsEnumerable(id) returns true if id names a direct
> (own) enumerable property of obj".
>
yes:
propertyIsEnumerable returns true for all enumerable properties in an object
And my point was that it appears to duplicate functionality of
hasOwnProperty in a differently named method. The fact that the method
was called propertyIsEnumerable instead of isPropertyEnumerable is not
great, but the way propertyIsEnumerable is designed is confusing to
developers.
propertyIsEnumerable and hasOwnProperty are interchangeable (in
conforming hosts, not JScript)
> > All programmer defined values are enumerable (ES3)
> >
> > A conforming implementation of ES3 should see no difference between
> > propertyIsEnumerable and hasOwnProperty.
>
> But if we change propertyIsEnumerable to look up the prototype chain,
> and if a programmer defines a property on a prototype object, then
> the behavior of code that calls propertyIsEnumerable changes
> incompatibly -- it could break that programmer's code.
>
A useful and important feature.
> > @liorean -- time-warp reading your message...
>
> It looks like you replied only to me -- or did you reply-all and I'm
> missing headers on your message?
>
Ug. I'm retarded :P
Sorry
Garrett
> /be
>
>
>
--
Programming is a collaborative art.
More information about the Es4-discuss
mailing list