Hi, I can reproduce it with 1.2 and 1.3.0-master-20100911.130147-5. And I think I know, what the problem is: You must not recur out of a binding. The binding implicitely contains a try with cleanup code in the finally clause. It seems that recur bypasses the finally and executes again the binding. This pushes another frame of the bindings onto the stack, but the old frame is not popped. When the exception is thrown, the finally part gets executed and one frame is popped, but the additional frames remain. The stack of bindings is now out of sync. Hence your result. Throwing the exception in the first iteration will leave the bindings stack intact.
user=> (binding [x [1 2 3]] (loop [c 0] (binding [y [4 5 6]] (throw (Exception. "BOOOM"))))) Exception BOOOM user/eval13 (NO_SOURCE_FILE:9) user=> x IllegalStateException Var user/x is unbound. clojure.lang.Var.deref (Var.java:142) user=> y IllegalStateException Var user/y is unbound. clojure.lang.Var.deref (Var.java:142) Please find the following code, which works as expected: (defn test-fixed-nested-binding [] (binding [x [0 1 2 3 4 5 6]] (try (binding [y [7 8 9]] (loop [c 0] (change-value-of-thread-local-var) (throw-random-exception c) (recur (inc c)))) (catch Exception e (println (str x "\n" (.getMessage e))))))) Since recur is local, I think "don't do it" is a valid short- to mid- term fix. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en