Hi!

http://bugzilla.mozilla.org/show_bug.cgi?id=258844 contains a working patch against Rhino CVS from mozilla.org to enable Continuation support there.

Note although the implementation is based on ideas from Christopher Oliver patch it is not a patch port.

In particular, there is no support for catch (continue|break|return) but on the same time finally is respected, so the example from http://wiki.apache.org/cocoon/RhinoWithContinuations

var pool = ...;

function someFunction() {

    var conn = pool.getConnection();
    ...

    catch (break) {
        conn.close();
        conn = null;
    }

    catch (continue) {
        conn = pool.getConnection();
    }
}

with the patch would like:

var pool = ...;

function someFunction() {

    var conn = null;
    try {
        if (conn == null) {
            conn = pool.getConnection();
        }
        ...
    } finally {
        conn.close();
        conn = null;
    }
}

That is, if the control leaves "..." during continuation jump, then finally will be executed in the same way as it would be executed if ... contains return, throws exceptions etc.

Another "differences" is that ContinuationException support for continuations across eval/Function.apply|call is not implemented yet.

On the other hand Continuation usage is the same as with Christopher's patch including support for serialization so the last example from http://wiki.apache.org/cocoon/RhinoWithContinuations does work.

Regards, Igor

Reply via email to