taoensso / carmine

Redis client + message queue for Clojure
https://www.taoensso.com/carmine
Eclipse Public License 1.0
1.15k stars 131 forks source link

Carmine v > 2.8.0, RuntimeException in clojure-1.7.0-alpha6 #130

Closed chairmanwow closed 9 years ago

chairmanwow commented 9 years ago

Hi Peter,

If you make a lein project using carmine LATEST and the newest clojure-1.7.0-alpha6, it breaks with a "java.lang.RuntimeException: Unable to resolve symbol: timeout-ms in this context".

My guess is the RuntimeException is coming from the following commit:

Line 58:

https://github.com/ptaoussanis/carmine/commit/bdfa04467187d18b9c07db3036f9469195294a35

Thanks!

mavbozo commented 9 years ago

thanks to the guys at #clojure irc channel.

The problem is in the destructuring here https://github.com/ptaoussanis/carmine/blob/v2.9.1/src/taoensso/carmine/connections.clj#L55-L59

timeout-ms symbol could be referred to, although it hasn' been defined, because the binding order might depends on the ordering of :keys (as illustrated below) or random if the map contains many kvs.

;; credit to amalloy
;; using clojure 1.7.0-alpha6
=> (macroexpand-1 '(let [{:keys [a b] :or {b a}} m]))

(let*
 [map__8239  m
  map__8239  (if (clojure.core/seq? map__8239)
                (clojure.lang.PersistentHashMap/create (clojure.core/seq map__8239))
                map__8239)
  a         (clojure.core/get map__8239 :a)
  b         (clojure.core/get map__8239 :b a)])

;; and reversing the :keys vector
=> (macroexpand-1 '(let [{:keys [b a] :or {b a}} m]))

(let*
 [map__8234  m
  map__8234 (if (clojure.hcore/seq? map__8234)
              (clojure.lang.PersistentHashMap/create (clojure.core/seq map__8234))
              map__8234)
  b         (clojure.core/get map__8234 :b a)
  a         (clojure.core/get map__8234 :a)])
ptaoussanis commented 9 years ago

Thanks for the report @chairmanwow, @mavbozo.

Just cut a v2.9.2 release and pushed to Clojars as [com.taoensso/carmine "2.9.2"].

Cheers :-)