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

Allen Wirfs-Brock allen at
Thu May 8 15:37:00 PDT 2014

On May 8, 2014, at 1:25 PM, John-David Dalton wrote:

> 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.
> Thoughts?

some prior discussions on this topic (or related): 

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

More information about the es-discuss mailing list