Calling toString on function proxy throws TypeError exception

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Oct 22 18:59:55 UTC 2015


> On Oct 22, 2015, at 11:43 AM, Mark S. Miller <erights at google.com> wrote:
> 
> I know that's true in general. But we made a few exceptions, especially for functions and arrays. I thought F.p.toString was one, but maybe not. I just don't remember.

There are no such special cases that I’m aware of, and I don’t know how they would work. See the proxy [[Call]] internal method http://ecma-international.org/ecma-262/6.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist <http://ecma-international.org/ecma-262/6.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist> 

This is basically a coordination issue between the access of a method via a proxy [[Get]] and the invocation of the retrieved function via a [[Call]. Essentially, the creation of a membrane is required to make it work. As I’m sure you will recall, we explored using an invoke trap to help deal with this sort of situation but eventually abandoned that.  At the time we recognized that proxies that only used default handler would not be transparent in such situations and decide that it would be ok.

Allen



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151022/20e73ea4/attachment.html>


More information about the es-discuss mailing list