[racket] My racketcon 2011 talk

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Tue Aug 2 16:38:31 EDT 2011

> Odd!  Yeah, I'm currently doing everything using Chrome.  But anything
> that breaks under other browsers is a bug, so I'll add this to my bug
> list.

Ok, try this one for Firefox 6.
http://hashcollision.org/whalesong/racketcon/talk-firefox6.html


---

Notes about what happened:

... ok, I'm seeing at least two issues with Firefox 6.  One of this is
my use of the 'arity' attribute for primitive functions, which I see
is not playing well with Firefox 6's use of that attribute.  Ugh, ok,
so I will rename that in the internal runtime to avoid that issue.



But one of them, though, appears to be a bug in Firefox 6.  Firefox 6
is telling me that the innermost reference to successFunction is not
lexically bound in the following code:

////////////////////////////////////////////////////////////////////////////////////////
var adaptWorldFunction = function(worldFunction) {
    return function() {
        // Consumes any number of arguments.
        var successFunction = arguments[arguments.length - 1];
        plt.baselib.functions.internalCallDuringPause.apply(
            null,
            [MACHINE,
             worldFunction,
             function(v) {
                 successFunction(v);
             },
             function(err) {
                 // FIXME: do error trapping
                 throw(err);
             }].concat([].slice.call(arguments, 0, arguments.length - 1)));
    }
};
////////////////////////////////////////////////////////////////////////////////////////



However, if I change this to the following, Firefox 6 is happy:

//////////////////////////////////////////////////////////////////////////////////////////////
var adaptWorldFunction = function(worldFunction) {
    var successFunction;
    return function() {
        // Consumes any number of arguments.
        successFunction = arguments[arguments.length - 1];
        plt.baselib.functions.internalCallDuringPause.apply(
            null,
            [MACHINE,
             worldFunction,
             function(v) {
                 successFunction(v);
             },
             function(err) {
                 // FIXME: do error trapping
                 throw(err);
             }].concat([].slice.call(arguments, 0, arguments.length - 1)));
    }
};
////////////////////////////////////////////////////////////////////////////////////////////////////


Good grief.  As we Racketeers know, the first approach should have
been perfectly ok too!  I guess I'm trying to say this: this is not
completely my fault.  :)  This looks like a Firefox 6 bug, and a
serious one.  Does anyone know how to submit a bug report to the
Mozilla folks?


I haven't patched Whalesong yet to regenerate the other code examples,
but here's the talk slides for Firefox 6 that I fixed by hand:
http://hashcollision.org/whalesong/racketcon/talk-firefox6.html



Posted on the users mailing list.