Re: Reflect.defineProperty + FromPropertyDescriptor & ToPropertyDescriptor

2018-09-04 Thread Michael Dyck
On 2018-09-04 12:02 PM, Allen Wirfs-Brock wrote: At one point, early in the development of ES6 the draft spec. had a [[OriginalDescriptor]] field  (that may not be the actual name I used) in internal PropertyDescrptors that carried along a reference to the original descriptor object from

Re: Reflect.defineProperty + FromPropertyDescriptor & ToPropertyDescriptor

2018-09-04 Thread Allen Wirfs-Brock
> On Sep 4, 2018, at 12:32 AM, Darien Valentine > wrote: > > My understanding was that, in theory, using `Reflect` as your handler object > should mean the behavior of all the trapped operations should be the same as > it would have been for an ordinary object.

Re: Reflect.defineProperty + FromPropertyDescriptor & ToPropertyDescriptor

2018-09-04 Thread Darien Valentine
@Isiah: That seems like it would be likely to be a safe change since it would only make currently invalid PDs become valid. However I’m unsure if it’s sufficiently unambiguous as stated on account of PDs which set only metadata without also overwriting an existing get/set/value. For example,

Re: Reflect.defineProperty + FromPropertyDescriptor & ToPropertyDescriptor

2018-09-04 Thread Isiah Meadows
Personally, I'd prefer it just be handled this way: - If either `desc.get` or `desc.set` is not `undefined`, treat it as a data descriptor. - Otherwise, treat it as a value descriptor and ignore `desc.get` and `desc.set`. It'd be much easier to reason about, and I've personally had a few issues

Re: Reflect.defineProperty + FromPropertyDescriptor & ToPropertyDescriptor

2018-09-04 Thread Darien Valentine
On reflection (ha) I realize that there is an almost certainly safe change which can be made to address this in the Reflect.defineProperty case, which is to make Reflect.defineProperty alone return an object with a null prototype. I believe this would make it behave the same as ordinary

Reflect.defineProperty + FromPropertyDescriptor & ToPropertyDescriptor

2018-09-04 Thread Darien Valentine
The following instrinsic functions invoke the ToPropertyDescriptor internal operation to convert JS-object property descriptors into "Property Descriptors" (spec-internal object type): - `Reflect.defineProperty` - `Object.create` - `Object.defineProperty` - `Object.defineProperties` - a `Proxy`