Hi Mark, Tom! I understand that you are currently working on finalizing a number of aspects of the proxies proposal, so I thought I'd send my current notes on issues I discovered. (Sorry if I'm a bit late with that, but I just returned from travelling.)
Here is a list of minor issues. I'll send a separate mail describing what I think is a more fundamental problem with the current spec. - Proxy.create: What if the handler passed is not an object? Should we throw right away? - Proxy.create: What if the prototype passed is neither an object nor null? FF silently sets it to null in all other cases, but that seems inconsistent with Object.create, which throws. - Proxy.createFunction: More of a question, but do we really want to support a separate construct trap for function proxies? I would argue that it was a mistake to ever make a distinction between a regular and a construct call. Even if we cannot clean that up, we should perhaps avoid having it proliferate further, in the proxy interface. - Derived get/set traps: They use .call on accessor functions taken from a user-defined descriptor. Such a function might itself be a proxy, in which case .call is not necessarily defined. Should invoke it through Function.prototype.call.call instead. (There may be other places in the current ES spec that assume that all functions have a call method. I think they should all be changed.) - Also, we should specify that the JS code assumes that all used intrinisc properties are the original methods. - Object.{seal,freeze,preventExtensions}: When sealing a function proxy, how do we initialize the standard properties length, constructor, prototype, caller, and arguments? What if the proxy does not define them already, or returns unsuitable values? - Function.prototype.toString: should this work for function proxies? - Function.prototype.bind: requires additional language explaining how the length property is set if the curried function is a proxy. - JSON: don't we need some changes here, too? For example, step 6a of the JO operation (15.12.3) talks about the "names of all the own properties" of an object. Clearly, for a proxy we need to invoke the appropriate trap here. - Outside the (current?) standard, but pragmatically, how should we treat .__proto__ on a proxy? FF and V8 both treat it as an ordinary property for proxies, but that implies that Object.getPrototypeOf(p) != p.__proto__ in general. - ToStringArray, step 6.a: s/array/O/ /Andreas _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss