Calling toString on function proxy throws TypeError exception

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


> On Oct 22, 2015, at 11:23 AM, Mark S. Miller <erights at google.com> wrote:
> 
> Tom, this doesn't sound right to me. Didn't we intend Function.prototype.toString to be transparent thru function proxies?
> 
> cc'ing Allen and Brian
> 

There is nothing unique to `toString` going on there.  This is just the problem that the default proxy handlers are not transparent across method calls in that they pass the proxy object rather than the target object as the `this` value to function that they ultimately invoke.  If that method needs to access internal slots of its `this` value or has `this` identify dependencies they don’t work.  It turns out that most Function.prototype methods have such dependencies. 

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


More information about the es-discuss mailing list