Function identity of non-configurable accessors
brandon at brandonbenvie.com
Wed Dec 19 08:30:52 PST 2012
It only has to be a handful of accessors, no? I was thinking basically of
just the few things on the global object that need this treatment.
location, document, window, navigator, maybe a few others? And location is
the only one with a setter, so we're mostly just talking about getters on
the global object. Since it's the global object, you could just call the
getter directly and `this` will implicitly be the correct receiver when
called inside the context. So the remaining situations in which it's
difficult are in the parent frame when you want to do this one of the
handful of properties that have this treatment.
An option that might have uses in other places as well is a kind of
primitive version of call, bind, and apply that have the null prototype,
frozen treatment. They could be singletons over the entire runtime, across
realms, and be attached to any function in any realm (including these
accessors) without leaking anything.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss