B.3.1 The __proto__ pseudo property

Brandon Benvie bbenvie at mozilla.com
Mon May 20 11:29:59 PDT 2013


On 5/20/2013 10:55 AM, Andrea Giammarchi wrote:
> I believe having a counterpart in the Object, following a natural 
> expectation where for a get you've got a set, is just fine but surely 
> Reflect should have its own "reflection power" a part.
>
> I see Reflect more like an introspection tool able to understand 
> things and not necessarily mutate them ( yes, similar to what is 
> ReflectionClass or ReflectionMethod in PHP, that worked there, still 
> you cannot change an object class ).
>
> Reflect is a good place to put a `fn.caller` equivalent and not to set 
> one, so I don't see `setPrototypeOf` a good fit for that namespace.

One of the primary purposes of the Reflect module is to serve as support 
for Proxy handlers. For every type of trap that Proxy supports, there is 
a corresponding function in Reflect that does the default behavior for 
that trap. Given mutable [[Prototype]], a Proxy trap for `setPrototype` 
needs to exist, and by extension `Reflect.setPrototype[Of]` needs to exist.


More information about the es-discuss mailing list