Subclassing ES6 objects with ES5 syntax.

Tom Van Cutsem at
Tue Apr 28 18:20:13 UTC 2015

2015-04-28 5:01 GMT+02:00 Kevin Smith <zenparsing at>:

> Looking over the Reflect namespace, I also see that Reflect.get and
> Reflect.set have been given powers not expressible with syntax:  the
> receiver does not have to be a prototype parent of the target.

Did you mean "the receiver does not have to be a prototype [child] of the
target"? I would expect that to be the common case. Anyway, with __proto__
/ setPrototypeOf as part of the language, two objects being in a
parent-child prototype relationship is not an invariant you can always
count on. Additionally, if the property is an accessor, the receiver
argument is passed as the `this` binding into the accessor. But it's easy
enough to call getOwnPropertyDescriptor, extract the getter or setter, and
`call` it with a this-binding that also isn't in a prototype relation with
the object holding the accessor. So, for Reflect.{get|set} at least, I
don't see an issue.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list