Mameri, Fred (HBO) (2014-05-08T21:09:59.000Z)
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]]...

Fred

From: John-David Dalton <john.david.dalton at gmail.com<mailto:john.david.dalton at gmail.com>>
Date: Thursday, May 8, 2014 at 1:25 PM
To: es-discuss Steen <es-discuss at mozilla.org<mailto:es-discuss at mozilla.org>>
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 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#Description (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 https://github.com/lodash/lodash/blob/2.4.1/dist/lodash.js#L112-L117

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?

- JDD

---------------------------------------------------------------------
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: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140508/e92ccb5a/attachment.html>
domenic at domenicdenicola.com (2014-05-13T19:16:07.038Z)
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]]...