I looked at the Reflect spec but did not find anything that would solve my 
problem. I'm going to try with a native extension. Looks like the 
JSGeneratorObject public C++ API may do it.

Bruno

On Friday, June 7, 2013 7:10:06 PM UTC+2, Bruno Jouhier wrote:
>
> Hi Andy,
>
> Thanks for your answer.
>
> Of course, there is always only one frame (I should have thought of it)! 
> So what I need is precisely this frame: the function name would be a 
> starter (but there is not always one). The filename and line number would 
> be a big plus.
>
> My little library implements async/await semantics and for this I have to 
> track a stack of generators. If I had this info on every generator, I would 
> be able to generate a complete stack trace (the stack of await calls) when 
> an exception is thrown.
>
> I looked at the working draft and did not see any info that would help. 
> The document I had looked at before (
> http://wiki.ecmascript.org/doku.php?id=harmony:generators) mentioned a 
> Source property but it was marked as internal.
>
> BTW I did not see any mention of the `send` function in the draft. I hope 
> it isn't gone because it makes it possible to implement very useful things, 
> like async/await.
>
> Is there any good place to discuss this with people involved in ES6?
>
> Bruno 
>
> On Friday, June 7, 2013 4:05:01 PM UTC+2, Andy Wingo wrote:
>>
>> Hi, 
>>
>> On Wed 05 Jun 2013 04:57, Bruno Jouhier <[email protected]> writes: 
>>
>> > I'm playing with version 3.19 and generators and I would need a 
>> > JavaScript API to extract stack trace information from generators. I 
>> > don't really need the whole stacktrace but I would need at least 
>> > function name + filename + line number of the top frame. 
>>
>> I'm not really sure what you mean here.  Generators are shallow 
>> coroutines consisting of a single function activation, and thus such a 
>> "stack trace" would only ever have one frame.  If you have a chain of 
>> them, that's something you build in a library, not in V8 itself. 
>>
>> As for "what you can do with a generator object", section 15.19.4 of the 
>> latest (14 May) ES6 draft specifies their behavior.  Figure 2 in section 
>> 15.19.3 specifies the various prototype chain, prototype property, and 
>> constructor properties of generator objects.  I believe it was suggested 
>> at one point that the per-function prototype have a .constructor link 
>> back to the specific generator function instead of to (Generator), but 
>> that was ruled out I think because of security concerns. 
>>
>> It seems to me that the right place for this introspection is probably 
>> in the Reflect module, which hasn't been specced out yet AFAIK.  So what 
>> you want is unfortunately not yet available on the language level. 
>>
>> Happy hacking, 
>>
>> Andy 
>>
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to