I thought that once defined clojure vars are immutable and retain their values. However, I accidentally bumped into a situation where I observe the same var in two different states. Here's how to reproduce:
lein new app vartest Add the following files to the test folder: ----- (ns vartest.test-data) (def uuid (java.util.UUID/randomUUID)) ----- (ns vartest.core-test (:require [clojure.test :refer :all] [vartest.test-data :as td])) (def my-uuid td/uuid) (deftest a-test (testing "accessing same var twice" (is (= my-uuid td/uuid)))) ---- Now run the tests: C:\temp\vartest>lein test :all lein test vartest.core-test lein test :only vartest.core-test/a-test FAIL in (a-test) (core_test.clj:9) accessing same var twice expected: (= my-uuid td/uuid) actual: (not (= #uuid "030d2fe8-407b-4d67-a505-261bc3650729" #uuid "f8405611-e2da-4dd2-973b-508831 27ef6a")) lein test vartest.test-data Ran 1 tests containing 1 assertions. 1 failures, 0 errors. Tests failed. However, if I run lein test :only vartest.core-test/a-test then the very same test passes. What's going on here? Environment: Clojure 1.5.1 and 1.6.0, Leiningen 2.3.4, Java 1.7.0_51 64-Bit, Windows 7 64-bit ::Antti:: -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.