Hi Erik,

Yes, the proposal you're looking for is <
http://wiki.ecmascript.org/doku.php?id=harmony:extended_object_api>.

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
function.

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

Cheers,
Tom

2013/3/12 Erik Arvidsson <[email protected]>

> 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
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to