[parenscript-devel] Side effects between lexical scopes of two closures
In the following, (FOO) should evaluate to 50, but actually evaluates to 90 because BAR's A binding has overwritten FOO's. Should they not have separate bindings? (progn (let ((a 5)) (defun foo () (* 10 a))) (let ((a 9)) (defun bar () (* 100 a)))) var a = 5; function foo() { return 10 * a; }; var a = 9; function bar() { return 100 * a; }; Daniel
To me separate bindings is expected. I suggest using gensym to compile the binding var names. On Fri, Feb 1, 2013 at 12:17 PM, Daniel Gackle <danielgackle@gmail.com> wrote:
In the following, (FOO) should evaluate to 50, but actually evaluates to 90 because BAR's A binding has overwritten FOO's. Should they not have separate bindings?
(progn (let ((a 5)) (defun foo () (* 10 a))) (let ((a 9)) (defun bar () (* 100 a))))
var a = 5; function foo() { return 10 * a; }; var a = 9; function bar() { return 100 * a; };
Daniel
_______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
participants (2)
-
Canhua
-
Daniel Gackle