[Harmony Proxies] Proposal: Property fixing

Sean Eagan seaneagan1 at gmail.com
Thu May 5 12:37:02 PDT 2011

> So in this proposal, once an individual property has been fixed, any
> access/assignment to it can no longer be intercepted? I'm not sure whether
> that's always beneficial. We are then taking away some power of proxies to
> ensure more consistency, but maybe this additional power is still needed in
> some wrapping scenarios. Consider a hypothetical scenario in which a funky
> host object ignores the "configurable" attribute. Proxies won't be able to
> patch it up anymore. (I have no idea how likely such scenarios actually are
> though)

ES5 section 8.6.2 does mention some constraints around host object's
[[Configurable]] internal properties, but it doesn't explicitly forbid
them from ignoring it from what I can tell.

> Also, as you point out, full consistency across all traps is difficult to
> guarantee, so does it make sense to enforce consistency for some traps but
> not for others? The overall behavior of the proxy may still be inconsistent.

The only traps for which it would be difficult to enforce consistency
are proxy level traps not specific to individual properties, so it
might make sense to let these traps remain unconstrained anyways
unless and until the proxy as a whole is fixed via the "fix" trap.

> I do see benefit in this proposal as an aid for proxy writers to develop
> more well-behaved proxies. But for that purpose it seems that this proposal
> can be fully written as a Javascript library layered on top of the existing
> API.

But couldn't the same be said of the "fix" trap, frozen prototype, and
frozen typeof for proxies ?

Also, since proxies are not allowed to advertise their properties as
non-configurable, without something like this proposal proxy
transparency cannot be achieved.  With the current API, one could
implement a "Proxy.isProxy" function as follows...

Proxy.isProxy = function(objectOrProxy) {
  let unlikelyPropertyName = "_ at _*_&_%_+_!_";
  Object.defineProperty(objectOrProxy, unlikelyPropertyName, {});
  return Object.getOwnPropertyDescriptor(objectOrProxy,

Sean Eagan

More information about the es-discuss mailing list