Mark S. Miller (2013-06-18T16:57:31.000Z)
github at esdiscuss.org (2013-07-12T02:27:37.717Z)
On Mon, Jun 17, 2013 at 11:33 AM, Chad Austin <chad at imvu.com> wrote: > I'm the author of IMVU's task system, which is very similar to what Bruno > describes except with Python Futures and Python generators. Python > provides stack traces as a linked list of activation records from the > thrower to the catcher. On the other hand, Error().stack in most > JavaScript implementations returns a complete stack trace all the way up to > the main event loop. Python's linked list stack traces allows stitching > them together so that if async generator A yields to async generator B, and > B throws, both A and B can be made to appear in the stack together. > Finally, and this is key, Python attaches stack traces to the act of > _throwing_ and not to the exception object itself. I hope we can stitch together stack traces in JS as well. This is desperately needed to make asynchronous and distributed code practical, more on a par with local synchronous code. Please follow the Causeway links in the email you're responding to. The Causeway work was done in the context of event-loops and promises, but not generators. We should explore how to extend its stack stitching approach to include generators. > I'm not familiar with the security or encapsulation issues with > Error().stack (is it that bad if Chrome and Firefox appear to support the > .stack property?) Yes. Fortunately on Chrome we can effectively [remove it](https://code.google.com/p/google-caja/source/browse/trunk/src/com/google/caja/ses/debug.js). > , but I would like to express my support for being able to stitch together > stack traces on the open web so that if something goes wrong developers > have a shot at diagnosing what happened. Native application developers > have dozens of fantastic options for phone-home crash reporting, but on the > web the best you can hope for is that your customer's browser supports > Error#stack and window.onerror provides the thrown exception. The built-in window.onerror can have/use the rights amplification powers of the getStack or @stacktrace in my previous message. This would not violate any security constraint, since untrusted scripts within a frame are denied direct access to their true window and global scope anyway. > p.s. E was hugely influential in my thinking about concurrency and led me > to build the task system at IMVU in the first place, so thanks! You are very welcome! Always nice to hear.