cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <>
Subject Re: Understanding continuations
Date Fri, 28 Mar 2003 11:16:43 GMT

Ugo Cei wrote:
> I'm having some problems with an application that uses the Flow and 
> XMLForms. I'm getting an invalid continuation error and after 4 hours of 
> debugging I still cannot understand why. Tracing the execution of the 
> flow, I've come to this snippet in xmlForm.js that I don't understand 
> fully:
>         if (wk != null) {
>             var jswk = wk.userObject;
>             jswk.continuation(jswk);
>             // note: not reached
>         }
> What kind of object is jswk? Is it an 
> o.a.c.components.flow.javascript.JSWebContinuation? Where is this 
> "continuation" method defined (assuming it is a method) and why is it 
> passed an instance of itself?

Yes, it is. The continuation property of JSWebContinuation returns a 
JavaScript Continuation object, which is also a function that can be 
called. When you do that the current function invocation (and call 
stack) is discarded and replaced with the function invocation (and call 
stack) stored within the continuation. That's why the next line is "not 

I know it seems strange, but the continuation is passed "jswk" so that 
it will become the return value of function it was captured in.

What do you mean by "invalid continuation error"?



View raw message