Attribute defaults for Object.defineProperty

Ingvar von Schoultz ingvar-v-s at
Sun Aug 24 11:07:42 PDT 2008

Garrett Smith wrote:
> It seems that the
> documentation is very unclear and that is the source of the confusion.
> The 3.1 draft defines [[Flexible]] as a property attribute:-
> | [[Flexible]]	boolean	If true, attempts to delete the
> | property or change its attributes will succeed. Otherwise,
> | the property is said to be sealed. See the description of the
> | delete operator in section 11.4.1, and the reflective Object
> | methods .
> That definition of [[Flexible]] seems to imply:
> 1) true - property can be deleted using - delete - operator.
> 2) false - property is sealed. What is sealed?

You missed a very important part: "or change its attributes".

[[Flexible]] affects what you can do with a property and its
attributes. It will feel more concrete if you change the word

| [[Flexible]] boolean If true, attempts to change the attributes
| of the property, or to delete the property, will succeed.

Ignore "sealed", that word adds confusion. [[Flexible]] is not
about an object as a whole.

There's a more informative description on page 9 of the PDF
document that is linked to here:
Quoting from there, the following text talks about what this
attribute affects:

| In ES3 the possible basic state transitions of a property are
| to create the property, to change the value of the property,
| and to delete the property. The ES3 ReadOnly and DontDelete
| property attributes regulate the ability make the latter two
| transitions. With the addition of getter/setter properties
| and reified property attributes, there are additional possible
| property state transitions such as replacing a getter or setter
| function, changing an attribute of a property, changing a data
| property into a getter/setter property, and changing a getter/setter
| property into a data property.

I hope this helps.

Ingvar von Schoultz

More information about the Es-discuss mailing list