ES4 draft: Object

Yuh-Ruey Chen maian330 at gmail.com
Fri Mar 7 13:14:34 PST 2008


Brendan Eich wrote:
> To avoid injecting a public name into Object.prototype, we could put  
> a new "setPropertyIsEnumerable" (yechh) name in the __ES4__  
> namespace. Then there's no breaking change. We do this already, of  
> course, but not for property attribute fiddling.
>   

Since enumerability only applies to for-in, how about the iterator 
namespace? Object.prototype.iterator::setPropertyIsEnumerable(prop, 
enable). For consistency, you could also have 
Object.prototype.iterator::isPropertyEnumerable(prop) which delegates to 
Object.prototype.isPropertyEnumerable(prop).

> An alternative we've discussed, which Ian also brought up: add a  
> keyword for declaring DontEnum properties.

This dontenum modifier can be used in addition to the method for 
convenience - it would make class declarations cleaner.

But despite that, I think dontenum is inelegant. Its only effect would 
be on the default enumerator, which is only one iterator, and AFAIK is 
not special at all. IMO, it isn't worth the bloat. If there was a way to 
define such modifiers within script, then I think the dontenum modifier 
would be nice. If such a capability is planned for a future ES edition, 
then I think dontenum is fine.

-Yuh-Ruey Chen



More information about the Es4-discuss mailing list