Igor Bukanov wrote:

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.

Igor, YOU ROCK!

Now, question: will this patch ever enter the main Rhino trunk? I'm sure I speak for the whole community here when I say that we would like to avoid having to distributed a forked version of rhino again because the patch might become no longer applicable.

Anyway, thanks so much for this!

--
Stefano.


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to