2015-10-27 12:47 GMT-04:00 Jordan Harband <[email protected]>: > > Shouldn't tests in existing code that rely on `Function#toString` not > throwing to indicate that something is callable, or throwing to indicate > that it is not, remain true for a function proxy? >
Excluding some host objects (as Boris pointed out), I think this does capture the programmer's expectation in the common case. When I wrote my Proxy shim for ES5 < https://github.com/tvcutsem/harmony-reflect/>, I got feedback from developers to patch F.p.toString() to please unwrap the proxy, as this seemed to be the general expectation (just like Array.isArray should return true for proxies-for-arrays). I don't have a strong opinion on whether F.p.toString() should drill through the proxy or just return "function() { [...] }", but would really like it not to throw. A function proxy is, for all intents and purposes, a valid function. Having F.p.toString report that it is called on an "incompatible object" just feels wrong. Even though just calling toString() would work fine on a membraned function proxy, the idiom of storing built-in functions in variables and explicitly .call()-ing those built-in functions is, to my understanding, still very common. Cheers, Tom
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

