Where in spec does it explain why setting the value of an existing property will change its [[Enumerable]] attribute.

John-David Dalton john.david.dalton at gmail.com
Tue Aug 16 21:44:30 PDT 2011


So @kitcambridge and I were talking spec and started trying to find in
spec something that explains why something like:

Array.prototype.reduce which is by default  { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } will change to
[[Enumerable]]: true when:

Array.prototype.reduce = function() {…};

So far we have struck out.
In ES3 we found 8.6.2.2 [[Put]](P, V)
http://bclary.com/2004/11/07/#a-8.6.2.2
and its step 4:
4. Set the value of the property to V. The attributes of the property
are not changed.

And then we dug into ES5.1 and its [[Put]]
http://es5.github.com/#x8.12.5
and its step step 3a which leads to [[DefineOwnProperty]] with a Desc
of {[[Value]]: V} and its step 10b to 12, then 13.

but couldn't find where it stated changing the [[Enumerable]] attribute.

Would you all help point to where this is defined in spec?

Thanks,
JDD


More information about the es-discuss mailing list