Proposal

(Also see the discussion page for this proposal)

All that is needed is a way to set the magic internal DontEnum bit. Extend Object.prototype.propertyIsEnumerable() so you can query, set, or clear the internal DontEnum bit. The E parmeter has positive sense even though the ECMAScript spec DontEnum bit has negative sense.

   function propertyIsEnumerable(P, E=undefined):Boolean
   {
       var old = !DontEnum(P)
       if (!DontDelete(P)) {
          if (E is Boolean)
              DontEnum(P) = !E
       }
       return old
   }

Need to specify:

  • Interaction with for-in, probably

Interaction with for-in should be well-specified by iterators and generators based on DontEnum.

Brendan Eich 2007/05/29 10:33

 
proposals/enumerability.txt · Last modified: 2008/07/14 18:32 by jodyer
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki