ES4 draft: Object

Lars Hansen lhansen at
Fri Mar 7 04:42:59 PST 2008

> -----Original Message-----
> From: es4-discuss-bounces at 
> [mailto:es4-discuss-bounces at] On Behalf Of Andrea 
> Giammarchi
> Sent: 7. mars 2008 00:25
> To: Es4-discuss at
> Subject: Re: ES4 draft: Object
> Garrett Smith wrote:
> > obj = {dontenum length: 10} );
> > vs.
> >
> > obj = {length: 10};
> > obj.propertyIsEnumerable("length", false);
> >
> > Which is more ugly?
> >
> > Garrett
> Of course I prefere the first line but these two cases are different.
> I wonder if a builtin method will not cause more problems 
> instead of avoiding them.
> What I mean is what is the expected behaviour in this case?
> Object.prototype.propertyIsEnumerable("length", false); // 
> some stuff ... and then ...  
> Object.prototype.propertyIsEnumerable("length", true);

Clearly length is meant not to be enumerated between the first call and
the second call.  We might want to consider pinning down what would
happen if an enumeration of an object is going on when the
enumerabilitiy of one of its properties is changed.  The details of that
would likely be compatible with what happens if a property is deleted or
added during enumeration, and the meaning of that is already defined in
ES3 (unvisited deleted properties are not visited; added properties may
or may not be visited).

> I think Object.prototype is the perfect case scenario where 
> this built in method could cause more chaos than ever, while 
> the dontenum in declaration makes sense specially when I 
> write my own object and/or prototoype and I would like that 
> no one will be able to change my not enumerable property. 

Which is only one of the problems we're trying to solve, though.

> So 
> I guess built in method is error/conflicts/problems prone 

But it solves a problem that it's important to solve and that is not
solved declaratively.

> while the first one is quite safer (and at the same time, I 
> do like to know if others add some Object.prototype, both to 
> avoid conflicts, problems, and errors)
> These are only my 5 cents to this interesting discussion.



More information about the Es4-discuss mailing list