2011/12/19 Tom Van Cutsem <tomvc...@gmail.com> > Calling the trap and catching a special exception is something that we > have avoided in the proxy design thus far. One possibility is to have the > "getPrivate" trap return a boolean. If the trap returns false, the proxy > will forward the private name access. This would allow the getPrivate trap > to check whether the "public" argument corresponds to one of its own > private names. If not, it just returns false (no throwing exceptions or > calling special Proxy.getDefault methods needed). >
Sorry, this doesn't work. The getPrivate trap already uses its return value to indicate the value of the private name. So yes, if the getPrivate trap wants to trigger the "default behavior" it either has to throw a special exception or return a special unique value to indicate this. It's an interesting difference with all other traps, which can just perform the default forwarding behavior by calling one of the Reflect.* methods. Obviously, we can't provide a Reflect.getPrivate(target, public) since that breaks the entire point of the private/public distinction.
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss