2013/5/9 Brendan Eich <bren...@mozilla.com>

> Andreas Rossberg wrote:
>
>    (And let's bury setPrototypeOf quickly.)
>>
>
> Bury how? IIUC this goes in main spec alongside ES5's
> Object.getPrototypeOf, requires a proxy trap, etc.


Here's one potential alternative: add Reflect.setPrototypeOf but not
Object.setPrototypeOf.

Rationale:
- Under Allen's proposal upstream of this thread, proxies will require a
setPrototypeOf trap, regardless of whether we expose Object.setPrototypeOf
(proxies will need to intercept protosetter.call)
- every trap in the Proxy API has a corresponding method with matching
signature in the reflection module to make it easy for proxies to forward
intercepted ops.
- it follows that we'll have Reflect.setPrototypeOf in the reflection module

The question then becomes whether we additionally want to expose an
Object.setPrototypeOf alias for this method.

Putting the setPrototypeOf method only in the reflection API but not on
Object could be a way of telling developers that setting the prototype of
an object is a reflective operation, to be used with some care, not a
general utility function to be used routinely.

Cheers,
Tom
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to