On __proto__ as a magical data property
brandon at brandonbenvie.com
Thu Jul 19 02:26:02 PDT 2012
Just to be clear on what's being said here, if it's possible to mutate a
[[prototype]] at runtime then there needs to be a setPrototype trap or
however __proto__ gets set needs to automatically set the proxy's internal
[[prototype]]. I'm, not sure if the last few messages were referring to
"[[prototype]] is mutable in any form]]" or "accessor __proto__ property"
(vs. magic data __proto__).
Current implementations kind of have the worst of both worlds. __proto__ is
a property (which is more commonly used than Object.getPrototypeOf even for
just reading value). It hits the get/set traps so it doesn't trigger any
normal magical mutation of the internal [[prototype]]. Since it's a proxy
you can still mimic the functionality by special casing the lookup and
setting of it and keeping an internal "proto" property, but this doesn't
reflect in Object.getPrototypeOf nor does it influence any internal engine
functionality. Take a look at how proxy objects are labeled in the WebKit
debugger if you want to see an example of how this fails.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss