Expressing that a property is non-deletable
Le 18/12/2012 20:09, Mark S. Miller a écrit :
I see no reason why this needs to be a reflected property. As to whether it is an exotic internal property or just prose, that is a specification expository issue for which I defer to Allen. But the spec only needs such extra state for the exotic global object. There's nothing general about it.
I fully agree on the fact that if there was a "deletable" attribute it would be "local" to the global object and wouldn't need to be an attribute reflected on all objects. In ES5, we've been thinking of property attributes as absolute thing that apply to every single objects. Maybe it's time to give each sort of object a little bit of freedom to explain how their properties work, to allow the reflection methods to describe their internal contract more accurately than they currently can with configurable/writable/enumerable/get/set In this case, maybe there is value in having WindowProxy objects telling us whether or not a property is deletable or not (because the configurable boolean which is used for that in other objects doesn't have the same semantics here).
Maybe numerical attributes of NodeList could provide a "live" or "syncWithDOMTree" attribute clearly showing that they are not your regular numerical properties.
I'm putting maybe-s because I don't know if there is value in doing that, but the point I am trying to make is that this can be the way out to enable all objects to respect invariants while allowing different objects to express their internal contract.
2012/12/19 David Bruant <bruant.d at gmail.com>
Le 18/12/2012 20:09, Mark S. Miller a écrit :
I see no reason why this needs to be a reflected property. As to whether it is an exotic internal property or just prose, that is a specification expository issue for which I defer to Allen. But the spec only needs such extra state for the exotic global object. There's nothing general about it.
I fully agree on the fact that if there was a "deletable" attribute it would be "local" to the global object and wouldn't need to be an attribute reflected on all objects. In ES5, we've been thinking of property attributes as absolute thing that apply to every single objects. Maybe it's time to give each sort of object a little bit of freedom to explain how their properties work, to allow the reflection methods to describe their internal contract more accurately than they currently can with configurable/writable/**enumerable/get/set In this case, maybe there is value in having WindowProxy objects telling us whether or not a property is deletable or not (because the configurable boolean which is used for that in other objects doesn't have the same semantics here).
Maybe numerical attributes of NodeList could provide a "live" or "syncWithDOMTree" attribute clearly showing that they are not your regular numerical properties.
I'm putting maybe-s because I don't know if there is value in doing that, but the point I am trying to make is that this can be the way out to enable all objects to respect invariants while allowing different objects to express their internal contract.
Yes. This is exactly what I meant with using custom attributes to document exotic behavior.
Le 18/12/2012 19:56, Andrea Giammarchi a écrit :
I'm not entirely convinced by "sealed". The semantics of this new attribute would be about the effect of the "delete" operator, so I think it makes sense for it to have some "delete" in the name.