ES4 draft: Object

Yuh-Ruey Chen maian330 at
Sat Mar 8 13:16:57 PST 2008

Brendan Eich wrote:
> > - Users may think this dontenum namespace is magical and yet another
> > thing to keep in mind, when it really just relies on the namespace  
> > trick
> > you mentioned. With the introduction of classes and namespaces, the
> > rules of enumerability are already more complex, so this adds to the
> > cognitive load slightly.
> Slightly, but it takes away the magic DontEnum attribute, formerly  
> hogged by the specification and magic predefined objects.

But doesn't DontEnum still have to be there for ES3 objects? How else 
would you prevent the enumeration of ES3 builtin methods, e.g. 
Object.prototype.toString()? Or is there some more open namespace magic 
that I'm unware of?

> > BTW, if setPropertyIsEnumerable() is added,
> > would it be possible to make fixtures enumerable? Enumerability is
> > orthogonal to static analysis (which fixtures are meant to help with),
> > so I don't see why not.
> This gets to the heart of the public vs. public-in-context-of-class- 
> or-package issue. We need to sort this out to find out exactly how  
> orthogonal enumerability is, as well as decide how flexible it should  
> be.

Well, I think the only overlap is that public-in-class-context methods 
(or any method really) default to be non-public in terms of enumerability

> > - The name sucks :p
> Indeed. How about 'hidden' or 'nonEnumerable'?

I'd prefer 'hidden', since 'nonEnumerable' implies more strongly that a 
prop needs to be in that namespace to not be enumerable, when that's not 
the case.

Which gets me back to the cognitive load issue. Even with a name like 
'hidden', they may think they may have to do some funky syntax like 
|obj.hidden::other_ns::prop| do hide a prop in another namespace.

While we're on the topic of namespaces, I read in the ES4 overview: "In 
addition, the names internal, public, protected, and private denote 
namespace values, but the values depend on the context of the use." As 
the wiki doesn't talk about this, and the online spec is 
inaccessible/outdated, can you elaborate on this? I wonder if 'private' 
could be used somehow for enumerability.

-Yuh-Ruey Chen

More information about the Es4-discuss mailing list