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

Oliver Hunt oliver at apple.com
Wed Aug 17 10:16:23 PDT 2011


On Aug 17, 2011, at 6:52 AM, John-David Dalton wrote:
> 
> Awesome! That was our conclusion too. It was late Kit and I missed
> trying it in other implementations (instead we dug into spec because
> we thought it was odd). It turns out V8 (Chrome, Node.js) has a bug
> that will make non-enumerable properties enumerable by assigning a new
> value as in my previous snippet :O

I suspect that this only applies to builtin properties on objects, as I think JSC has a similar issue.

Speaking for JSC (but i wouldn't be surprised if V8 did something similar) we will delay the creation of the majority of builtin properties until they're actually used, eg. until you actually access Array.prototype.reduce we won't reify the property.  A side effect of this is that when you simply assign to the property we skip reification, and so the property attributes are the same as you would get if you were creating a new property.

A simple test would be to see if
Array.prototype.reduce;
Array.prototype.reduce = ...

Results in the correct behaviour.

--Oliver

> 
> Thanks again,
> JDD
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110817/00653bbd/attachment.html>


More information about the es-discuss mailing list