2013/1/18 Claus Reinke <[email protected]> > PS. I probably shouldn't mention that Proxies' invariant checks > only against own properties behave differently from how non > Proxy objects behave, if a target prototype property happens to be > frozen (override prohibition non-mistake)? > > var x = Object.freeze({foo: 88}); > var y = Object.create(x); > > y.foo = 99; // fail > console.log( y.foo ); // 88 > > var yp = Proxy(y,{get:function(t,n,r){ return n==="foo" ? 99 : t[n] } }); > console.log( yp.foo ); // 99 >
Yep, this is true. But it doesn't violate any invariants since we could have made y.foo return 99 as well, if we had used Object.defineProperty to shadow 'foo'. Cheers, Tom
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

