ToPropertyDescriptor, [[HasProperty]], & [[HasOwnProperty]]

Mameri, Fred (HBO) Fred.Mameri at
Thu May 8 14:09:59 PDT 2014

I agree with you that this would be a much better design, but it would break backwards compatibility with ES5, no?
Minor nitpick: I guess you mean to say that ToPropertyDescriptor should use the abstract operation HasOwnProperty, not [[HasOwnProperty]]...


From: John-David Dalton <john.david.dalton at<mailto:john.david.dalton at>>
Date: Thursday, May 8, 2014 at 1:25 PM
To: es-discuss Steen <es-discuss at<mailto:es-discuss at>>
Subject: ToPropertyDescriptor, [[HasProperty]], & [[HasOwnProperty]]

ES6 additions like Object.assign use [[OwnPropertyKeys]] for getting the keys of `source` objects. This helps avoid the method gotchas faced by developers previously with things like `Object.prototype.writable = true` and `Object.defineProperty(o, 'foo', { value: 'bar' })`.

See (bottom of section)

"Bear in mind that these options are not necessarily own properties so, if inherited, will be considered too. In order to ensure these defaults are preserved you might freeze the Object.prototype upfront, specify all options explicitly, or point to null as __proto__ property."

It's the reason I pre-populate my descriptor attributes with false even though false is the default. See

With methods like Object.assign using [[OwnPropertyKeys]] does it make sense to make things like ToPropertyDescriptor use [[HasOwnProperty]] too. I think it would be a win for consistency and dev use.



This e-mail is intended only for the use of the addressees.  Any copying, forwarding, printing or other use of this e-mail by persons other than the addressees is not authorized.  This e-mail may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, please notify us immediately by return e-mail (including the original message in your reply) and then delete and discard all copies of the e-mail. 

Thank you.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list