Re: API to get stack frame info from generator

2013-06-22 Thread Bruno Jouhier
Thanks all. A few words for the API: I introduced two calls because I wanted to have minimal overhead to capture the stack. So I'm only capturing the continuation value (an integer). I'm using the other call (GetStackFrame) to format the stack trace. The disadvantage of this approach is that I hav

Re: API to get stack frame info from generator

2013-06-22 Thread Erik Arvidsson
Bruno, looks very useful. We should make sure that whatever stack API we propose also allows you to get the stack frame for generator. On Sat, Jun 22, 2013 at 11:29 AM, Brendan Eich wrote: > Bruno: cool, maybe we can build on this in SpiderMonkey too. Cc'ing Jason > and Dave. > > Cc'ing Arv in ca

Re: API to get stack frame info from generator

2013-06-22 Thread Brendan Eich
Bruno: cool, maybe we can build on this in SpiderMonkey too. Cc'ing Jason and Dave. Cc'ing Arv in case he is reading es-discuss only sporadically. /be Mark S. Miller wrote: Excellent. This looks like the right kind of low level enabler. Thanks! On Sat, Jun 22, 2013 at 3:01 AM, Bruno Jouhier

Re: API to get stack frame info from generator

2013-06-22 Thread Bruno Jouhier
For info, I've created a small node.js add-on that exposes a getStackFrame(generator) function: https://github.com/bjouhier/galaxy-stack. With this I could implement long stacktrace in my "galaxy" module; Temporary hack but it's there for experiments until the API gets sorted out. ___

Re: API to get stack frame info from generator

2013-06-17 Thread Chad Austin
Hi Mark, 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

Re: API to get stack frame info from generator

2013-06-17 Thread Andy Wingo
On Sat 15 Jun 2013 19:17, David Bruant writes: > Le 15/06/2013 11:18, Bruno Jouhier a écrit : >> A generator object represents a computation which has been >> suspended. We have an API to resume this computation >> (next/throw). What's missing is an API to get information about this >> suspended

Re: API to get stack frame info from generator

2013-06-15 Thread David Bruant
Le 15/06/2013 11:18, Bruno Jouhier a écrit : A generator object represents a computation which has been suspended. We have an API to resume this computation (next/throw). What's missing is an API to get information about this suspended computation (which function, where in the source). As an as

Re: API to get stack frame info from generator

2013-06-15 Thread Bruno Jouhier
Yes, that's the problem. My library is keeping a stack of suspended generators that corresponds to the stack of "await" calls. When an exception occurs I rethrow it into the suspended generators until it gets caught (see the run function in https://github.com/bjouhier/galaxy/blob/master/lib/galaxy.

Re: API to get stack frame info from generator

2013-06-14 Thread Brandon Benvie
On 6/14/2013 7:02 PM, Kevin Gadd wrote: Is it possible to 'throw into' an ES6 generator? This is what `generator.throw(exception)` does. Or are you referring to something else? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.or

Re: API to get stack frame info from generator

2013-06-14 Thread Kevin Gadd
If I understand this right, essentially the problem is that an exception could occur when some of the involved code is not alive on the stack (because the generator(s) are suspended), and without the ability to capture this information, the end user has no actual knowledge of why the exception occu

Re: API to get stack frame info from generator

2013-06-14 Thread Bruno Jouhier
Thanks David. The problem is that I need it first in node.js, and if possible with a standardized API that works in all ES6 JS engines. I see this as being similar to asking for a portable "stack" property in Error objects. I don't know if it is actually mandated by ES6 but it looks like all major

Re: API to get stack frame info from generator

2013-06-14 Thread David Bruant
Le 14/06/2013 16:56, Bruno Jouhier a écrit : I'm using ES6 generators to implement a little async/await library and I'm quite pleased with the result so far but I'm lacking one API: a function to get stack information from a generator object. Ideally it would return the name of the current gene

API to get stack frame info from generator

2013-06-14 Thread Bruno Jouhier
I'm using ES6 generators to implement a little async/await library and I'm quite pleased with the result so far but I'm lacking one API: a function to get stack information from a generator object. Ideally it would return the name of the current generator function, the filename and the line number