> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Andrea > Giammarchi > Sent: 7. mars 2008 00:25 > To: [email protected] > 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. Appreciated. --lars _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
