Unconfigurable properties: why can I change [[Writable]] from true to false?
# Tom Van Cutsem (12 years ago)
The fact that [[writable]] can change for a non-configurable property is definitely intentional, see the state diagram MarkM once put up at < doku.php?id=es3.1:attribute_states&s=diagram>.
Cheers, Tom
2013/6/10 Axel Rauschmayer <axel at rauschma.de>
The fact that [[writable]] can change for a non-configurable property is definitely intentional, see the state diagram MarkM once put up at < http://wiki.ecmascript.org/doku.php?id=es3.1:attribute_states&s=diagram>. Cheers, Tom 2013/6/10 Axel Rauschmayer <axel at rauschma.de> > The ECMAScript 5.1 spec says (8.6.1): > [[Configurable]]: If false, attempts to delete the property, change the > property to be an accessor property, or change its attributes (other than > [[Value]]) will fail. > > On the other hand [[DefineOwnProperty]] (8.12.9) allows one to change > writability from true to false, even if a property is not configurable: > > 10 Else, if IsDataDescriptor(current) and IsDataDescriptor(Desc) are > both true, then > a. If the [[Configurable]] field of current is false, then > i. Reject, if the [[Writable]] field of current is false and the > [[Writable]] field of Desc is true. > ii. If the [[Writable]] field of current is false, then > 1. Reject, if the [[Value]] field of Desc is present > and SameValue(Desc.[[Value]], current.[[Value]]) is false. > b. else, the [[Configurable]] field of current is true, so any change is > acceptable. > > (10.a) seems to ignore the case of [[Writable]] of `current` being true. > Is this deliberate? > > Should the description of [[Configurable]] be changed to better reflect > the status quo? > > -- > Dr. Axel Rauschmayer > axel at rauschma.de > > home: rauschma.de > twitter: twitter.com/rauschma > blog: 2ality.com > > > _______________________________________________ > 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/20130610/a9082574/attachment.html>
# Allen Wirfs-Brock (12 years ago)
The corresponding text describing [[Configurable]] in the ES6 draft has already been updated to clarify that [[Writable]] can always be set to false.
The corresponding text describing [[Configurable]] in the ES6 draft has already been updated to clarify that [[Writable]] can always be set to false. Allen On Jun 10, 2013, at 4:57 AM, Axel Rauschmayer wrote: > The ECMAScript 5.1 spec says (8.6.1): > [[Configurable]]: If false, attempts to delete the property, change the property to be an accessor property, or change its attributes (other than [[Value]]) will fail. > > On the other hand [[DefineOwnProperty]] (8.12.9) allows one to change writability from true to false, even if a property is not configurable: > > 10 Else, if IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true, then > a. If the [[Configurable]] field of current is false, then > i. Reject, if the [[Writable]] field of current is false and the [[Writable]] field of Desc is true. > ii. If the [[Writable]] field of current is false, then > 1. Reject, if the [[Value]] field of Desc is present and SameValue(Desc.[[Value]], current.[[Value]]) is false. > b. else, the [[Configurable]] field of current is true, so any change is acceptable. > > (10.a) seems to ignore the case of [[Writable]] of `current` being true. Is this deliberate? > > Should the description of [[Configurable]] be changed to better reflect the status quo? > > -- > Dr. Axel Rauschmayer > axel at rauschma.de > > home: rauschma.de > twitter: twitter.com/rauschma > blog: 2ality.com > > _______________________________________________ > 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/20130610/fc6a69be/attachment.html>
# Axel Rauschmayer (12 years ago)
Excellent.
Excellent. On Jun 10, 2013, at 19:26 , Allen Wirfs-Brock <allen at wirfs-brock.com> wrote: > The corresponding text describing [[Configurable]] in the ES6 draft has already been updated to clarify that [[Writable]] can always be set to false. > > Allen > > On Jun 10, 2013, at 4:57 AM, Axel Rauschmayer wrote: > >> The ECMAScript 5.1 spec says (8.6.1): >> [[Configurable]]: If false, attempts to delete the property, change the property to be an accessor property, or change its attributes (other than [[Value]]) will fail. >> >> On the other hand [[DefineOwnProperty]] (8.12.9) allows one to change writability from true to false, even if a property is not configurable: >> >> 10 Else, if IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true, then >> a. If the [[Configurable]] field of current is false, then >> i. Reject, if the [[Writable]] field of current is false and the [[Writable]] field of Desc is true. >> ii. If the [[Writable]] field of current is false, then >> 1. Reject, if the [[Value]] field of Desc is present and SameValue(Desc.[[Value]], current.[[Value]]) is false. >> b. else, the [[Configurable]] field of current is true, so any change is acceptable. >> >> (10.a) seems to ignore the case of [[Writable]] of `current` being true. Is this deliberate? >> >> Should the description of [[Configurable]] be changed to better reflect the status quo? -- Dr. Axel Rauschmayer axel at rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130610/9bff4056/attachment-0001.html>
The ECMAScript 5.1 spec says (8.6.1):
(10.a) seems to ignore the case of [[Writable]] of
current
being true. Is this deliberate?Should the description of [[Configurable]] be changed to better reflect the status quo?