Calling toString on function proxy throws TypeError exception
Mark Miller
erights at gmail.com
Mon Oct 26 19:39:09 UTC 2015
Only because typeof f === 'function' divides the world into callables and
non callables.
On Oct 26, 2015 3:20 PM, "Allen Wirfs-Brock" <allen at wirfs-brock.com> wrote:
>
>
> > On Oct 26, 2015, at 11:20 AM, Mark Miller <erights at gmail.com> wrote:
> >
> > I like the idea a function proxy is more encapsulating of its
implementation than a function is.
> >
> > I also like the idea of treating a function proxy as a builtin
callable, rather than a function written in JS, and return something like
"function () { [function proxy] }" as Tom suggested or "function () {
[native code] }" as Claude suggested. We need progress on the draft spec
for F.p.toString reform, including the standardized pattern for the
function sources that are not supposed to parse, e.g., "function () {
[...stuff...] }”.
>
> I guess I still don’t understand the use case for applying there built-in
F.p.toString to any callable. If you are explicitly defining a callable
proxy you may want to define a `toString` method for it that does something
that makes sense for the specific kind of callable you are creating. But
when you expect to do:
>
> ```js
> evalableString = Function.prototype.toString.call(anyOldCallable);
> ```
>
> with the expectation that the result you are going to get will be useful
for anything?
function () { [...] } is how callables I idiomatically give a response that
is not useful for anything. That's all, but it is enough.
>
> Allen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151026/fd22b987/attachment.html>
More information about the es-discuss
mailing list