Single frame continuations proposal

David Herman dherman at
Wed Mar 31 09:56:52 PDT 2010

Hi Kris,

I've been poring over this for a while, and it's still really, really confusing. Could I ask you to show how you would write the following example with your proposal?

    function setup() {
        alert("done setup!");

    var flashingElts = [];

    function setFlashing(elt) {
        var toggle = true;
        window.setTimeout(function() {
   = toggle ? "red" : "white";
            toggle = !toggle;
        }, INTERVAL);

And then would you mind showing a rough translation of your implementation to ES5 code (similar to the translation of your `foo' function)?

>>> 6. Resume *continuation*, using the value of *result* for the
>>> continued evaluation of the current expression (if the
>>> continuation is inside an expression).
>> Is this supposed to fall through?
> Yes

That can't be true, can it? If step 6 continues to step 7 then we get:

    // step 5
    if (!($result && typeof $result.continueWith === "function")) {
        // do step 6
    // fall through
    var $waiting = true;
    var $continueWithResult = $result.continueWith($resume);

But we established in step 5 that there's no $result.continueWith function.


More information about the es-discuss mailing list