2012/11/26 David Bruant <[email protected]> > Le 26/11/2012 19:00, Tom Van Cutsem a écrit : > > 2012/11/24 Allen Wirfs-Brock <[email protected]> > >> >> I see that [2] 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. >
Yes, and that was my original intent. Re. my earlier message about extra overhead: I guess the overhead of special-casing __proto__ on property access is already present in engines that support __proto__, so for those it would be a sunk cost. Cheers, Tom
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

