Tom Van Cutsem wrote:
If __proto__ is getting standardized, I propose we adapt proxies to be
able to trap getPrototypeOf.
Why?
- with __proto__, stable prototypes are no longer an invariant. It's
awkward to make proxies go out of their way to maintain it still.
- it's much more consistent with all the other Object.* methods:
Object.keys(proxy) => calls keys trap
Object.getPrototypeOf(proxy) => calls getPrototypeOf trap
- it makes membranes much simpler, because they can now do:
getPrototypeOf: function(target) {
return wrap(Object.getPrototypeOf(target));
}
This saves the extra object allocation to create a dummy target with a
wrapped prototype.
To be consistent with the other traps, if we buy into a getPrototypeOf
trap, we should add a getPrototypeOf method in the "reflect" module as
well (basically an alias for Object.getPrototypeOf).
Your thoughts?
Perfect! Thanks for tracking the notes and suggesting all this. I'll
leave it to you, Allen, and whoever else is interested to work out spec
details.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss