Attribute defaults for Object.defineProperty

Allen Wirfs-Brock Allen.Wirfs-Brock at
Wed Aug 20 11:00:24 PDT 2008

Mark S. Miller wrote in: Look Ma, no "this"

> (Assuming that absent attributes default to false, which I don't think is currently the case in the ES3.1 draft.)


The default values for [[Writable]], [[Enumerable]], and [[Flexible]] are all true as currently specified in Table 3 of Section 8.6.1.  These defaults apply no matter how a property is created (by an object literal, implicitly by assignment, by defineProperty and friends).  The defaults exactly match the default settings of the corresponding ES3 attributes so there is no semantic change for the property creation forms that already exist in ES3.

For consistency, I would think, that the default attribute values when a property is defined using defineProperty should remain the same as the default for other property definition forms.  Making it different just increases the complexity of the language.

I don't really see why the current defaults should be a problem because whatever attributes you want "class members" to have you can achieve by explicitly specify the attribute value in the descriptors.  Besides, such class definitions will ultimate get sugared.

Finally, as I believe we have casually discussed, I can imagine that for ES-harmony we decide we want to introduce the concept of "method" properties.  If we do they could have different attributes and different defaults.

I'd like to resolve this fairly quickly so we can  try to finalize the relevant parts of the 3.1 specification.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Es-discuss mailing list