The ES6 MOP (Was: New ES6 draft now available)
allen at wirfs-brock.com
Mon Nov 26 10:43:43 PST 2012
On Nov 26, 2012, at 10:13 AM, David Bruant wrote:
> Le 26/11/2012 19:00, Tom Van Cutsem a écrit :
>> 2012/11/24 Allen Wirfs-Brock <allen at wirfs-brock.com>
>> I see that  call for filtering __proto__ access in Get/Put handlers. I think that dealing with it in a Get/SetInheritance handler would be a much more efficient way to hand this extremely rare operation. Rather than filtering for it on every property access, an handler that cares only needs to worry about the actual Get/SetInhertiance.
>> Hmm, so you're arguing that proxy.__proto__ would be equivalent to Object.getPrototypeOf(proxy), and trigger the "getPrototypeOf" trap, rather than triggering the "get" trap?
>> I guess that more accurately reflects the magical behavior of __proto__.
> The magical behavior as it currently is in some engines, but not how it's described in the current strawman:
> var o = Object.create(null);
> var a = o.__proto__;
> a is undefined according to the current strawman. In this case, the "get" trap is what should be called if o was a proxy.
> With __proto__ spec'ed as in the strawman (own Object.prototype property), "get" really is the accurate trap.
With syntactic detection of o.__proto__ the semantics would be something like:
1) If o and object with dunder proto enabled, then return [[GetInheritance]] of O (using current draft internal method names)
2) else return [[GetP]] of o with "__proto__")
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss