Controlling DontEnum (was: ES4 draft: Object)

Brendan Eich brendan at
Tue Mar 11 14:11:45 PDT 2008

On Mar 11, 2008, at 2:45 PM, Brendan Eich wrote:

> Proposal: Add Object.prototype.__makePropertyNonEnumerable__(name),
> defined as if by:
>      Object.prototype.__makePropertyNonEnumerable__ = function  
> (name) {
>          if (this has a direct property identified by name) {
>              set the DontEnum attribute for this[name];
>              return true;
>          }
>          return false;
>      }

Important missing statement after this one (I was getting on a plane  
and realized it was omitted just after shutting down :-/):


In ES4 terms, the spec would look like this (including reversion of  
propertyIsEnumerable to ES3 form):

Obvious changes to "Synopsis" left as exercise for reader ;-).

Under "Methods on Object instances":

intrinsic function propertyIsEnumerable(name: EnumerableId): boolean

private function propertyIsEnumerable(name) {
     if (!magic::hasOwnProperty(this, name))
         return false;

     return !magic::getPropertyIsDontEnum(this, name);

intrinsic function __makePropertyNonEnumerable__(name: EnumerableId):  

private function __makePropertyNonEnumerable__(name) {
     if (!magic::hasOwnProperty(this, name))
         return false;

     magic::setPropertyIsDontEnum(this, name, true);
     return true;

Under "Methods on the Object prototype object":

prototype function propertyIsEnumerable(name)

prototype function __makePropertyNonEnumerable__(name)


More information about the Es4-discuss mailing list