This was sent to es5-discuss even though the original thread was on es-discuss
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of David-Sarah Hopwood Sent: Thursday, August 13, 2009 11:34 AM To: [email protected] Subject: Re: debugging interfaces Jordan Osete wrote: > Then, if we accept the idea of keeping only a reference to the objects > until information about them is explicitly requested, couldn't we do the > same things for the variables and arguments objects ? Keeping a reference to these would interfere with the use of optimized calling conventions where arguments are only stored in machine registers and never reified (when 'arguments' is not referred to). Similarly for variable frames, which need not be reified unless they are captured by a closure. >> have an Error.captureStackTrace(error, cutoff_opt) function that >> allows you to attach a stack trace to any object, say: >> >> function MyError(message) { >> this.message = message; >> Error.captureStackTrace(this, MyError); >> } >> >> If you pass a function as the cutoff argument all stack frames above >> and include the topmost call to that function will not be included in >> the stack frame. This was intended to solve the getStackTrace problem >> you describe in the proposal but it turns out that it can also be >> useful to hide more of the stack trace, to avoid cluttering it with >> the internal mechanics of library code. >> > If I understand it well, Error.captureStackTrace only works with an > object that has been used with throw ? Christian will correct me if I'm wrong, but I would assume the stack trace is captured at the point where Error.captureStackTrace is called, and so there is no requirement for the object to have been thrown. -- David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com _______________________________________________ es5-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es5-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

