Allen Wirfs-Brock (2015-04-21T01:18:40.000Z)
d at domenic.me (2015-05-01T13:02:14.636Z)
On Apr 20, 2015, at 12:39 PM, Jason Orendorff wrote: > I agree with all of this, except I don't see where the attempt is > rejected. Since the property is configurable, I think > [[DefineOwnProperty]] succeeds. > > The property is still non-writable afterwards. Only the value changes. > > So this isn't breaking the object invariants: the property in question > is configurable, so it's OK (I guess) to change the value. It's just > surprising for assignment syntax to succeed in doing it. I think it's bogus and needs to be corrected. Not only does it allow (in weird cases for [[Set]] (ie, assignment) to change the value of a non-writable property. It also means there are cases where [[Set]] will convert an accessor property to a data property. In combination, I think this is a serious bug that needs to be fix in the final published ES6 spec. The fix I propose is in 9.1.9 to replace Set 5.e as follows: ``` 5.e If existingDescriptor is not undefined, then i. If IsAccessorDescript(existingDescript), return false. ii. If existingDescriptor.[[Writable]] is false, return false. iii. Let valueDesc be the PropertyDescriptor{[[Value]]: V}. iv. Return Receiver.[[DefineOwnProperty]](P, valueDesc). ``` Lines 5.e.i and 5.e.ii are new additions. Thoughts?