Thanks! This explains the strange behavior.
Anyhow, it should be documented somewhere that the implementation of 
continuations in Rhino is only half done and only works on a language 
subset. I mean, how can a normal user know that. It took me quite a while 
just to find out what causes the problem. Also, why leaving the interpreter 
loop at this point? What's so different to a normal function call (other 
than the explicitely defined this object)?

Thanks for your help!
Cheers, Thomas

"Attila Szegedi" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hm... that's indeed a problem. Without looking at the code, I actually 
> have an idea why it doesn't work. Continuations work only within a  single 
> invocation of Rhino's stackless interpreter loop. If you call  out of the 
> interpreter loop into Java code (which call() and apply()  will do), and 
> then back into a new instance of interpreter loop (which  an interpreted 
> function will do to run its implementation), a  continuation will not work 
> correctly. It can only capture/unwind  within the current interpreter loop 
> invocation.
>
> It'd be possible to apply a bit of a trickery in interpreter loop to 
> detect when call/apply is invoked for an InterpretedFunction instance, 
> and run it in the current interpreter loop.
>
> Attila.
>
> --
> home: http://www.szegedi.org
> weblog: http://constc.blogspot.com
>
> On 2007.11.22., at 17:03, Thomas wrote:
>
>> I'm heavily using continuations and noticed that they don't work 
>> correctly
>> if my code uses the call() or apply() functions on Function objectes  to
>> invoke a function. Just wondering if anybody had similar experience? 


_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to