FYI I just committed this fix to the ‘2.5.x’ branch:
changeset: 3378:042aab3880b5 branch: 2.5.x tag: tip parent: 3373:80a747e66561 user: Ludovic Courtès <ludovic.cour...@inria.fr> date: Tue Sep 17 11:07:02 2013 +0200 summary: scheme2js: Assign named lambdas to a JS variable (bug introduced in 3372:b0be8e3e08e6).
Modified scheme2js/out.scm diff -r 80a747e66561 -r 042aab3880b5 scheme2js/out.scm --- a/scheme2js/out.scm Fri Sep 13 17:23:06 2013 +0200 +++ b/scheme2js/out.scm Tue Sep 17 11:07:02 2013 +0200 @@ -630,7 +630,8 @@ (debug-name lvalue location) js-id (debug-arity this) js-id) - (?@ #t "function (~e) { ~@ }" + (?@ #t "~a = function (~e) { ~@ }" + js-id (separated "," (lambda (e) "~e" (walk e p #f #f)) formals-w/o-vaarg))
Revision 3372:b0be8e3e08e6 introduced a bug whereby a function value would be emitted instead of an assignment (it took me a while to find it...) Firefox would complain this way: --8<---------------cut here---------------start------------->8--- Error: SyntaxError: function statement requires a name Source File: http://localhost:9000/home/ludo/soft/share/hop/hop_s.js Line: 4526, Column: 9 Source Code: function (a) { var b = a; --8<---------------cut here---------------end--------------->8--- Thanks, Ludo’.