According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString `Function.prototype.toString` is supposed to throw a `TypeError` exception when used on a function proxy. That's also consistent with how it's defined at http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.tostring but presumably only because the Proxy scenario is not explicitly mentioned.
The problem I see with that is that it makes proxies distinguishable from their targets even if they don't specify any traps. At least in cases where the mere existence of a proxy needs to be kept secret, this introduces a severe limitation. That behavior also goes against the "transparent virtualization" principle as outlined by Axel Rauschmayer (see http://www.2ality.com/2014/12/es6-proxies.html#transparent_virtualization_and_handler_encapsulation ): > Proxies are shielded in two ways: > > - It is impossible to determine whether an object is a proxy or not (transparent virtualization). > - You can’t access a handler via its proxy (handler encapsulation). Thomas
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss