Closed
Bug 706324
Opened 13 years ago
Closed 12 years ago
Infer reasonable display names for anonymous functions
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 433529
People
(Reporter: cdleary, Unassigned)
Details
I just saw: http://stackoverflow.com/questions/7583878/function-name-in-stack-trace-of-spidermonkey Seems like displayName could be a nice feature for use in debugging / generating backtraces. Is this known / interesting to us?
Comment 1•13 years ago
|
||
It's definitely of interest. Of course, we need to ensure that the debugger doesn't get snagged if someone changes displayName to a setter property, but that can be arranged.
Comment 2•13 years ago
|
||
For what it's worth, a debugger implemented using the new Debugger API could choose to display any sort of name it wants for a function. This could be implemented without engine changes.
Reporter | ||
Comment 3•13 years ago
|
||
Yeah, but it seems like this a feature that would be used in engine output in general, no? i.e. if we were to display any kind of name-related message to the user we would canonically call into some kind of DisplayName helper?
Comment 4•13 years ago
|
||
Calling into user code like that makes it pretty easy to change language semantics -- suddenly that TypeError you were going to throw ends up being something else. I am wary of consulting the user much when it comes to generating error messages and the like. See bug 633623.
Reporter | ||
Comment 5•13 years ago
|
||
Good point: I think my experience with Python is that they silently squash errors that occur during the VM's user reporting process (i.e. stringifying an exception object throws an error, so they just display nothing), which can be quite confusing. I guess another question is: why is the name property of functions non-writable?
Comment 6•13 years ago
|
||
(In reply to Chris Leary [:cdleary] from comment #5) > Good point: I think my experience with Python is that they silently squash > errors that occur during the VM's user reporting process (i.e. stringifying > an exception object throws an error, so they just display nothing), which > can be quite confusing. Trying to figure out what to do in the debugger when the debugger code itself throws an exception was kind of tricky. We have an uncaughtExceptionHook, but what to do when *that* throws an exception? (Our answer was, you got your second chance and blew it, just terminate the code, as if you'd gotten a slow script abort.) > I guess another question is: why is the name property of functions non-writable? It's not specified by ECMAScript...
Reporter | ||
Comment 7•13 years ago
|
||
So I suppose this is closeable as WONTFIX.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
Comment 8•12 years ago
|
||
This really needs to be fixed, folks. Right now our debugger commonly produces stack traces that look like: [unnamed function] [unnamed function] [unnamed function] This is crap, and whether one introduces a content-visible property to do it is completely beside the point. This is a high-priority debugger task, because it's a fundamental usability issue.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Comment 9•12 years ago
|
||
(In reply to Jim Blandy :jimb from comment #8) > [unnamed function] > [unnamed function] > [unnamed function] To be clear: these functions are things like: Tabzilla.open = function () { ... } To not display "Tabzilla.open" there is willful ignorance.
Comment 10•12 years ago
|
||
Relevant literature and art: Naming Anonymous Javascript Functions (http://johnjbarton.github.com/nonymous/index.html)
Comment 11•12 years ago
|
||
(In reply to Josh Matthews [:jdm] from comment #10) > Relevant literature and art: Naming Anonymous Javascript Functions > (http://johnjbarton.github.com/nonymous/index.html) Woot! Thanks!
Updated•12 years ago
|
OS: Linux → All
Hardware: x86_64 → All
Summary: Implement displayName for function objects → Infer reasonable display names for anonymous functions
Comment 12•12 years ago
|
||
Is this just a dup of 433529, since work is actually being done there?
Comment 13•12 years ago
|
||
I'd say it is a duplicate
Status: REOPENED → RESOLVED
Closed: 13 years ago → 12 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•