[Webkit-unassigned] [Bug 13646] implement Error.prototype.stack

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 20 15:48:46 PDT 2007


http://bugs.webkit.org/show_bug.cgi?id=13646





------- Comment #5 from jwalden+bwo at mit.edu  2007-08-20 15:48 PDT -------
(In reply to comment #4)
> Is a null-valued property is better or worse design than an undefined value
> (or dynamically added property)?

I think the general practice is to share methods on the prototype but not
properties.  There doesn't seem to be a whole lot of point to adding "", null,
or what-have-you to the prototype if it's simply going to be overridden for
every new Error created.

> > Do also note this most likely degrades exception-throwing performance,
> > unless you garbage-collect stack frames or something like it (not likely
> > in the presence of native stack frames, and not otherwise useful in JS as
> > defined by the standard and by the Real World).
> 
> Some people find e.stack useful when debugging others' code -- I know I have,
> and at work, too! (not academic discussion at MIT)

I don't disagree; I'm simply saying that unless you do something like frame
garbage-collection (*this* is what I said wasn't useful in real-world JS, not
stack traces), you have to compute the value of the stack string when the
exception is thrown.  You can't lazily compute it, so you pay the cost of
creating it even if you never access the stack property.

> What is your useful, real world solution to obtaining a stack trace, Jeff? 

You misunderstood me.  I was simply indicating that implementing this will
probably regress performance, and given the concern WebKit has over perf (must
not regress, even with new functionality), that may be a problem for WebKit. 
(I personally would say the benefits outweigh the slowdown, and exceptions
being exceptional, you shouldn't be relying on their performance, but I
personally don't *need* WebKit to implement this, as I'm served well enough
elsewhere.)


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list