[armedbear-cvs] r11940 - trunk/abcl/src/org/armedbear/lisp

Alessio Stalla astalla at common-lisp.net
Sat May 23 22:44:27 UTC 2009


Author: astalla
Date: Sat May 23 18:44:26 2009
New Revision: 11940

Log:
Fixed a bug in interpreted let* and do*: the environment used for bindings 
was a single one, shared with all the initforms and the body. This caused
closures in initforms to capture newly-introduced bindings.
The fix amounts to creating a new extended environment for every binding.
In passing a typo was fixed in java.lisp.


Modified:
   trunk/abcl/src/org/armedbear/lisp/Do.java
   trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java
   trunk/abcl/src/org/armedbear/lisp/java.lisp

Modified: trunk/abcl/src/org/armedbear/lisp/Do.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Do.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Do.java	Sat May 23 18:44:26 2009
@@ -101,11 +101,12 @@
     LispObject specials = parseSpecials(bodyAndDecls.NTH(1));
     body = bodyAndDecls.car();
 
-    final Environment ext = new Environment(env);
+    Environment ext = new Environment(env);
     for (int i = 0; i < numvars; i++)
       {
         Symbol var = vars[i];
         LispObject value = eval(initforms[i], (sequential ? ext : env), thread);
+	ext = new Environment(ext);
         if (specials != NIL && memq(var, specials))
             thread.bindSpecial(var, value);
         else if (var.isSpecialVariable())

Modified: trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java	Sat May 23 18:44:26 2009
@@ -143,8 +143,10 @@
                 symbol = checkSymbol(obj);
                 value = NIL;
               }
-            if (sequential)
+            if (sequential) {
+	      ext = new Environment(ext);
               bindArg(specials, symbol, value, ext, thread);
+	    }
             else
                 nonSequentialVars.add(new Cons(symbol, value));
             varList = ((Cons)varList).cdr;

Modified: trunk/abcl/src/org/armedbear/lisp/java.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/java.lisp	(original)
+++ trunk/abcl/src/org/armedbear/lisp/java.lisp	Sat May 23 18:44:26 2009
@@ -288,7 +288,7 @@
      ((jinstance-of-p object "java.lang.Class")
       `(java:jclass ,(jcall (jmethod "java.lang.Class" "getName") object)))
      (t
-      (error "Unknown load-from for ~A" class-name)))))
+      (error "Unknown load-form for ~A" class-name)))))
 
 (defun jproperty-value (obj prop)
   (%jget-property-value obj prop))




More information about the armedbear-cvs mailing list