[Webkit-unassigned] [Bug 153909] New: Bound functions toString method should return "bound " + the target function's toString()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 4 21:10:08 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=153909

            Bug ID: 153909
           Summary: Bound functions toString method should return "bound "
                    + the target function's toString()
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nvasilyev at apple.com
                CC: benjamin at webkit.org, burg at cs.washington.edu,
                    fpizlo at apple.com, ggaren at apple.com,
                    gskachkov at gmail.com, joepeck at webkit.org,
                    keith_miller at apple.com, mark.lam at apple.com,
                    msaboff at apple.com, nvasilyev at apple.com,
                    oliver at apple.com, sbarati at apple.com,
                    sukolsak at gmail.com, timothy at apple.com,
                    utatane.tea at gmail.com

Via Bug 153796 [ES6] bound functions .name property should be "bound " + the target function's name

We improved bound functions .name, but .toString() wasn't affected.

> function foo() {return 42}
> boundFunc = foo.bind(null)
> boundFunc.name
< "bound foo"
> boundFunc.toString()
< "function foo() {
      [native code]
  }"


What if we return the following instead:

> boundFunc.toString()
< "function bound foo() {return 42}"

or this:

> boundFunc.toString()
< "bound function foo() {return 42}"

I have no preference.

Two things are different from the current behavior:

1. Instead of "[native code]", the original content of the function is shown.
   This is much more convenient for debugging. Currently, all anonymous
   functions look alike:

   function () {
       [native code]
   }

2. Added "bound" prefix.


This is just an idea; I don't think ES6 spec touches this point.

What do you think?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160205/d06fe067/attachment.html>


More information about the webkit-unassigned mailing list