Calling toString on function proxy throws TypeError exception

Thomas Greiner thomas at
Thu Oct 22 11:39:11 UTC 2015

According to
`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
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

> 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).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list