English 中文(简体)
某些法典。 1. 与Clojure 1.3 发生争执
原标题:some code in clojure.contrib broken with Clojure 1.3?
  • 时间:2011-11-02 09:46:20
  •  标签:
  • clojure

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?

最佳回答

当Clojure迁到1.3处时,决定放弃monolithic contrib,即由一个有独立项目的图书馆。 造成这种情况的原因是,一些图书馆被遗弃,人们很难将其升级为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

问题回答

经常有人戴上手铐,不希望被收复,这样,所有事情都有可能做不起。

尽管如此,你可以重新界定旧的var,使之能有活力地重新组合:

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




相关问题
How to improve Clojures error messages

I ve been playing a bit with Clojure and so far is fairly impressed, but one thing that I keep running into is wierd error messages from Clojure. This comes in two forms: Java errors, like null ...

clojure rmi classpath problem

I am trying to use clojure to implement a "plugin" for some vendor supplied software. Here is a little background on the vendor supplied software. It expects me to implement a particular interface ...

Help translating this Java codeblock to Clojure?

I m getting my feet wet with Clojure, and trying to get used to functional programming. I ve been translating various imperative functions from other languages into their Clojure equivalents -- and ...

Is functional Clojure or imperative Groovy more readable?

OK, no cheating now. No, really, take a minute or two and try this out. What does "positions" do? Edit: simplified according to cgrand s suggestion. (defn redux [[current next] flag] [(if flag ...

taking java method names as function arg in clojure

All, I want to create a function that takes a symbol representing a java method and applies it to some object: (user=> (defn f [m] (. "foo" (m))) When I execute this, I get a result much ...

how to efficiently apply a medium-weight function in parallel

I m looking to map a modestly-expensive function onto a large lazy seq in parallel. pmap is great but i m loosing to much to context switching. I think I need to increase the size of the chunk of work ...

热门标签