(function foo(){}).propertyIsEnumerable("prototype"): true or false?

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Thu Sep 3 20:48:47 PDT 2009


>ES3, 15.3.5.2, says the prototype property of function instances is enumerable.
>ES5, 13.2 step 17, says the prototype property of function instances is not enumerable.

ES5, 15.3.5.2 also says non-enumerable  so at least it is internally consistent.
I don't recall this specific change but tomorrow I'll look at some back drafts and see if I can identify when/why the change was made.
Non-enumerable seems like the preferable value but I don't think we would have made an incompatible change unless we both thought the old definition was "wrong" and the actual web was inconsistent. Since Chrome wasn't yet around when some of these decisions were made 3 out of 4 major browser implementations were probably non-enumerable at the time.

>-----Original Message-----
>From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] On Behalf Of Jeff Walden
>Sent: Thursday, September 03, 2009 8:15 PM
>To: Mark S. Miller
>Cc: es-discuss at mozilla.org
>Subject: Re: (function foo(){}).propertyIsEnumerable("prototype"): true
>or false?
>
>On 3.9.09 20:04 , Mark S. Miller wrote:
>> I don't remember discussing this. But if we had, our general principle
>> is that we first need to be compatible with the cross-browser web, and
>> only second with the text of the ES3 standard. A bit of testing
>> reveals that 'prototype' is enumerable on Firefox and not on Safari or
>> Opera. Someone with Windows should test IE. If it isn't enumerable on
>> IE, then the governing principle would be the three of four browsers
>> heuristic. If it is, then since the four browsers are split, either
>> decision is compatible with the cross browser web so we should codify
>> whatever seems most sensible.
>
>Chrome: enumerable
>Firefox: enumerable
>IE: not enumerable
>Safari: not enumerable
>Opera: not enumerable
>
>I doubt there's serious reliance on enumerability or lack thereof of
>prototype on functions, given this.  The results are semi-inconclusive,
>but given the late date that's a good vote for leaving ES5 as-is, with
>the incompatible change, in my book.  I'll assume such unless others
>think this is worth more discussion.
>
>Jeff
>_______________________________________________
>es-discuss mailing list
>es-discuss at mozilla.org
>https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list