cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Local variables in FlowScript
Date Tue, 20 Jan 2004 13:00:30 GMT
Hi all,

I think I'm missing something... But according to my observations, 
continuations are not capturing current state of the local variables. 
Consider following snippet:

function test() {
    var k = [];
    for (var i = 0; i < 5; i++) {
        k[i] = capture();
        if (k[i] == undefined) {
            cocoon.log.debug("Continuation resumed; i = " + i);
            FOM_Cocoon.suicide();
        }
    }

    k[2]();
}

function capture() {
    return new Continuation();
}


Once executed, you might expect that it will print "Continuation 
resumed; i = 2". But instead, it prints "Continuation resumed; i = 5", 
which is last state of the local variable "i", not the state the 
variable had when continuation was captured. I guess continuation only 
captures

The issue described above, combined with woody forms, makes wizards 
impossible - you can't get to the previous wizard page, as position will 
always point to the last visited page, instead of the page of the 
continuation. Any suggestions?


Another issue is that documentation [1], "Features" -> "Continuations" 
implies that state of local variables is captured. And chapter 
"Controlling what gets captured in a Continuation" does not suggest a 
way how to control what is captured in a continuation (i.e., how to 
indicate what should be captured).... :-/

Vadim

[1] http://wiki.cocoondev.org/Wiki.jsp?page=RhinoWithContinuations



Mime
View raw message