Tom Van Cutsem at
Tue Mar 12 12:03:51 PDT 2013

Hi Erik,

Yes, the proposal you're looking for is <>.

Adding this function to ES6 used to make even more sense since the spec
internally used [[GetPropertyDescriptor]], which got exposed in the old
Proxy API. With the internal MOP refactoring, and the shift to direct
proxies, this method is no longer needed internally or in the Proxy API.

That's not to say that it can still be a useful general-purpose reflection

If we do add it, I agree the reflect module is the proper place for it.


2013/3/12 Erik Arvidsson <erik.arvidsson at>

> I thought we talked about adding a function like getOwnPropertyDescriptor
> that walks the prototype chain. This is a common function and I have seen a
> lot of people polyfill this as Object.getPropertyDescriptor.
> Can we add @reflect getPropertyDescriptor that would work something like?
> export function getPropertyDescriptor(object, name) {
>   if (Object(object) !== object)
>     throw new TypeError();
>   return getPropertyDescriptorInternal(object, name);
> }
> function getPropertyDescriptorInternal(object, name) {
>   if (object === null)
>     return undefined;
>   var descr = Object.getOwnPropertyDescriptor(object, name);
>   if (descr)
>     return descr;
>   return getPropertyDescriptorInternal(Object.getPrototypeOf(object),
> name);
> }
> --
> erik
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list