4

Since Clojure 1.3 "Earmuffed Vars are No Longer Automatically Considered Dynamic", some code in clojure.contrib depends on this feature and they no longer work. For example db in clojure.contrib.sql.

 Warning: *db* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *db* or change the name.
 Exception in thread "main" java.lang.RuntimeException: java.lang.ExceptionInInitializerError

The contrib library is still in verion 1.2. How to work around this? Or is there some alpha or prerelease version of contrib lib that can work with Clojure 1.3?

2 Answers 2

6

When Clojure moved to 1.3 it was decided to abandon monolithic contrib, i.e. a single Contrib library with a bunch of independent projects. The reason for this - afaict - was that some libraries had been abandoned and it was difficult to get people to upgrade them for 1.3.

Furthermore, a few libraries also changed their name. An overview can be found here: http://dev.clojure.org/display/doc/Clojure+Contrib In particular the contrib.sql library has been renamed to java.jdbc and now lives here https://github.com/clojure/java.jdbc

Sign up to request clarification or add additional context in comments.

1 Comment

thank you Paul. Switch to java.jdbc module and the problem resolved.
0

Often vars were earmuffed that had no expectation of being rebound, so it's possible that everything will work fine without it.

That said, you can redefine the old var as follows, allowing it to be dynamically re-bindable:

(in-ns 'other.ns)
(def ^:dynamic *foo* *foo*)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.